ResizingState.tsx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { useParams } from 'common'
  2. import { Loader2 } from 'lucide-react'
  3. import { useProjectDetailQuery } from '@/data/projects/project-detail-query'
  4. import { PROJECT_STATUS } from '@/lib/constants'
  5. export const ResizingState = () => {
  6. const { ref } = useParams()
  7. useProjectDetailQuery(
  8. { ref },
  9. {
  10. // setting a refetch interval here will cause the `useSelectedProject()` in `ProjectLayout.tsx` to
  11. // rerender every 4 seconds while the project is resizing. Once resizing is complete, it will
  12. // no longer show this state.
  13. refetchInterval: (query) => {
  14. const data = query.state.data
  15. return data?.status !== PROJECT_STATUS.ACTIVE_HEALTHY ? 4000 : false
  16. },
  17. }
  18. )
  19. return (
  20. <div className="flex items-center justify-center h-full">
  21. <div className="bg-surface-100 border border-overlay rounded-md w-3/4 lg:w-1/2">
  22. <div className="space-y-6 py-6">
  23. <div className="flex px-8 space-x-8">
  24. <div className="mt-1">
  25. <Loader2 className="animate-spin text-foreground-light" size={18} />
  26. </div>
  27. <div className="flex flex-col gap-1">
  28. <p>Resizing Project Compute size</p>
  29. <p className="text-sm text-foreground-light">
  30. Your project is being restarted to apply compute size changes.
  31. </p>
  32. <p className="text-sm text-foreground-light">
  33. This can take a few minutes. Project will be offline while it is being restarted.
  34. </p>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. )
  41. }