Skip to content

Open source CapCut alternative.

TypeScript

feat(site): tighten the superuser delete card and add a profile loading skeleton

David Le2486722538df
diff --git a/site/src/app/cut/app/(home)/settings/profile/SuperuserSection.tsx b/site/src/app/cut/app/(home)/settings/profile/SuperuserSection.tsx
index 779e5635..686941dd 100644
--- a/site/src/app/cut/app/(home)/settings/profile/SuperuserSection.tsx
+++ b/site/src/app/cut/app/(home)/settings/profile/SuperuserSection.tsx
@@ -109,16 +109,18 @@ export function SuperuserSection() {
return (
<div className="rounded-xl border bg-card p-5">
- <div className="text-sm font-medium">Super user · Delete a user</div>
- <p className="mt-0.5 text-sm text-muted-foreground">
- Permanently deletes the account and everything it owns — projects,
- media, credits, billing, and its Resend contact. Visible to super users
- only.
- </p>
+ <div className="text-sm font-medium">Super user</div>
<div className="mt-4 space-y-3 border-t pt-4">
- <div className="space-y-2">
- <Label htmlFor="delete-user-email">User email</Label>
+ <div>
+ <div className="text-sm font-medium">Delete user</div>
+ <p className="mt-0.5 text-sm text-muted-foreground">
+ Permanently deletes the account and everything it owns — projects,
+ media, credits, billing, and its Resend contact.
+ </p>
+ </div>
+ <div className="flex items-center gap-2">
<Input
+ aria-label="User email"
className="max-w-xs"
id="delete-user-email"
onChange={(event) => setEmail(event.target.value)}
@@ -126,14 +128,14 @@ export function SuperuserSection() {
type="email"
value={email}
/>
+ <Button
+ disabled={target === "" || start.isPending || running}
+ onClick={openConfirm}
+ variant="destructive"
+ >
+ Delete user…
+ </Button>
</div>
- <Button
- disabled={target === "" || start.isPending || running}
- onClick={openConfirm}
- variant="destructive"
- >
- Delete user…
- </Button>
{running ? (
<p className="text-sm text-muted-foreground">Deleting {jobEmail}…</p>
diff --git a/site/src/app/cut/app/(home)/settings/profile/page.tsx b/site/src/app/cut/app/(home)/settings/profile/page.tsx
index e1f26710..4a1f3e35 100644
--- a/site/src/app/cut/app/(home)/settings/profile/page.tsx
+++ b/site/src/app/cut/app/(home)/settings/profile/page.tsx
@@ -10,6 +10,7 @@ import { SuperuserSection } from "@/app/cut/app/(home)/settings/profile/Superuse
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
+import { Skeleton } from "@/components/ui/skeleton";
import { UserAvatar } from "@/cut/components/UserAvatar";
import {
useAccountProfile,
@@ -29,7 +30,29 @@ export default function CutProfilePage() {
const [editingAvatar, setEditingAvatar] = useState(false);
if (isPending) {
- return <p className="text-sm text-muted-foreground">Loading…</p>;
+ // Skeleton shaped like the identity card and the section below it, so the
+ // page doesn't jump when the data lands.
+ return (
+ <div className="max-w-2xl space-y-6 pb-9">
+ <div className="rounded-xl border bg-card p-5">
+ <div className="flex items-center gap-3">
+ <Skeleton className="size-[3.6rem] rounded-lg" />
+ <div className="space-y-2">
+ <Skeleton className="h-4 w-32" />
+ <Skeleton className="h-4 w-48" />
+ </div>
+ </div>
+ <div className="mt-5 border-t pt-5">
+ <Skeleton className="h-4 w-24" />
+ <div className="mt-3 flex items-center gap-2">
+ <Skeleton className="h-8 w-full max-w-xs" />
+ <Skeleton className="h-8 w-14" />
+ </div>
+ </div>
+ </div>
+ <Skeleton className="h-28 w-full rounded-xl" />
+ </div>
+ );
}
if (isError || !profile) {
return <p className="text-sm text-red-600">Couldn&apos;t load your profile.</p>;