diff --git a/apps/platform/src/app/(main)/project/[project]/@secret/page.tsx b/apps/platform/src/app/(main)/project/[project]/@secret/page.tsx index 8919cbf7..5061bf8e 100644 --- a/apps/platform/src/app/(main)/project/[project]/@secret/page.tsx +++ b/apps/platform/src/app/(main)/project/[project]/@secret/page.tsx @@ -28,14 +28,17 @@ import { TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip' +import { Skeleton } from '@/components/ui/skeleton' extend(relativeTime) function SecretPage(): React.JSX.Element { const [allSecrets, setAllSecrets] = useState() + const [isLoading, setIsLoading] = useState(true) const pathname = usePathname() useEffect(() => { + setIsLoading(true) Secrets.getAllSecretbyProjectId(pathname.split('/')[2]) .then((data) => { setAllSecrets(data) @@ -44,8 +47,21 @@ function SecretPage(): React.JSX.Element { // eslint-disable-next-line no-console -- we need to log the error console.error(error) }) + .finally(() => { + setIsLoading(false) + }) }, [pathname]) + if (isLoading) { + return ( +
+ + + +
+ ) + } + return ( +
+
+ + +
+
+ + + +
+
+ + ) +} + export default SecretPage diff --git a/apps/platform/src/components/ui/skeleton.tsx b/apps/platform/src/components/ui/skeleton.tsx new file mode 100644 index 00000000..e2b6f938 --- /dev/null +++ b/apps/platform/src/components/ui/skeleton.tsx @@ -0,0 +1,18 @@ +import { cn } from '@/lib/utils' + +function Skeleton({ + className, + ...props +}: React.HTMLAttributes): React.JSX.Element { + return ( +
+ ) +} + +export { Skeleton }