Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minifront: modify sync modal #1976

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fast-maps-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'minifront': minor
---

prompt user to keep extension open in sync modal
27 changes: 7 additions & 20 deletions apps/minifront/src/components/syncing-dialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { statusSelector, useStatus } from '../../state/status';
import { SyncAnimation } from './sync-animation';
import { Text } from '@penumbra-zone/ui-deprecated/Text';
import { useEffect, useState } from 'react';
import { useSyncProgress } from '@penumbra-zone/ui-deprecated/components/ui/block-sync-status';

export const SyncingDialog = () => {
const status = useStatus({
Expand All @@ -23,11 +22,16 @@ export const SyncingDialog = () => {
return (
<Dialog isOpen={isOpen} onClose={() => setIsOpen(false)}>
<Dialog.Content title='Your client is syncing...' zIndex={9999}>
<div style={{ textAlign: 'center' }}>
<Text body as='p'>
<b>Keep the extension open to improve sync speed</b>
</Text>
</div>
<SyncAnimation />

<div className='text-center'>
<Text body as='p'>
Decrypting blocks to update your local state
<Text small as='p'>
Decrypting blocks to update your local state.
</Text>
<Text small as='p'>
You can click away, but your data <i>may</i> not be current
Expand All @@ -42,25 +46,8 @@ export const SyncingDialog = () => {
</Text>
)}
</div>
{!!status?.isCatchingUp && status.latestKnownBlockHeight ? (
<RemainingTime
fullSyncHeight={status.fullSyncHeight}
latestKnownBlockHeight={status.latestKnownBlockHeight}
/>
) : null}
</div>
</Dialog.Content>
</Dialog>
);
};

const RemainingTime = ({
fullSyncHeight,
latestKnownBlockHeight,
}: {
fullSyncHeight: bigint;
latestKnownBlockHeight: bigint;
}) => {
const { formattedTimeRemaining } = useSyncProgress(fullSyncHeight, latestKnownBlockHeight);
return <Text technical>(Estimated time remaining: {formattedTimeRemaining})</Text>;
};