feat: add expiry label to ExpiryCountDown component

This commit is contained in:
2025-07-06 22:38:39 +05:00
parent df2b3da22e
commit 4797ee8dde

View File

@ -15,7 +15,7 @@ const HumanizeTimeLeft = (seconds: number) => {
return `${minutes}m ${remainingSeconds}s` return `${minutes}m ${remainingSeconds}s`
} }
export default function ExpiryCountDown({ expiresAt }: { expiresAt: string }) { export default function ExpiryCountDown({ expiresAt, expiryLabel }: { expiresAt: string, expiryLabel: string }) {
const [timeLeft, setTimeLeft] = useState(calculateTimeLeft(expiresAt)) const [timeLeft, setTimeLeft] = useState(calculateTimeLeft(expiresAt))
const [mounted, setMounted] = useState(false) const [mounted, setMounted] = useState(false)
const router = useRouter() const router = useRouter()
@ -47,7 +47,7 @@ export default function ExpiryCountDown({ expiresAt }: { expiresAt: string }) {
{timeLeft ? ( {timeLeft ? (
<span>Time left: {HumanizeTimeLeft(timeLeft)}</span> <span>Time left: {HumanizeTimeLeft(timeLeft)}</span>
) : ( ) : (
<span>Top up has expired. Please make another topup to add balance to your wallet.</span> <span>{expiryLabel} has expired.</span>
)} )}
{timeLeft > 0 && ( {timeLeft > 0 && (
<Progress className='absolute bottom-0 left-0 right-0' color='#f49b5b' value={timeLeft / 600 * 100} /> <Progress className='absolute bottom-0 left-0 right-0' color='#f49b5b' value={timeLeft / 600 * 100} />