Working tree is now the canonical repo. Off-chain play-money + trustless on-chain (FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution, mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
28 lines
712 B
TypeScript
28 lines
712 B
TypeScript
import clsx from 'clsx'
|
|
import { useEffect, useState } from 'react'
|
|
import { getCountdownString } from 'client-common/lib/time'
|
|
|
|
export function Countdown(props: {
|
|
endDate: Date
|
|
className?: string
|
|
includeSeconds?: boolean
|
|
}) {
|
|
const { endDate, className, includeSeconds } = props
|
|
|
|
const [countdown, setCountdown] = useState('')
|
|
useEffect(() => {
|
|
setCountdown(getCountdownString(endDate, includeSeconds))
|
|
|
|
const intervalId = setInterval(() => {
|
|
setCountdown(getCountdownString(endDate, includeSeconds))
|
|
}, 1000)
|
|
return () => clearInterval(intervalId)
|
|
}, [endDate])
|
|
|
|
return (
|
|
<span suppressHydrationWarning className={clsx(className)}>
|
|
{countdown}
|
|
</span>
|
|
)
|
|
}
|