feat(webui): add catalog loading skeletons (#6092)

* feat(webui): add catalog loading skeletons

* feat(webui): add MCP tool loading skeleton

* fix(webui): make skill discovery skeletons visible

* refactor(webui): share skeleton status markup
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-07 21:28:53 +08:00
1 parent 7cb396788c
commit f24969d282
25 files changed
+538 -99

No files matched your search

@@ -0,0 +1,40 @@
import { SkeletonStatus } from "@/components/settings/shared/SkeletonStatus";
import { cn } from "@/lib/utils";
export function CatalogSkeleton({ label, layout }: {
label: string;
layout: "apps" | "channels" | "skills";
}) {
const channels = layout === "channels";
const skills = layout === "skills";
const block = "rounded bg-muted-foreground/20";
return (
<SkeletonStatus
label={label}
className={cn(
skills ? "space-y-1 px-3 pb-3 pt-2 sm:px-4" : "grid grid-cols-1 gap-y-1",
layout === "apps" && "gap-x-10 py-3 xl:grid-cols-2",
channels && "gap-x-4 min-[640px]:grid-cols-2",
)}
>
{Array.from({ length: 6 }, (_, index) => (
<div key={index} className={cn(
"flex min-w-0 items-center gap-3",
channels ? "settings-list-row py-2.5" : skills ? "px-2 py-3" : "px-3 py-3",
)}>
<div className={cn(block, "shrink-0", skills
? "h-1.5 w-1.5 rounded-full" : "h-9 w-9 rounded-[10px]")} />
<div className="min-w-0 flex-1 py-1">
<div className={cn(block, "h-3.5", index % 2 ? "w-1/2" : "w-2/3")} />
{!channels ? <div className={cn(block, "mt-2 h-3 w-4/5 opacity-60")} /> : null}
</div>
<div className={cn("flex shrink-0 items-center justify-center", channels && "w-16")}>
<div className={cn(block, channels ? "h-[22px] w-[38px] rounded-full"
: skills ? "hidden h-3 w-20 sm:block" : "h-7 w-7 rounded-full")} />
</div>
</div>
))}
</SkeletonStatus>
);
}
@@ -0,0 +1,18 @@
import type { ReactNode } from "react";
import { cn } from "@/lib/utils";
export function SkeletonStatus({ label, className, children }: {
label: string;
className: string;
children: ReactNode;
}) {
return (
<div role="status" aria-label={label} aria-busy="true">
<span className="sr-only">{label}</span>
<div aria-hidden className={cn("animate-pulse motion-reduce:animate-none", className)}>
{children}
</div>
</div>
);
}