feat(webui): unify the Apps catalog (#6700)
* feat(webui): unify the Apps catalog * fix(webui): serve all channel branding locally * fix(webui): refine Apps navigation and sidebar
This commit is contained in:
1 parent
5997a714f2
commit
2b232c9133
89 files changed
+1576
-1024
No files matched your search
@@ -47,7 +47,7 @@ export function CatalogSkeleton({ label, layout, appActionLabel }: {
|
||||
</div>
|
||||
) : <>{icon}{text}</>}
|
||||
<div className={cn("flex shrink-0 items-center justify-center",
|
||||
channels && "w-16", skills && "hidden h-[16.5px] w-[92px] justify-end sm:flex",
|
||||
channels && "w-11", skills && "hidden h-[16.5px] w-[92px] justify-end sm:flex",
|
||||
appActionLabel && "ml-auto")}>
|
||||
{appActionLabel ? <div className={cn(block, "flex h-8 items-center gap-1.5 rounded-full px-3 text-[12px] font-semibold")}>
|
||||
<span className="h-4 w-4 shrink-0" />
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
import { useId, type ComponentPropsWithRef, type ReactNode } from "react";
|
||||
import { Search } from "lucide-react";
|
||||
|
||||
import { SearchInput } from "@/components/ui/input";
|
||||
import { ToggleButton } from "@/components/ui/toggle-button";
|
||||
import { SETTINGS_SEARCH_INPUT_CLASS } from "@/components/settings/shared/SettingsControls";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type CatalogSearchProps = Omit<ComponentPropsWithRef<typeof SearchInput>, "className">;
|
||||
|
||||
export function CatalogSearch(props: CatalogSearchProps) {
|
||||
return (
|
||||
<div className="catalog-search">
|
||||
<Search className="pointer-events-none absolute start-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" aria-hidden />
|
||||
<SearchInput aria-label={props.placeholder} {...props}
|
||||
className={cn("h-9 rounded-control ps-9 text-ui-label", SETTINGS_SEARCH_INPUT_CLASS)} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function CatalogToolbar({ search, children }: { search?: CatalogSearchProps; children: ReactNode }) {
|
||||
return (
|
||||
<div className="catalog-toolbar">
|
||||
{children}
|
||||
{search && <CatalogSearch {...search} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function CatalogControls({ children }: { children: ReactNode }) {
|
||||
return <div className="catalog-controls text-ui-label">{children}</div>;
|
||||
}
|
||||
|
||||
export function CatalogToggle({ label, checked, onChange }: {
|
||||
label: string;
|
||||
checked: boolean;
|
||||
onChange: (checked: boolean) => void;
|
||||
}) {
|
||||
return (
|
||||
<label className="catalog-toggle cursor-pointer text-muted-foreground hover:text-foreground">
|
||||
<span>{label}</span>
|
||||
<ToggleButton label={label} checked={checked} onChange={onChange} />
|
||||
</label>
|
||||
);
|
||||
}
|
||||
|
||||
export function CatalogFilter<T extends string>({ label, value, options, onChange }: {
|
||||
label: string;
|
||||
value: T;
|
||||
options: ReadonlyArray<{ value: T; label: ReactNode }>;
|
||||
onChange: (value: T) => void;
|
||||
}) {
|
||||
const name = useId();
|
||||
return (
|
||||
<div className="catalog-choices" role="radiogroup" aria-label={label}>
|
||||
{options.map((option) => (
|
||||
<label key={option.value} className="relative cursor-pointer">
|
||||
<input className="peer sr-only" type="radio" name={name} value={option.value}
|
||||
checked={value === option.value} onChange={() => onChange(option.value)} />
|
||||
<span className="flex min-h-8 items-center gap-1 rounded-compact px-2 text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground peer-checked:bg-muted peer-checked:text-foreground peer-focus-visible:ring-2 peer-focus-visible:ring-inset peer-focus-visible:ring-ring">
|
||||
{option.label}
|
||||
</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/* Shared with the document's first paint; keep catalog geometry independent of loaded data. */
|
||||
.apps-catalog-layout, .catalog-toolbar {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
min-inline-size: 0;
|
||||
}
|
||||
.apps-catalog-layout > .catalog-section,
|
||||
.apps-catalog-layout > .catalog-section > .catalog-toolbar { display: contents; }
|
||||
.apps-catalog-layout { reading-flow: grid-rows; }
|
||||
.apps-catalog-layout > .catalog-tabs { justify-self: start; }
|
||||
.apps-catalog-layout > .catalog-search { order: 1; }
|
||||
.apps-catalog-layout > .catalog-section > :not(.catalog-toolbar),
|
||||
.apps-catalog-layout > .catalog-body {
|
||||
grid-column: 1 / -1;
|
||||
order: 2;
|
||||
min-inline-size: 0;
|
||||
margin-block-start: 8px;
|
||||
}
|
||||
.catalog-search { position: relative; grid-column: 1 / -1; min-inline-size: 0; }
|
||||
.catalog-controls, .catalog-choices, .catalog-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-block-size: 36px;
|
||||
min-inline-size: 0;
|
||||
}
|
||||
.catalog-controls { justify-self: end; justify-content: flex-end; gap: 12px; inline-size: 100%; }
|
||||
.catalog-choices { flex-wrap: wrap; gap: 2px; }
|
||||
.catalog-toggle { flex: none; gap: 8px; padding-inline-end: 4px; }
|
||||
@container (min-width: 24rem) {
|
||||
.catalog-controls:not(.startup-controls) .catalog-choices + .catalog-choices { position: relative; }
|
||||
.catalog-controls:not(.startup-controls) .catalog-choices + .catalog-choices::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset-inline-start: -6px;
|
||||
inset-block-start: 10px;
|
||||
block-size: 16px;
|
||||
border-inline-start: 1px solid hsl(var(--border));
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
@container (width < 40rem) {
|
||||
.apps-catalog-layout, .catalog-toolbar { gap: 8px; }
|
||||
.apps-catalog-layout > .catalog-tabs { inline-size: 100%; }
|
||||
.catalog-tabs > button { flex: 1 1 auto; }
|
||||
.catalog-controls > :last-child { margin-inline-start: auto; }
|
||||
}
|
||||
@container (width < 24rem) {
|
||||
.catalog-tabs > button {
|
||||
padding-inline: 0.25rem;
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
line-height: 1.25;
|
||||
}
|
||||
.catalog-controls { flex-direction: column; align-items: start; gap: 4px; }
|
||||
.catalog-controls > :last-child { align-self: end; }
|
||||
}
|
||||
@container (min-width: 40rem) {
|
||||
.apps-catalog-layout { grid-template-columns: minmax(0, 1fr) 24.5rem; }
|
||||
.apps-catalog-layout .catalog-controls { grid-column: 2; }
|
||||
}
|
||||
Reference in new issue
Block a user