Skip to content

Commit e355d4a

Browse files
committed
fix(*): added the skeleton loader
1 parent fc7837f commit e355d4a

File tree

2 files changed

+56
-29
lines changed

2 files changed

+56
-29
lines changed

app/(main)/settings/onboarding/page.tsx

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,42 @@ import {
2222
} from "@/app/lib/types/onboarding";
2323
import { apiFetch } from "@/app/lib/apiClient";
2424
import { colors } from "@/app/lib/colors";
25-
import { ArrowLeftIcon, RefreshIcon } from "@/app/components/icons";
25+
import { ArrowLeftIcon } from "@/app/components/icons";
2626
import { DEFAULT_PAGE_LIMIT } from "@/app/lib/constants";
2727

2828
type View = "loading" | "list" | "projects" | "form" | "success";
2929

30+
function OrganizationListSkeleton() {
31+
return (
32+
<div className="animate-pulse">
33+
<div className="flex items-center justify-between mb-6">
34+
<div>
35+
<div className="h-5 w-36 bg-neutral-200 rounded mb-2" />
36+
<div className="h-3 w-24 bg-neutral-100 rounded" />
37+
</div>
38+
<div className="h-9 w-40 bg-neutral-200 rounded-lg" />
39+
</div>
40+
<div className="space-y-2">
41+
{[1, 2, 3].map((i) => (
42+
<div
43+
key={i}
44+
className="flex items-center justify-between p-4 rounded-lg border border-border bg-white"
45+
>
46+
<div>
47+
<div className="h-4 w-40 bg-neutral-200 rounded mb-2" />
48+
<div className="h-3 w-28 bg-neutral-100 rounded" />
49+
</div>
50+
<div className="flex items-center gap-2">
51+
<div className="h-5 w-14 bg-neutral-100 rounded" />
52+
<div className="h-4 w-4 bg-neutral-100 rounded" />
53+
</div>
54+
</div>
55+
))}
56+
</div>
57+
</div>
58+
);
59+
}
60+
3061
export default function OnboardingPage() {
3162
const router = useRouter();
3263
const { sidebarCollapsed } = useApp();
@@ -133,11 +164,7 @@ export default function OnboardingPage() {
133164

134165
<div className="flex-1 overflow-y-auto">
135166
<div className="max-w-2xl py-5 px-8">
136-
{view === "loading" && (
137-
<div className="flex items-center justify-center py-20 text-text-secondary">
138-
<RefreshIcon className="w-6 h-6 animate-spin" />
139-
</div>
140-
)}
167+
{view === "loading" && <OrganizationListSkeleton />}
141168

142169
{view === "list" && (
143170
<OrganizationList

app/components/settings/onboarding/ProjectList.tsx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,34 @@ interface ProjectListProps {
99
onBack: () => void;
1010
}
1111

12+
function ProjectListSkeleton() {
13+
return (
14+
<div className="space-y-2 animate-pulse">
15+
{[1, 2, 3].map((i) => (
16+
<div
17+
key={i}
18+
className="flex items-center justify-between p-4 rounded-lg border border-border bg-white"
19+
>
20+
<div className="flex-1">
21+
<div className="h-4 w-36 bg-neutral-200 rounded mb-2" />
22+
<div className="h-3 w-48 bg-neutral-100 rounded" />
23+
</div>
24+
<div className="flex items-center gap-2">
25+
<div className="h-5 w-16 bg-neutral-100 rounded-full" />
26+
<div className="h-5 w-12 bg-neutral-100 rounded" />
27+
</div>
28+
</div>
29+
))}
30+
</div>
31+
);
32+
}
33+
1234
export default function ProjectList({
1335
organization,
1436
projects,
1537
isLoading,
1638
onBack,
1739
}: ProjectListProps) {
18-
const renderProjectLoader = () => {
19-
return (
20-
<div className="space-y-2">
21-
{[1, 2, 3].map((i) => (
22-
<div
23-
key={i}
24-
className="flex items-center justify-between p-4 rounded-lg border border-border bg-white animate-pulse"
25-
>
26-
<div className="flex-1">
27-
<div className="h-4 w-36 bg-neutral-200 rounded mb-2" />
28-
<div className="h-3 w-48 bg-neutral-100 rounded" />
29-
</div>
30-
<div className="flex items-center gap-2">
31-
<div className="h-5 w-16 bg-neutral-100 rounded-full" />
32-
<div className="h-5 w-12 bg-neutral-100 rounded" />
33-
</div>
34-
</div>
35-
))}
36-
</div>
37-
);
38-
};
39-
4040
return (
4141
<div>
4242
<button
@@ -60,7 +60,7 @@ export default function ProjectList({
6060
</div>
6161

6262
{isLoading ? (
63-
renderProjectLoader()
63+
<ProjectListSkeleton />
6464
) : projects.length === 0 ? (
6565
<div className="text-center py-12 text-text-secondary text-sm">
6666
No projects found for this organization.

0 commit comments

Comments
 (0)