mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-08 01:06:31 +00:00
feat: add expiry label to ExpiryCountDown component ✨
This commit is contained in:
@ -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} />
|
||||||
|
Reference in New Issue
Block a user