Skip to content

Commit feff95b

Browse files
committed
feat(webapp): enhance Oracle UI with progress indicator
add `Progress` component to display block time countdown visually. Improves user feedback and enhances page aesthetics.
1 parent fc06431 commit feff95b

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

packages/nouns-webapp/src/pages/Oracle.tsx

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Address } from '@/utils/types';
22

3-
import { useCallback, useEffect, useRef, useState } from 'react';
3+
import React, { useCallback, useEffect, useRef, useState } from 'react';
44

55
import { Trans, useLingui } from '@lingui/react/macro';
66
import {
@@ -19,6 +19,7 @@ import { useWatchBlocks } from 'wagmi';
1919
import Noun, { LoadingNoun } from '@/components/LegacyNoun';
2020
import { Alert, AlertTitle } from '@/components/ui/alert';
2121
import { Button } from '@/components/ui/button';
22+
import { Progress } from '@/components/ui/progress';
2223
import {
2324
readNounsAuctionHouseAuction,
2425
useWriteNounsAuctionHouseSettleCurrentAndCreateNewAuction,
@@ -232,14 +233,11 @@ const AuctionControlPanel = ({
232233
Blocks change really fast, so the next Noun preview will end in a few seconds.
233234
</Trans>
234235
</p>
235-
<p>
236-
<Trans>
237-
There is going to be a delay of{' '}
238-
<BlockTimeCountdown currentBlockTimestamp={currentBlockTimestamp} />
239-
</Trans>
240-
</p>
236+
237+
<BlockTimeCountdown currentBlockTimestamp={currentBlockTimestamp} />
238+
241239
<Button
242-
className="relative my-5 inline-block h-12 w-full cursor-pointer select-none rounded-lg border-x-0 border-y-0 border-none border-transparent bg-neutral-800 px-3 py-1 text-center align-middle text-lg normal-case leading-7 text-white hover:bg-zinc-500 hover:text-stone-300 focus:bg-zinc-500 focus:text-stone-300"
240+
className="relative mb-5 inline-block h-12 w-full cursor-pointer select-none rounded-lg border-x-0 border-y-0 border-none border-transparent bg-neutral-800 px-3 py-1 text-center align-middle text-lg normal-case leading-7 text-white hover:bg-zinc-500 hover:text-stone-300 focus:bg-zinc-500 focus:text-stone-300"
243241
onClick={onSettleAuction}
244242
disabled={isSettlingAuction}
245243
>
@@ -283,10 +281,27 @@ function BlockTimeCountdown({
283281
return () => clearInterval(timerId);
284282
}, [currentBlockTimestamp]);
285283

284+
// Calculate progress value as a percentage (0-100)
285+
const progressValue = ((AVERAGE_BLOCK_TIME - timeLeft) / AVERAGE_BLOCK_TIME) * 100;
286+
286287
return (
287-
<>
288-
<span className="font-bold">{timeLeft}</span> {timeLeft === 1 ? 'second' : 'seconds'} until
289-
next block
290-
</>
288+
<div className="my-4">
289+
<div className="mb-1 flex justify-between">
290+
<span>
291+
<span className="font-bold">{timeLeft}</span> {timeLeft === 1 ? 'second' : 'seconds'}{' '}
292+
until next block.
293+
</span>
294+
</div>
295+
<Progress
296+
value={progressValue}
297+
className="h-3"
298+
// Override the indicator color to match the button
299+
style={
300+
{
301+
'--bs-primary-rgb': '38, 38, 38', // neutral-800 equivalent
302+
} as React.CSSProperties
303+
}
304+
/>
305+
</div>
291306
);
292307
}

0 commit comments

Comments
 (0)