Files
supabase/apps/studio/components/interfaces/DiskManagement/ui/DiskCountdownRadial.tsx
Ivan VasilovandJordi Enric 56de26fe22 chore: Migrate the monorepo to use Tailwind v4 (#45318)
This PR migrates the whole monorepo to use Tailwind v4:
- Removed `@tailwindcss/container-queries` plugin since it's included by
default in v4,
- Bump all instances of Tailwind to v4. Made minimal changes to the
shared config to remove non-supported features (`alpha` mentions),
- Migrate all apps to be compatible with v4 configs,
- Fix the `typography.css` import in 3 apps,
- Add missing rules which were included by default in v3,
- Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot
of classes
- Rename all misnamed classes according to
https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all
apps.

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-04-30 10:53:24 +00:00

72 lines
2.4 KiB
TypeScript

import { useParams } from 'common'
import { AnimatePresence, motion } from 'framer-motion'
import { useEffect, useState } from 'react'
import { Card, CardContent } from 'ui'
import FormMessage from './FormMessage'
import CountdownTimerRadial from '@/components/ui/CountdownTimer/CountdownTimerRadial'
import CountdownTimerSpan from '@/components/ui/CountdownTimer/CountdownTimerSpan'
import { useRemainingDurationForDiskAttributeUpdate } from '@/data/config/disk-attributes-query'
import { COOLDOWN_DURATION } from '@/data/config/disk-attributes-update-mutation'
export function DiskCountdownRadial() {
const { ref } = useParams()
const [remainingTime, setRemainingTime] = useState(0)
const {
remainingDuration: initialRemainingTime,
error,
isSuccess,
} = useRemainingDurationForDiskAttributeUpdate({
projectRef: ref,
})
const progressPercentage = (remainingTime / COOLDOWN_DURATION) * 100
useEffect(() => {
if (initialRemainingTime > 0) setRemainingTime(initialRemainingTime)
}, [initialRemainingTime])
useEffect(() => {
if (remainingTime <= 0) return
const timer = setInterval(() => {
setRemainingTime(Math.max(0, remainingTime - 1))
}, 1000)
return () => clearInterval(timer)
}, [remainingTime])
return (
<AnimatePresence>
{remainingTime > 0 && isSuccess && (
<motion.div
initial={{ opacity: 0, height: 0 }}
animate={{ opacity: 1, height: 'auto' }}
exit={{ opacity: 0, height: 0 }}
transition={{ duration: 0.2 }}
>
<Card className="px-2 rounded-sm bg-surface-100">
<CardContent className="py-3 flex gap-3 px-3 items-start">
<CountdownTimerRadial progress={progressPercentage} />
<div className="flex flex-col gap-2">
<div>
<p className="text-foreground text-sm p-0">
4-hour cooldown period is in progress
</p>
<p className="text-foreground-lighter text-sm p-0">
You can't modify your disk configuration again until the 4-hour cool down period
ends.
</p>
</div>
<CountdownTimerSpan seconds={remainingTime} />
</div>
</CardContent>
</Card>
</motion.div>
)}
{error && <FormMessage message={error.message} type="error" />}
</AnimatePresence>
)
}