From 9b5a5c53026656da2dfba21cd89e5e24e0b92a7a Mon Sep 17 00:00:00 2001 From: Xubin Ren <52506698+Re-bin@users.noreply.github.com> Date: Mon, 27 Jul 2026 21:31:34 +0800 Subject: [PATCH] style(webui): refine skills mobile experience --- .../settings/SkillsCatalogSettings.tsx | 78 +++++++++++++++---- .../components/settings/SkillsMarketplace.tsx | 15 ++-- webui/src/components/ui/sheet.tsx | 22 +++++- webui/src/tests/app-layout.test.tsx | 15 +++- 4 files changed, 105 insertions(+), 25 deletions(-) diff --git a/webui/src/components/settings/SkillsCatalogSettings.tsx b/webui/src/components/settings/SkillsCatalogSettings.tsx index 6915c296a..fb793e5ad 100644 --- a/webui/src/components/settings/SkillsCatalogSettings.tsx +++ b/webui/src/components/settings/SkillsCatalogSettings.tsx @@ -146,7 +146,12 @@ export function SkillsCatalogSettings({ skills }: { skills: SkillSummary[] }) { className="h-9 rounded-[11px] bg-background pl-9 text-[13px]" /> -
+
{([ ["all", t("settings.skills.filterAll", { defaultValue: "All" }), skills.length], [ @@ -165,7 +170,7 @@ export function SkillsCatalogSettings({ skills }: { skills: SkillSummary[] }) { type="button" onClick={() => setInstalledFilter(filter)} className={cn( - "rounded-[8px] px-2.5 py-1 text-[11px] font-medium transition-colors", + "shrink-0 whitespace-nowrap rounded-[8px] px-2.5 py-1 text-[11px] font-medium transition-colors", installedFilter === filter ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground", @@ -314,6 +319,7 @@ function SkillDetailSheet({ const [actionError, setActionError] = useState(""); const [deleteOpen, setDeleteOpen] = useState(false); const [refreshKey, setRefreshKey] = useState(0); + const [descriptionExpanded, setDescriptionExpanded] = useState(false); useEffect(() => { if (!open || !skill) return; @@ -323,6 +329,7 @@ function SkillDetailSheet({ setLoadFailed(false); setActionError(""); setDeleteOpen(false); + setDescriptionExpanded(false); fetchSkillDetail(token, skill.name) .then((payload) => { if (!cancelled) setDetail(payload); @@ -349,6 +356,7 @@ function SkillDetailSheet({ : activeSkill.available ? t("settings.skills.statusEnabled", { defaultValue: "Enabled" }) : t("settings.skills.statusNeedsSetup", { defaultValue: "Needs setup" }); + const descriptionExpandable = activeSkill.description.length > 240; const toggleEnabled = async () => { setActionBusy(true); @@ -399,12 +407,25 @@ function SkillDetailSheet({ -
+
- + {activeSkill.name} @@ -427,9 +448,26 @@ function SkillDetailSheet({ {statusLabel}
-

+

{activeSkill.description}

+ {descriptionExpandable ? ( + + ) : null}
@@ -444,7 +482,7 @@ function SkillDetailSheet({
) : (
-
+

{t("settings.skills.enabledControl", { defaultValue: "Use this skill" })} @@ -467,15 +505,20 @@ function SkillDetailSheet({ disabled={actionBusy} onClick={() => void toggleEnabled()} className={cn( - "relative h-6 w-11 shrink-0 rounded-full transition-colors", + "relative -mr-1 h-10 w-14 shrink-0 rounded-full", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", "disabled:cursor-wait disabled:opacity-60", - enabled ? "bg-foreground" : "bg-muted-foreground/30", )} > + @@ -498,7 +541,7 @@ function SkillDetailSheet({ {detail ? : null} {deletable ? ( -

+

{t("settings.skills.deleteTitle", { defaultValue: "Delete skill" })} @@ -511,11 +554,14 @@ function SkillDetailSheet({