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
@@ -266,7 +266,6 @@ interface ChatListProps {
|
||||
actionMenuPortalContainer?: HTMLElement | null;
|
||||
loading?: boolean;
|
||||
initialLoading?: boolean;
|
||||
emptyLabel?: string;
|
||||
}
|
||||
|
||||
export const ChatList = memo(function ChatList({
|
||||
@@ -309,7 +308,6 @@ export const ChatList = memo(function ChatList({
|
||||
actionMenuPortalContainer,
|
||||
loading,
|
||||
initialLoading = loading,
|
||||
emptyLabel,
|
||||
}: ChatListProps) {
|
||||
const { t } = useTranslation();
|
||||
const [visibleLimit, setVisibleLimit] = useState(INITIAL_VISIBLE_SESSIONS);
|
||||
@@ -638,13 +636,7 @@ export const ChatList = memo(function ChatList({
|
||||
);
|
||||
}
|
||||
|
||||
if (sessions.length === 0 && temporarySessions.length === 0) {
|
||||
return (
|
||||
<div className="px-3 py-6 text-[12px] leading-5 text-sidebar-muted-foreground">
|
||||
{emptyLabel ?? t("chat.noSessions")}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (sessions.length === 0 && temporarySessions.length === 0) return null;
|
||||
|
||||
const running = new Set(runningChatIds);
|
||||
const updated = new Set(updatedChatIds);
|
||||
|
||||
+155
-150
@@ -1,21 +1,13 @@
|
||||
import {
|
||||
ArchiveIcon,
|
||||
SkillsIcon,
|
||||
AutomationsIcon,
|
||||
ChannelsIcon,
|
||||
SearchIcon,
|
||||
SettingsIcon,
|
||||
NewChatIcon,
|
||||
ComposeIcon,
|
||||
AppsIcon,
|
||||
} from "@/components/icons/product-icons";
|
||||
import {
|
||||
type ReactNode,
|
||||
type RefObject,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import { PanelLeftClose } from "lucide-react";
|
||||
import { type ReactNode, useLayoutEffect, useRef, useState } from "react";
|
||||
import { PanelLeftClose, PanelLeftOpen } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import {
|
||||
@@ -39,6 +31,7 @@ import type {
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { UpdateMethod } from "@/lib/api";
|
||||
import { sidebarShortcutAria, sidebarShortcutLabel } from "@/lib/sidebar-shortcuts";
|
||||
import "./sidebar-dock.css";
|
||||
|
||||
interface SidebarProps {
|
||||
sessions: ChatSummary[];
|
||||
@@ -46,7 +39,6 @@ interface SidebarProps {
|
||||
activeKey: string | null;
|
||||
loading: boolean;
|
||||
initialLoading?: boolean;
|
||||
newChatActive: boolean;
|
||||
onNewChat: () => void;
|
||||
onSelect: (key: string) => void;
|
||||
onCloseTemporaryChat?: (key: string) => void;
|
||||
@@ -73,12 +65,10 @@ interface SidebarProps {
|
||||
onOpenUpdates?: () => void;
|
||||
availableUpdate?: { version: string; onDismiss: () => void; onRequestUpdate?: () => void; installationMethod?: UpdateMethod | null };
|
||||
onOpenApps: () => void;
|
||||
onOpenSkills: () => void;
|
||||
onOpenAutomations: () => void;
|
||||
onOpenChannels: () => void;
|
||||
onSettingsIntent?: () => void;
|
||||
onOpenSearch: () => void;
|
||||
activeUtility?: "apps" | "skills" | "automations" | "channels" | null;
|
||||
activeUtility?: "apps" | "automations" | null;
|
||||
onToggleArchived: () => void;
|
||||
onCollapse?: () => void;
|
||||
onExpand?: () => void;
|
||||
@@ -100,6 +90,7 @@ interface SidebarProps {
|
||||
archivedCount?: number;
|
||||
defaultWorkspacePath?: string | null;
|
||||
hostChromeInset?: boolean;
|
||||
desktopDock?: boolean;
|
||||
}
|
||||
|
||||
type NavigatorWithUserAgentData = Navigator & {
|
||||
@@ -119,36 +110,31 @@ export function Sidebar(props: SidebarProps) {
|
||||
const [menuPortalContainer, setMenuPortalContainer] =
|
||||
useState<HTMLElement | null>(null);
|
||||
const collapsed = Boolean(props.collapsed);
|
||||
const canExpand = collapsed && Boolean(props.onExpand);
|
||||
const expandButton = useRef<HTMLButtonElement>(null);
|
||||
const collapseButton = useRef<HTMLButtonElement>(null);
|
||||
const restoreToggleFocus = useRef(false);
|
||||
useLayoutEffect(() => {
|
||||
if (!restoreToggleFocus.current) return;
|
||||
restoreToggleFocus.current = false;
|
||||
(collapsed ? expandButton : collapseButton).current?.focus();
|
||||
}, [collapsed]);
|
||||
|
||||
const toggleLabel = t("thread.header.toggleSidebar");
|
||||
const collapseLabel = t("sidebar.collapse");
|
||||
const apple = isApplePlatform();
|
||||
const activeActionRef = useRef<HTMLButtonElement>(null);
|
||||
const activeActionId = collapsed && props.newChatActive
|
||||
? "new-chat"
|
||||
: props.activeUtility
|
||||
? `utility:${props.activeUtility}`
|
||||
: null;
|
||||
const activeUtilityId = props.activeUtility ? `utility:${props.activeUtility}` : null;
|
||||
const { desktopDock } = props;
|
||||
const footerActionProps = { collapsed, dockLabel: desktopDock, onIntent: props.onSettingsIntent, tooltipSide: "top" } as const;
|
||||
|
||||
const newChatButton = (
|
||||
<SidebarActionButton
|
||||
collapsed={collapsed}
|
||||
label={t("sidebar.newChat")}
|
||||
iconOnly
|
||||
className={collapsed ? undefined : "rounded-full border border-border/70 bg-background/80 shadow-sm settings-hover"}
|
||||
onClick={props.onNewChat}
|
||||
active={props.newChatActive}
|
||||
selectionRef={collapsed ? activeActionRef : undefined}
|
||||
icon={collapsed ? <NewChatIcon className="h-4 w-4" /> : <ComposeIcon className="h-4 w-4" />}
|
||||
shortcut={sidebarShortcutLabel("newChat", apple)}
|
||||
ariaKeyShortcuts={sidebarShortcutAria("newChat")}
|
||||
/>
|
||||
);
|
||||
const searchButton = (
|
||||
<SidebarActionButton
|
||||
collapsed={collapsed}
|
||||
label={t("sidebar.searchAria")}
|
||||
shortcut={sidebarShortcutLabel("search", apple)}
|
||||
ariaKeyShortcuts={sidebarShortcutAria("search")}
|
||||
iconOnly
|
||||
iconOnly={!desktopDock}
|
||||
dockLabel={desktopDock}
|
||||
onClick={props.onOpenSearch}
|
||||
icon={<SearchIcon className="h-4 w-4" />}
|
||||
/>
|
||||
@@ -161,134 +147,119 @@ export function Sidebar(props: SidebarProps) {
|
||||
data-theme-ink
|
||||
ref={props.containActionMenus ? setMenuPortalContainer : undefined}
|
||||
aria-label={t("sidebar.navigation")}
|
||||
data-sidebar-collapsed={desktopDock ? collapsed : undefined}
|
||||
className={cn(
|
||||
"flex h-full w-full min-w-0 flex-col text-sidebar-content",
|
||||
props.hostChromeInset ? "bg-transparent" : "bg-sidebar",
|
||||
desktopDock || collapsed || props.hostChromeInset ? "bg-transparent" : "bg-sidebar",
|
||||
)}
|
||||
>
|
||||
<div
|
||||
data-testid="sidebar-brand-row"
|
||||
className={cn(
|
||||
"flex items-start gap-1 pb-4 pt-3",
|
||||
collapsed ? "w-14 justify-start px-3" : "justify-between ps-4 pe-2",
|
||||
"flex items-start justify-between gap-1 pb-4 ps-3 pt-3",
|
||||
collapsed ? "w-14 pe-3" : "pe-2",
|
||||
)}
|
||||
>
|
||||
<button
|
||||
data-testid="sidebar-brand-mark"
|
||||
type="button"
|
||||
aria-label={collapsed ? toggleLabel : undefined}
|
||||
aria-hidden={collapsed ? undefined : true}
|
||||
title={collapsed ? toggleLabel : undefined}
|
||||
onClick={collapsed ? props.onExpand : undefined}
|
||||
tabIndex={collapsed ? 0 : -1}
|
||||
className={cn(
|
||||
"host-no-drag relative flex h-8 w-8 shrink-0 items-center justify-center rounded-control transition-colors",
|
||||
props.hostChromeInset && "mt-5",
|
||||
!collapsed && "pointer-events-none",
|
||||
)}
|
||||
>
|
||||
<img
|
||||
src="/brand/nanobot_mark.svg"
|
||||
alt=""
|
||||
className="theme-art h-8 w-8 select-none object-contain dark:opacity-0"
|
||||
draggable={false}
|
||||
/>
|
||||
<img
|
||||
src="/brand/nanobot_mark_night.svg"
|
||||
alt=""
|
||||
className="theme-art absolute inset-0 h-8 w-8 select-none object-contain opacity-0 dark:opacity-100"
|
||||
draggable={false}
|
||||
/>
|
||||
</button>
|
||||
<HoverHint enabled={canExpand} content={toggleLabel} side="right">
|
||||
<Button
|
||||
ref={expandButton}
|
||||
data-testid="sidebar-brand-mark"
|
||||
type="button"
|
||||
size="icon"
|
||||
variant={canExpand ? "icon" : null}
|
||||
aria-label={canExpand ? toggleLabel : undefined}
|
||||
aria-expanded={canExpand ? false : undefined}
|
||||
aria-hidden={canExpand ? undefined : true}
|
||||
onClick={canExpand ? (event) => {
|
||||
restoreToggleFocus.current = event.detail === 0 && Boolean(props.onCollapse);
|
||||
props.onExpand?.();
|
||||
} : undefined}
|
||||
tabIndex={canExpand ? 0 : -1}
|
||||
className={cn(
|
||||
"host-no-drag group/brand relative h-8 w-8 shrink-0",
|
||||
props.hostChromeInset && "mt-5",
|
||||
!canExpand && "pointer-events-none",
|
||||
)}
|
||||
>
|
||||
<span className={cn("relative h-8 w-8", canExpand && "media-hover:group-hover/brand:opacity-0 group-focus-visible/brand:opacity-0")}>
|
||||
<img
|
||||
src="/brand/nanobot_mark.svg"
|
||||
alt=""
|
||||
className="theme-art h-8 w-8 select-none object-contain dark:opacity-0"
|
||||
draggable={false}
|
||||
/>
|
||||
<img
|
||||
src="/brand/nanobot_mark_night.svg"
|
||||
alt=""
|
||||
className="theme-art absolute inset-0 h-8 w-8 select-none object-contain opacity-0 dark:opacity-100"
|
||||
draggable={false}
|
||||
/>
|
||||
</span>
|
||||
{canExpand && <PanelLeftOpen aria-hidden className="absolute inset-2 h-4 w-4 opacity-0 media-hover:group-hover/brand:opacity-100 group-focus-visible/brand:opacity-100" />}
|
||||
</Button>
|
||||
</HoverHint>
|
||||
{!collapsed && (
|
||||
<div className={cn("flex min-w-0 flex-1 items-center justify-end gap-1", props.hostChromeInset && "mt-5")}>
|
||||
{searchButton}
|
||||
{newChatButton}
|
||||
{!desktopDock && searchButton}
|
||||
{props.onCollapse && (
|
||||
<SidebarActionButton collapsed={false} label={t("sidebar.collapse")} iconOnly
|
||||
onClick={props.onCollapse} icon={<PanelLeftClose className="h-4 w-4" />} />
|
||||
<HoverHint content={collapseLabel} side="right">
|
||||
<Button
|
||||
ref={collapseButton}
|
||||
type="button"
|
||||
size="icon"
|
||||
variant="icon"
|
||||
className="host-no-drag h-8 w-8 shrink-0 text-sidebar-content"
|
||||
aria-label={collapseLabel}
|
||||
aria-expanded={props.onExpand ? true : undefined}
|
||||
onClick={(event) => {
|
||||
restoreToggleFocus.current = event.detail === 0 && Boolean(props.onExpand);
|
||||
props.onCollapse?.();
|
||||
}}
|
||||
>
|
||||
<PanelLeftClose aria-hidden className="h-4 w-4" />
|
||||
</Button>
|
||||
</HoverHint>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<SidebarSelectionHighlight
|
||||
targetRef={activeActionRef}
|
||||
activeId={activeActionId}
|
||||
scope="actions"
|
||||
className={cn(
|
||||
"relative gap-0.5 pb-1",
|
||||
collapsed ? "flex w-14 flex-col items-center px-0" : "flex flex-col px-2",
|
||||
)}
|
||||
>
|
||||
{collapsed && <>{newChatButton}{searchButton}</>}
|
||||
<div className={cn("flex flex-col gap-0.5 pb-1", desktopDock || collapsed ? "px-3" : "px-2")}>
|
||||
<SidebarActionButton
|
||||
collapsed={collapsed}
|
||||
label={t("sidebar.apps")}
|
||||
shortcut={sidebarShortcutLabel("apps", apple)}
|
||||
ariaKeyShortcuts={sidebarShortcutAria("apps")}
|
||||
onClick={props.onOpenApps}
|
||||
onIntent={props.onSettingsIntent}
|
||||
active={props.activeUtility === "apps"}
|
||||
selectionRef={activeActionRef}
|
||||
icon={<AppsIcon className="h-4 w-4" />}
|
||||
/>
|
||||
<SidebarActionButton
|
||||
collapsed={collapsed}
|
||||
label={t("sidebar.skills.title")}
|
||||
shortcut={sidebarShortcutLabel("skills", apple)}
|
||||
ariaKeyShortcuts={sidebarShortcutAria("skills")}
|
||||
onClick={props.onOpenSkills}
|
||||
onIntent={props.onSettingsIntent}
|
||||
active={props.activeUtility === "skills"}
|
||||
selectionRef={activeActionRef}
|
||||
icon={<SkillsIcon className="h-4 w-4" />}
|
||||
/>
|
||||
<SidebarActionButton
|
||||
collapsed={collapsed}
|
||||
label={t("sidebar.automations", { defaultValue: "Automations" })}
|
||||
shortcut={sidebarShortcutLabel("automations", apple)}
|
||||
ariaKeyShortcuts={sidebarShortcutAria("automations")}
|
||||
onClick={props.onOpenAutomations}
|
||||
onIntent={props.onSettingsIntent}
|
||||
active={props.activeUtility === "automations"}
|
||||
selectionRef={activeActionRef}
|
||||
icon={<AutomationsIcon className="h-4 w-4" />}
|
||||
/>
|
||||
<SidebarActionButton
|
||||
collapsed={collapsed}
|
||||
label={t("settings.nav.channels")}
|
||||
shortcut={sidebarShortcutLabel("channels", apple)}
|
||||
ariaKeyShortcuts={sidebarShortcutAria("channels")}
|
||||
onClick={props.onOpenChannels}
|
||||
onIntent={props.onSettingsIntent}
|
||||
active={props.activeUtility === "channels"}
|
||||
selectionRef={activeActionRef}
|
||||
icon={<ChannelsIcon className="h-4 w-4" />}
|
||||
label={t("sidebar.newChat")}
|
||||
dockLabel={desktopDock}
|
||||
onClick={props.onNewChat}
|
||||
icon={<ComposeIcon className="h-4 w-4" />}
|
||||
shortcut={sidebarShortcutLabel("newChat", apple)}
|
||||
ariaKeyShortcuts={sidebarShortcutAria("newChat")}
|
||||
/>
|
||||
{(desktopDock || collapsed) && searchButton}
|
||||
{props.archivedCount ? (
|
||||
<SidebarActionButton
|
||||
collapsed={collapsed}
|
||||
dockLabel={desktopDock}
|
||||
label={props.showArchived ? t("chat.hideArchived") : t("chat.showArchived")}
|
||||
onClick={props.onToggleArchived}
|
||||
icon={<ArchiveIcon className="h-4 w-4" />}
|
||||
/>
|
||||
) : null}
|
||||
</SidebarSelectionHighlight>
|
||||
</div>
|
||||
<div
|
||||
aria-hidden={collapsed || undefined}
|
||||
{...(collapsed ? { inert: "" } : {})}
|
||||
className={cn(
|
||||
"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden transition-opacity duration-200",
|
||||
collapsed && "pointer-events-none opacity-0",
|
||||
"flex min-h-0 flex-1 flex-col overflow-hidden",
|
||||
desktopDock ? "sidebar-dock-history" : "min-w-0",
|
||||
)}
|
||||
>
|
||||
{!collapsed && (
|
||||
{(desktopDock || !collapsed) && (
|
||||
<ChatList
|
||||
sessions={props.sessions}
|
||||
temporarySessions={props.temporarySessions}
|
||||
activeKey={props.activeKey}
|
||||
loading={props.loading}
|
||||
initialLoading={props.initialLoading}
|
||||
emptyLabel={t("chat.noSessions")}
|
||||
onSelect={props.onSelect}
|
||||
onCloseTemporaryChat={props.onCloseTemporaryChat}
|
||||
onRequestDelete={props.onRequestDelete}
|
||||
@@ -334,24 +305,56 @@ export function Sidebar(props: SidebarProps) {
|
||||
onRequestUpdate={props.availableUpdate.onRequestUpdate} installationMethod={props.availableUpdate.installationMethod} />
|
||||
)}
|
||||
<div
|
||||
data-testid="sidebar-footer"
|
||||
data-theme-surface
|
||||
className={cn(
|
||||
"flex items-center justify-between gap-1 px-2.5 py-3 text-xs",
|
||||
props.hostChromeInset && "bg-sidebar/55",
|
||||
collapsed && "w-14 flex-col px-0",
|
||||
"flex shrink-0 flex-col gap-0.5 px-2 py-3 text-xs",
|
||||
desktopDock && "px-3",
|
||||
props.hostChromeInset && !desktopDock && !collapsed && "bg-sidebar/55",
|
||||
collapsed && !desktopDock && "w-14 px-0",
|
||||
)}
|
||||
>
|
||||
<SidebarActionButton
|
||||
collapsed={collapsed}
|
||||
label={t("sidebar.settings")}
|
||||
iconOnly
|
||||
shortcut={sidebarShortcutLabel("settings", apple)}
|
||||
ariaKeyShortcuts={sidebarShortcutAria("settings")}
|
||||
onClick={props.onOpenSettings}
|
||||
onIntent={props.onSettingsIntent}
|
||||
icon={<SettingsIcon className="h-4 w-4" />}
|
||||
/>
|
||||
<HostSwitcher collapsed={collapsed} portalContainer={props.containActionMenus ? menuPortalContainer : undefined} />
|
||||
<SidebarSelectionHighlight
|
||||
targetSelector=':scope > button[aria-current="page"]'
|
||||
activeId={activeUtilityId}
|
||||
scope="actions"
|
||||
className={cn("relative flex flex-col gap-0.5", collapsed && !desktopDock && "items-center")}
|
||||
>
|
||||
<SidebarActionButton
|
||||
{...footerActionProps}
|
||||
label={t("sidebar.apps")}
|
||||
shortcut={sidebarShortcutLabel("apps", apple)}
|
||||
ariaKeyShortcuts={sidebarShortcutAria("apps")}
|
||||
onClick={props.onOpenApps}
|
||||
active={props.activeUtility === "apps"}
|
||||
icon={<AppsIcon className="h-4 w-4" />}
|
||||
/>
|
||||
<SidebarActionButton
|
||||
{...footerActionProps}
|
||||
label={t("sidebar.automations", { defaultValue: "Automations" })}
|
||||
shortcut={sidebarShortcutLabel("automations", apple)}
|
||||
ariaKeyShortcuts={sidebarShortcutAria("automations")}
|
||||
onClick={props.onOpenAutomations}
|
||||
active={props.activeUtility === "automations"}
|
||||
icon={<AutomationsIcon className="h-4 w-4" />}
|
||||
/>
|
||||
</SidebarSelectionHighlight>
|
||||
<div className={cn("flex min-w-0 items-center gap-1", desktopDock ? "sidebar-dock-footer-row" : collapsed && "flex-col")}>
|
||||
<SidebarActionButton
|
||||
{...footerActionProps}
|
||||
className={desktopDock ? "sidebar-dock-settings" : collapsed ? undefined : "w-auto max-w-[60%] shrink-0"}
|
||||
label={t("sidebar.settings")}
|
||||
shortcut={sidebarShortcutLabel("settings", apple)}
|
||||
ariaKeyShortcuts={sidebarShortcutAria("settings")}
|
||||
onClick={props.onOpenSettings}
|
||||
icon={<SettingsIcon className="h-4 w-4" />}
|
||||
/>
|
||||
{desktopDock ? (
|
||||
<div className="sidebar-dock-host flex min-w-0 items-center">
|
||||
<HostSwitcher />
|
||||
</div>
|
||||
) : <HostSwitcher collapsed={collapsed} portalContainer={props.containActionMenus ? menuPortalContainer : undefined} />}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
@@ -360,6 +363,7 @@ export function Sidebar(props: SidebarProps) {
|
||||
function SidebarActionButton({
|
||||
collapsed,
|
||||
iconOnly = false,
|
||||
dockLabel = false,
|
||||
label,
|
||||
icon,
|
||||
onClick,
|
||||
@@ -368,10 +372,11 @@ function SidebarActionButton({
|
||||
shortcut,
|
||||
ariaKeyShortcuts,
|
||||
onIntent,
|
||||
selectionRef,
|
||||
tooltipSide,
|
||||
}: {
|
||||
collapsed: boolean;
|
||||
iconOnly?: boolean;
|
||||
dockLabel?: boolean;
|
||||
label: string;
|
||||
icon: ReactNode;
|
||||
onClick: () => void;
|
||||
@@ -380,13 +385,12 @@ function SidebarActionButton({
|
||||
shortcut?: string;
|
||||
ariaKeyShortcuts?: string;
|
||||
onIntent?: () => void;
|
||||
selectionRef?: RefObject<HTMLButtonElement>;
|
||||
tooltipSide?: "top" | "bottom";
|
||||
}) {
|
||||
const compact = collapsed || iconOnly;
|
||||
|
||||
const button = (
|
||||
<Button
|
||||
ref={active ? selectionRef : undefined}
|
||||
type="button"
|
||||
variant={compact ? "icon" : null}
|
||||
aria-label={label}
|
||||
@@ -398,10 +402,9 @@ function SidebarActionButton({
|
||||
className={cn(
|
||||
"touch-target group h-8 min-w-0 gap-2 overflow-hidden rounded-control font-normal",
|
||||
SIDEBAR_SELECTION_ACTION_ITEM_CLASS,
|
||||
collapsed
|
||||
? "w-8 justify-center gap-0 px-0"
|
||||
: iconOnly ? "w-8 shrink-0 justify-center gap-0 rounded-control px-0"
|
||||
: "w-full justify-start gap-2 px-2 text-[13px] leading-5 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:stroke-[1.75]",
|
||||
dockLabel || !compact
|
||||
? "w-full justify-start gap-2 px-2 text-[13px] leading-5 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:stroke-[1.75]"
|
||||
: "w-8 shrink-0 justify-center gap-0 rounded-control px-0",
|
||||
active
|
||||
? "text-sidebar-accent-foreground"
|
||||
: compact
|
||||
@@ -413,13 +416,15 @@ function SidebarActionButton({
|
||||
<span className="flex shrink-0 items-center justify-center" aria-hidden>
|
||||
{icon}
|
||||
</span>
|
||||
{!compact && <span className="min-w-0 max-w-[12rem] truncate whitespace-nowrap">
|
||||
{label}
|
||||
</span>}
|
||||
{(dockLabel || !compact) && (
|
||||
<span aria-hidden={dockLabel || undefined} className={cn("min-w-0 max-w-48 truncate", dockLabel && "sidebar-dock-label")}>
|
||||
{label}
|
||||
</span>
|
||||
)}
|
||||
</Button>
|
||||
);
|
||||
return compact || shortcut ? (
|
||||
<HoverHint side={collapsed ? "right" : "bottom"} contentClassName="flex items-center gap-4" content={<>
|
||||
<HoverHint side={collapsed ? "right" : tooltipSide ?? "bottom"} contentClassName="flex items-center gap-4" content={<>
|
||||
<span>{label}</span>
|
||||
{shortcut ? <kbd className="whitespace-nowrap font-sans text-muted-foreground">{shortcut}</kbd> : null}
|
||||
</>}>
|
||||
|
||||
@@ -37,7 +37,7 @@ export function SidebarResizeHandle({ width, open, onResize, onDraggingChange }:
|
||||
aria-valuemin={56}
|
||||
aria-valuemax={SIDEBAR_MAX_WIDTH}
|
||||
aria-valuenow={open ? width : 56}
|
||||
className="host-no-drag absolute inset-y-0 right-0 z-30 w-3 cursor-grab active:cursor-grabbing touch-none select-none outline-none after:absolute after:top-1/2 after:right-1 after:h-12 after:w-1 after:-translate-y-1/2 after:rounded-full after:bg-transparent hover:after:bg-orange-500/70 active:after:bg-orange-500 focus-visible:after:bg-orange-500"
|
||||
className="host-no-drag absolute inset-y-0 right-0 z-30 w-3 cursor-col-resize touch-none select-none outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-muted-foreground/60"
|
||||
onPointerDown={(event) => {
|
||||
if (event.button !== 0) return;
|
||||
event.preventDefault();
|
||||
|
||||
@@ -21,7 +21,8 @@ export function readStartupLayout() {
|
||||
}
|
||||
const [path, query = ""] = hash.split("?", 2);
|
||||
const section = new URLSearchParams(query).get("section") || "overview";
|
||||
const page = path === "/settings" ? section : path.slice(1);
|
||||
const page = path === "/settings" || (path === "/apps" && (section === "skills" || section === "channels"))
|
||||
? section : path.slice(1);
|
||||
let surface: StartupSurface = "chat";
|
||||
if (page === "skills" || page === "apps" || page === "channels" || page === "automations" || page === "remote") surface = page;
|
||||
else if (path === "/settings") surface = "settings";
|
||||
@@ -90,10 +91,14 @@ export function StartupSkeleton({
|
||||
<div className="startup-scroll">
|
||||
<div className="startup-page">
|
||||
<div className="startup-page-header"><div className="startup-back"><Block /></div><div className="startup-title"><Block /></div></div>
|
||||
<div className="startup-tabs"><Block /></div>
|
||||
<div className="startup-panel">
|
||||
<div className="startup-toolbar"><Block className="startup-search" /><Block className="startup-filters" /></div>
|
||||
<div className="startup-catalog-frame">
|
||||
<div className="startup-panel apps-catalog-layout">
|
||||
<div className="catalog-tabs startup-tabs"><Block /><Block /><Block /></div>
|
||||
<div className="catalog-controls startup-controls">
|
||||
<div className="catalog-choices startup-primary-choices"><Block /><Block /><Block /><Block /></div>
|
||||
<div className="catalog-choices startup-secondary-choices"><Block /><Block /><Block /></div>
|
||||
</div>
|
||||
<Block className="catalog-search startup-search" />
|
||||
<div className="catalog-body startup-catalog-frame">
|
||||
<div className="startup-catalog-heading"><Block /></div>
|
||||
<div className="startup-catalog">
|
||||
<div className="startup-catalog-group"><Block /></div>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
:root {
|
||||
--content-column-width: 49.5rem;
|
||||
}
|
||||
@@ -22,7 +22,6 @@ export const SearchIcon = productIcon("search", <><circle cx="10.5" cy="10.5" r=
|
||||
export const AppsIcon = productIcon("apps", <><rect x="3.5" y="3.5" width="6.5" height="6.5" rx="1.75" /><rect x="14" y="3.5" width="6.5" height="6.5" rx="1.75" /><rect x="3.5" y="14" width="6.5" height="6.5" rx="1.75" /><rect x="14" y="14" width="6.5" height="6.5" rx="1.75" /></>);
|
||||
export const SkillsIcon = productIcon("skills", <path d="M8 6.5H5.5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V16h1a2.5 2.5 0 0 0 0-5h-1V8.5a2 2 0 0 0-2-2H13v-1a2.5 2.5 0 0 0-5 0Z" />);
|
||||
export const AutomationsIcon = productIcon("automations", <><rect x="3.5" y="3.5" width="17" height="17" rx="3" /><path d="M12 7.5V12l3 2" /></>);
|
||||
export const ChannelsIcon = productIcon("channels", <path d="M6.5 3.5h11a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3H9l-4 2v-2.4a3 3 0 0 1-1.5-2.6v-9a3 3 0 0 1 3-3Z" />);
|
||||
export const ArchiveIcon = productIcon("archive", <><rect x="3" y="3.5" width="18" height="4.5" rx="1.5" /><path d="M4.5 8v11a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V8M9 12h6" /></>);
|
||||
export const SettingsIcon = productIcon("settings", <><path d="M10 3h4l.6 2.4 2.1 1.2 2.4-.7 2 3.5-1.8 1.7v1.8l1.8 1.7-2 3.5-2.4-.7-2.1 1.2L14 21h-4l-.6-2.4-2.1-1.2-2.4.7-2-3.5 1.8-1.7v-1.8L2.9 9.4l2-3.5 2.4.7 2.1-1.2L10 3Z" /><circle cx="12" cy="12" r="3" /></>);
|
||||
export const OverviewIcon = productIcon("overview", <><rect x="3" y="3" width="18" height="18" rx="3" /><path d="M3 9h18M9 9v12m4-4v-3m4 3v-5" /><path d="M6 6h.01" /></>);
|
||||
|
||||
@@ -6,7 +6,6 @@ import { channelUiPresentation } from "@/channel-plugins/registry";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { floatingSurfaceElevationClassName } from "@/components/ui/floating-surface";
|
||||
import { useLogoFallback } from "@/hooks/useLogoFallback";
|
||||
import { logoFallbackUrls } from "@/lib/provider-brand";
|
||||
import type { PairingRequestInfo } from "@/lib/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
@@ -190,11 +189,8 @@ function PairingChannelBadge({ channel }: { channel: string }) {
|
||||
const presentation = pairingChannelPresentation(channel);
|
||||
const initials = presentation.initials;
|
||||
const color = presentation.color;
|
||||
const logoUrls = useMemo(
|
||||
() => logoFallbackUrls(presentation?.logoUrl),
|
||||
[presentation?.logoUrl],
|
||||
);
|
||||
const { logoUrl, onLogoError, onLogoLoad } = useLogoFallback(logoUrls);
|
||||
const brandLogoUrl = presentation.logoUrl;
|
||||
const { logoUrl, onLogoError, onLogoLoad } = useLogoFallback(brandLogoUrl ? [brandLogoUrl] : undefined);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -138,7 +138,7 @@ export function HostSwitcherView({ picker, status, collapsed = false, portalCont
|
||||
: remote ? <Server className="h-4 w-4" /> : <Laptop className="h-4 w-4" />}
|
||||
{!waiting && !failed && <span aria-hidden className={cn("absolute -bottom-0.5 -right-0.5 h-1.5 w-1.5 rounded-full ring-2 ring-sidebar", currentStatus === "open" ? "bg-emerald-500" : "bg-muted-foreground")} />}
|
||||
</span>
|
||||
{!collapsed && <><span className="truncate">{label}</span><ChevronUp className="ml-auto h-3 w-3 shrink-0 opacity-60" /></>}
|
||||
{!collapsed && <><span className="truncate" data-sidebar-host-label>{label}</span><ChevronUp className="ml-auto h-3 w-3 shrink-0 opacity-60" data-sidebar-host-label /></>}
|
||||
<span className="sr-only" role="status">{detail}</span>
|
||||
</Button>;
|
||||
const trigger = <TooltipTrigger asChild>{button}</TooltipTrigger>;
|
||||
|
||||
@@ -3,13 +3,15 @@ import { useCallback, useEffect, useRef, useState, type ReactNode } from "react"
|
||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogLayoutContext, DialogTitle } from "@/components/ui/dialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import type { SettingsExitGuard, SettingsFocusTarget } from "@/components/settings/contracts";
|
||||
import { isCapabilitySection, type SettingsSectionKey } from "@/components/settings/contracts";
|
||||
import { isAppsSection, isCapabilitySection, type AppsSectionKey, type SettingsSectionKey } from "@/components/settings/contracts";
|
||||
import { SegmentedControl } from "@/components/ui/segmented-control";
|
||||
import { SettingsFeature } from "@/components/settings/shared/SettingsFeature";
|
||||
import type { EditCompletion } from "@/components/settings/shared/useEditCompletion";
|
||||
import { SharedProxySetupDialog } from "@/components/settings/shared/SharedProxySetupDialog";
|
||||
import { SettingsSectionSkeleton } from "@/components/settings/shared/SettingsSectionSkeleton";
|
||||
|
||||
import { SkillsCatalogSettings } from "@/components/settings/SkillsCatalogSettings";
|
||||
import { SkillsCatalogPage, useSkillsCatalogSearch } from "@/components/settings/SkillsCatalogSettings";
|
||||
import { CatalogSearch } from "@/components/settings/shared/CatalogToolbar";
|
||||
import { ImageGenerationSettings } from "@/components/settings/capabilities/ImageGenerationSettings";
|
||||
import { AdvancedSettings } from "@/components/settings/capabilities/SecuritySettings";
|
||||
import { TranscriptionSettings } from "@/components/settings/capabilities/TranscriptionSettings";
|
||||
@@ -99,6 +101,8 @@ export function SettingsPage({
|
||||
const { client, webuiCapabilities } = useClient();
|
||||
const [dialogLayoutAnchor, setDialogLayoutAnchor] = useState<HTMLDivElement | null>(null);
|
||||
const [mcpSetupName, setMcpSetupName] = useState<string | null>(null);
|
||||
const [channelsQuery, setChannelsQuery] = useState("");
|
||||
const skillsSearch = useSkillsCatalogSearch();
|
||||
const presetDeletedCallback = useRef<(() => void) | null>(null);
|
||||
const [providerPanel, setProviderPanel] = useState<ProviderSettingsEntry | null>(null);
|
||||
const [proxySetupOpen, setProxySetupOpen] = useState(false);
|
||||
@@ -494,6 +498,7 @@ export function SettingsPage({
|
||||
case "channels":
|
||||
return (
|
||||
<ChannelsSettings
|
||||
query={channelsQuery}
|
||||
onBeforeCloseChange={registerChannelCompletion}
|
||||
onConfigureMcp={(name) => {
|
||||
setMcpSetupName(name);
|
||||
@@ -519,7 +524,6 @@ export function SettingsPage({
|
||||
);
|
||||
case "apps":
|
||||
return (
|
||||
<div className="settings-stack">
|
||||
<AppsCatalogPage
|
||||
onConfigureProxy={configureProxy}
|
||||
setupName={mcpSetupName}
|
||||
@@ -581,7 +585,6 @@ export function SettingsPage({
|
||||
onRestart={restartViaSettingsSurface}
|
||||
isRestarting={restartInProgress}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
case "automations":
|
||||
return (
|
||||
@@ -612,12 +615,24 @@ export function SettingsPage({
|
||||
</div>
|
||||
);
|
||||
case "skills":
|
||||
return <SkillsCatalogSettings skills={skills} loading={skillsLoading} error={skillsError} />;
|
||||
return <SkillsCatalogPage skills={skills} loading={skillsLoading} error={skillsError} searchState={skillsSearch} />;
|
||||
default:
|
||||
return renderSettingsSection(section, embedded);
|
||||
}
|
||||
};
|
||||
// Appearance reads only browser-local preferences, not the gateway settings snapshot.
|
||||
const appsSection = isAppsSection(activeSection);
|
||||
const catalogSearch = activeSection === "skills" ? skillsSearch.search
|
||||
: activeSection === "channels" ? {
|
||||
type: "search",
|
||||
value: channelsQuery,
|
||||
onChange: (event: React.ChangeEvent<HTMLInputElement>) => setChannelsQuery(event.target.value),
|
||||
placeholder: t("settings.channels.search"),
|
||||
} : activeSection === "apps" ? {
|
||||
value: systemState.appsQuery,
|
||||
onChange: (event: React.ChangeEvent<HTMLInputElement>) => systemState.setAppsQuery(event.target.value),
|
||||
placeholder: t("settings.apps.searchPlaceholder"),
|
||||
} : null;
|
||||
const localSection = activeSection === "appearance";
|
||||
const sectionReady = localSection || settings !== null || activeSection === "skills" || activeSection === "apps"
|
||||
|| activeSection === "channels" || activeSection === "automations";
|
||||
@@ -731,12 +746,12 @@ export function SettingsPage({
|
||||
|
||||
<div
|
||||
className={cn(
|
||||
"min-w-0 flex-1 bg-settings-canvas [scrollbar-gutter:stable]",
|
||||
"overflow-y-auto",
|
||||
"min-w-0 flex-1 overflow-y-auto bg-settings-canvas [scrollbar-gutter:stable]",
|
||||
!showSidebar && (appsSection || activeSection === "automations") && "sm:[scrollbar-gutter:stable_both-edges]",
|
||||
)}
|
||||
>
|
||||
<div
|
||||
key={activeSection}
|
||||
key={appsSection ? "apps" : activeSection}
|
||||
data-testid="settings-section-transition"
|
||||
ref={setDialogLayoutAnchor}
|
||||
data-settings-section={activeSection}
|
||||
@@ -747,7 +762,6 @@ export function SettingsPage({
|
||||
"settings-grid",
|
||||
activeSection === "about" && "flex min-h-full flex-col",
|
||||
!showSidebar && "settings-feature-page",
|
||||
!showSidebar && activeSection === "automations" && "settings-automations-grid",
|
||||
hostChromeInset && "pt-[4.25rem] sm:pt-[4.25rem] lg:pt-[4.75rem]",
|
||||
)}
|
||||
>
|
||||
@@ -762,7 +776,7 @@ export function SettingsPage({
|
||||
{t("settings.backToChat")}
|
||||
</button>
|
||||
{activeSection !== "automations" ? <h1 className="text-[24px] font-normal leading-tight tracking-normal text-foreground sm:text-[28px]">
|
||||
{t(`settings.nav.${activeSection}`, {
|
||||
{t(`settings.nav.${appsSection ? "apps" : activeSection}`, {
|
||||
defaultValue: standaloneSectionTitle(activeSection),
|
||||
})}
|
||||
</h1> : null}
|
||||
@@ -781,17 +795,31 @@ export function SettingsPage({
|
||||
) : sectionReady ? (
|
||||
<div
|
||||
className={cn(
|
||||
"settings-stack",
|
||||
appsSection ? "apps-catalog-layout" : "settings-stack",
|
||||
activeSection === "about" && "flex flex-1 flex-col",
|
||||
activeSection === "channels" &&
|
||||
"flex min-h-0 flex-1 flex-col xl:overflow-hidden",
|
||||
)}
|
||||
>
|
||||
{error && (!localSection || settings !== null) ? (
|
||||
<div className="rounded-floating border border-destructive/20 bg-destructive/5 px-4 py-3 text-[13px] text-destructive">
|
||||
<div className="col-span-full rounded-floating border border-destructive/20 bg-destructive/5 px-4 py-3 text-[13px] text-destructive">
|
||||
{error}
|
||||
</div>
|
||||
) : null}
|
||||
{appsSection && !showSidebar ? (
|
||||
<SegmentedControl<AppsSectionKey>
|
||||
value={activeSection}
|
||||
onChange={selectSection}
|
||||
ariaLabel={t("settings.nav.apps")}
|
||||
className="catalog-tabs min-h-9 shrink-0 rounded-control"
|
||||
itemClassName="min-h-7 rounded-compact px-3 py-0"
|
||||
indicatorClassName="rounded-compact"
|
||||
options={[
|
||||
{ value: "apps", label: t("settings.apps.featured") },
|
||||
{ value: "skills", label: t("settings.nav.skills") },
|
||||
{ value: "channels", label: t("settings.nav.channels") },
|
||||
]}
|
||||
/>
|
||||
) : null}
|
||||
{catalogSearch && <CatalogSearch {...catalogSearch} />}
|
||||
{renderSection(isCapabilitySection(activeSection) ? "capabilities" : activeSection)}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
KeyRound,
|
||||
PowerOff,
|
||||
RefreshCw,
|
||||
Search,
|
||||
Terminal,
|
||||
Trash2,
|
||||
} from "lucide-react";
|
||||
@@ -26,33 +25,55 @@ import {
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Disclosure } from "@/components/ui/disclosure";
|
||||
import { ExpandableText } from "@/components/ui/expandable-text";
|
||||
import { SearchInput } from "@/components/ui/input";
|
||||
import { SegmentedControl } from "@/components/ui/segmented-control";
|
||||
import { CatalogControls, CatalogFilter, CatalogToolbar } from "@/components/settings/shared/CatalogToolbar";
|
||||
import { Sheet, SheetContent, SheetDescription, SheetTitle } from "@/components/ui/sheet";
|
||||
import { SkillsMarketplace } from "@/components/settings/SkillsMarketplace";
|
||||
import { MarketplaceProviderFilter, SkillsMarketplace } from "@/components/settings/SkillsMarketplace";
|
||||
import { CatalogSkeleton } from "@/components/settings/shared/CatalogSkeleton";
|
||||
import { SkeletonStatus } from "@/components/settings/shared/SkeletonStatus";
|
||||
import { ToggleButton } from "@/components/ui/toggle-button";
|
||||
import { deleteSkill, fetchSkillDetail, updateSkillEnabled } from "@/lib/api";
|
||||
import { notifySkillsChanged, requestSkillsRefresh } from "@/lib/skill-events";
|
||||
import type { SkillDetail, SkillSummary } from "@/lib/types";
|
||||
import type { MarketplaceProvider, SkillDetail, SkillSummary } from "@/lib/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useClient } from "@/providers/ClientProvider";
|
||||
|
||||
export function SkillsCatalogSettings({ skills, loading = false, error = false }: {
|
||||
export function useSkillsCatalogSearch() {
|
||||
const { t } = useTranslation();
|
||||
const [view, setView] = useState<"installed" | "discover">("installed");
|
||||
const [installedQuery, setInstalledQuery] = useState("");
|
||||
const [marketplaceQuery, setMarketplaceQuery] = useState("");
|
||||
return { view, setView, search: {
|
||||
value: view === "installed" ? installedQuery : marketplaceQuery,
|
||||
onChange: (event: React.ChangeEvent<HTMLInputElement>) =>
|
||||
(view === "installed" ? setInstalledQuery : setMarketplaceQuery)(event.target.value),
|
||||
placeholder: t(view === "installed" ? "settings.skills.searchInstalled" : "settings.skills.marketplaceSearchPlaceholder"),
|
||||
} };
|
||||
}
|
||||
|
||||
type SkillsCatalogProps = {
|
||||
skills: SkillSummary[];
|
||||
loading?: boolean;
|
||||
error?: boolean;
|
||||
};
|
||||
|
||||
export function SkillsCatalogSettings(props: SkillsCatalogProps) {
|
||||
const searchState = useSkillsCatalogSearch();
|
||||
return <SkillsCatalogPage {...props} searchState={searchState} showSearch />;
|
||||
}
|
||||
|
||||
export function SkillsCatalogPage({ skills, loading = false, error = false, searchState, showSearch }: SkillsCatalogProps & {
|
||||
searchState: ReturnType<typeof useSkillsCatalogSearch>;
|
||||
showSearch?: boolean;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { view, setView, search } = searchState;
|
||||
const [selectedSkill, setSelectedSkill] = useState<SkillSummary | null>(null);
|
||||
const [view, setView] = useState<"installed" | "discover">("installed");
|
||||
const [installingSkill, setInstallingSkill] = useState("");
|
||||
const [installedQuery, setInstalledQuery] = useState("");
|
||||
const [marketplaceProvider, setMarketplaceProvider] = useState<MarketplaceProvider>("all");
|
||||
const [installedFilter, setInstalledFilter] = useState<"all" | "enabled" | "disabled">(
|
||||
"all",
|
||||
);
|
||||
const normalizedQuery = installedQuery.trim().toLowerCase();
|
||||
const normalizedQuery = view === "installed" ? search.value.trim().toLowerCase() : "";
|
||||
const filteredSkills = skills.filter((skill) => {
|
||||
const enabled = skill.enabled !== false;
|
||||
if (installedFilter === "enabled" && !enabled) return false;
|
||||
@@ -85,73 +106,29 @@ export function SkillsCatalogSettings({ skills, loading = false, error = false }
|
||||
const disabledCount = skills.filter((skill) => skill.enabled === false).length;
|
||||
|
||||
return (
|
||||
<div className="settings-stack">
|
||||
<SegmentedControl
|
||||
value={view}
|
||||
mode="tabs"
|
||||
ariaLabel={t("settings.skills.views", { defaultValue: "Skills views" })}
|
||||
className="w-fit text-[13px]"
|
||||
itemClassName="px-3.5"
|
||||
options={[
|
||||
{
|
||||
value: "installed",
|
||||
label: t("settings.skills.installedTab", { defaultValue: "Installed" }),
|
||||
},
|
||||
{
|
||||
value: "discover",
|
||||
label: t("settings.skills.discoverTab", { defaultValue: "Discover" }),
|
||||
},
|
||||
]}
|
||||
onChange={setView}
|
||||
/>
|
||||
|
||||
{view === "installed" ? (
|
||||
<section className="overflow-hidden rounded-panel bg-settings-surface">
|
||||
<div className="flex flex-col gap-3 px-4 pb-2 pt-4 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="relative w-full sm:max-w-[320px]">
|
||||
<Search
|
||||
className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"
|
||||
aria-hidden
|
||||
/>
|
||||
<SearchInput
|
||||
value={installedQuery}
|
||||
onChange={(event) => setInstalledQuery(event.target.value)}
|
||||
placeholder={t("settings.skills.searchInstalled", {
|
||||
defaultValue: "Search installed skills",
|
||||
})}
|
||||
aria-label={t("settings.skills.searchInstalled", {
|
||||
defaultValue: "Search installed skills",
|
||||
})}
|
||||
className="h-9 bg-background pl-9 text-[13px]"
|
||||
/>
|
||||
</div>
|
||||
<SegmentedControl
|
||||
value={installedFilter}
|
||||
className="sm:w-auto"
|
||||
itemClassName="px-2.5 text-[11px]"
|
||||
<div className="catalog-section">
|
||||
<CatalogToolbar search={showSearch ? search : undefined}>
|
||||
<CatalogControls>
|
||||
<CatalogFilter label={t("settings.skills.views")} value={view} onChange={setView}
|
||||
options={[
|
||||
{ value: "installed", label: t("settings.skills.installedTab") },
|
||||
{ value: "discover", label: t("settings.skills.discoverTab") },
|
||||
]} />
|
||||
{view === "installed" ? (
|
||||
<CatalogFilter label={t("settings.apps.statusFilter")} value={installedFilter} onChange={setInstalledFilter}
|
||||
options={([
|
||||
["all", t("settings.skills.filterAll", { defaultValue: "All" }), skills.length],
|
||||
[
|
||||
"enabled",
|
||||
t("settings.skills.filterEnabled", { defaultValue: "Enabled" }),
|
||||
skills.length - disabledCount,
|
||||
],
|
||||
[
|
||||
"disabled",
|
||||
t("settings.skills.filterDisabled", { defaultValue: "Disabled" }),
|
||||
disabledCount,
|
||||
],
|
||||
["all", t("settings.skills.filterAll"), skills.length],
|
||||
["enabled", t("settings.skills.filterEnabled"), skills.length - disabledCount],
|
||||
["disabled", t("settings.skills.filterDisabled"), disabledCount],
|
||||
] as const).map(([value, label, count]) => ({
|
||||
value,
|
||||
label: (
|
||||
<>
|
||||
{label} <span className="ml-0.5 tabular-nums opacity-65">{loading || error ? "—" : count}</span>
|
||||
</>
|
||||
),
|
||||
}))}
|
||||
onChange={setInstalledFilter}
|
||||
/>
|
||||
</div>
|
||||
label: <><span>{label}</span><span className="tabular-nums opacity-65">{loading || error ? "—" : count}</span></>,
|
||||
}))} />
|
||||
) : <MarketplaceProviderFilter value={marketplaceProvider} onChange={setMarketplaceProvider} />}
|
||||
</CatalogControls>
|
||||
</CatalogToolbar>
|
||||
{view === "installed" ? (
|
||||
<section className="overflow-hidden rounded-panel bg-settings-surface pt-3">
|
||||
{loading ? (
|
||||
<CatalogSkeleton label={t("settings.skills.loading")} layout="skills" />
|
||||
) : error ? (
|
||||
@@ -193,6 +170,8 @@ export function SkillsCatalogSettings({ skills, loading = false, error = false }
|
||||
</section>
|
||||
) : (
|
||||
<SkillsMarketplace
|
||||
query={search.value}
|
||||
provider={marketplaceProvider}
|
||||
installedSkills={skills}
|
||||
installing={installingSkill}
|
||||
onInstallingChange={setInstallingSkill}
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
ExternalLink,
|
||||
Loader2,
|
||||
PackagePlus,
|
||||
Search,
|
||||
ShieldAlert,
|
||||
} from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -22,8 +21,7 @@ import {
|
||||
AlertDialogTitle,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { SearchInput } from "@/components/ui/input";
|
||||
import { SegmentedControl } from "@/components/ui/segmented-control";
|
||||
import { CatalogFilter } from "@/components/settings/shared/CatalogToolbar";
|
||||
import {
|
||||
ApiError,
|
||||
fetchMarketplaceSkillTrends,
|
||||
@@ -41,17 +39,20 @@ import { cn } from "@/lib/utils";
|
||||
import { useClient } from "@/providers/ClientProvider";
|
||||
|
||||
export function SkillsMarketplace({
|
||||
query,
|
||||
provider,
|
||||
installedSkills,
|
||||
installing,
|
||||
onInstallingChange,
|
||||
}: {
|
||||
query: string;
|
||||
provider: MarketplaceProvider;
|
||||
installedSkills: SkillSummary[];
|
||||
installing: string;
|
||||
onInstallingChange: (skillId: string) => void;
|
||||
}) {
|
||||
const { client, getToken } = useClient();
|
||||
const { t } = useTranslation();
|
||||
const [query, setQuery] = useState("");
|
||||
const [results, setResults] = useState<MarketplaceSkillSummary[]>([]);
|
||||
const [trending, setTrending] = useState<MarketplaceSkillSummary[]>([]);
|
||||
const [trends, setTrends] = useState<Record<string, number[]>>({});
|
||||
@@ -59,7 +60,6 @@ export function SkillsMarketplace({
|
||||
const [trendingLoading, setTrendingLoading] = useState(true);
|
||||
const [error, setError] = useState("");
|
||||
const [installError, setInstallError] = useState("");
|
||||
const [provider, setProvider] = useState<MarketplaceProvider>("all");
|
||||
const [selected, setSelected] = useState<MarketplaceSkillSummary | null>(null);
|
||||
const installTrigger = useRef<HTMLElement | null>(null);
|
||||
const selectSkill = (skill: MarketplaceSkillSummary) => {
|
||||
@@ -196,38 +196,8 @@ export function SkillsMarketplace({
|
||||
};
|
||||
|
||||
return (
|
||||
<section className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<div className="relative">
|
||||
<Search
|
||||
className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"
|
||||
aria-hidden
|
||||
/>
|
||||
<SearchInput
|
||||
value={query}
|
||||
onChange={(event) => setQuery(event.target.value)}
|
||||
placeholder={t("settings.skills.marketplaceSearchPlaceholder", {
|
||||
defaultValue: "Search skills",
|
||||
})}
|
||||
aria-label={t("settings.skills.marketplaceSearchLabel", {
|
||||
defaultValue: "Search skills",
|
||||
})}
|
||||
className="h-11 rounded-full bg-settings-surface pl-9"
|
||||
/>
|
||||
{loading ? (
|
||||
<span
|
||||
className="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground"
|
||||
role="status"
|
||||
aria-label={t("settings.skills.marketplaceSearching", {
|
||||
defaultValue: "Searching",
|
||||
})}
|
||||
>
|
||||
<Loader2 className="h-4 w-4 animate-spin motion-reduce:animate-none" aria-hidden />
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
<ProviderFilter value={provider} onChange={setProvider} />
|
||||
</div>
|
||||
<section className="grid gap-4">
|
||||
{loading ? <span className="sr-only" role="status">{t("settings.skills.marketplaceSearching")}</span> : null}
|
||||
|
||||
{error || installError ? (
|
||||
<div role="alert" className="rounded-control bg-destructive/10 px-3 py-2.5 text-[13px] text-destructive">
|
||||
@@ -361,7 +331,7 @@ export function SkillsMarketplace({
|
||||
);
|
||||
}
|
||||
|
||||
function ProviderFilter({
|
||||
export function MarketplaceProviderFilter({
|
||||
value,
|
||||
onChange,
|
||||
}: {
|
||||
@@ -371,24 +341,12 @@ function ProviderFilter({
|
||||
const { t } = useTranslation();
|
||||
const providers: MarketplaceProvider[] = ["all", "skills_sh", "skillhub"];
|
||||
return (
|
||||
<SegmentedControl
|
||||
<CatalogFilter
|
||||
value={value}
|
||||
mode="tabs"
|
||||
ariaLabel={t("settings.skills.marketplaceProviderFilter", {
|
||||
defaultValue: "Skill source",
|
||||
})}
|
||||
className="w-fit bg-settings-surface"
|
||||
itemClassName="inline-flex h-7 items-center gap-1.5"
|
||||
label={t("settings.skills.marketplaceProviderFilter")}
|
||||
options={providers.map((provider) => ({
|
||||
value: provider,
|
||||
label: (
|
||||
<>
|
||||
{provider !== "all" ? <ProviderDot provider={provider} /> : null}
|
||||
{provider === "all"
|
||||
? t("settings.skills.marketplaceProviderAll", { defaultValue: "All" })
|
||||
: providerLabel(provider)}
|
||||
</>
|
||||
),
|
||||
label: provider === "all" ? t("settings.skills.marketplaceProviderAll") : providerLabel(provider),
|
||||
}))}
|
||||
onChange={onChange}
|
||||
/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useEffect, useId, useRef, useState } from "react";
|
||||
import { Download, Loader2, RotateCcw } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
@@ -16,6 +16,8 @@ import { Button } from "@/components/ui/button";
|
||||
import type { NanobotFeatureInfo } from "@/lib/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const CHANNEL_ACTION_CLASS = "relative h-7 w-[38px] min-w-0 shrink-0 rounded-full border-border/70 bg-background p-0 after:absolute after:left-1/2 after:top-1/2 after:h-11 after:w-11 after:-translate-x-1/2 after:-translate-y-1/2 after:content-['']";
|
||||
|
||||
export function ChannelCatalogRow({
|
||||
feature,
|
||||
showBrandLogos,
|
||||
@@ -28,7 +30,7 @@ export function ChannelCatalogRow({
|
||||
}: {
|
||||
feature: NanobotFeatureInfo;
|
||||
showBrandLogos: boolean;
|
||||
onSelect: (connect?: boolean) => void;
|
||||
onSelect: (trigger: HTMLButtonElement | null, connect?: boolean) => void;
|
||||
actionKey: string | null;
|
||||
restartRequired?: boolean;
|
||||
onAction: ChannelFeatureAction;
|
||||
@@ -47,6 +49,9 @@ export function ChannelCatalogRow({
|
||||
const actionsDisabled = restartRequired || isRestarting;
|
||||
const showInstallRestartHint = feature.install_supported && actionsDisabled;
|
||||
const installButtonRef = useRef<HTMLButtonElement | null>(null);
|
||||
const toggleRef = useRef<HTMLButtonElement | null>(null);
|
||||
const statusId = useId();
|
||||
const failed = feature.runtime_status === "failed";
|
||||
const [installHint, setInstallHint] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -55,17 +60,18 @@ export function ChannelCatalogRow({
|
||||
return () => window.clearTimeout(timeout);
|
||||
}, [installHint]);
|
||||
|
||||
const pointToInstall = () => {
|
||||
setInstallHint(true);
|
||||
installButtonRef.current?.focus();
|
||||
};
|
||||
const channelIdentity = (
|
||||
<>
|
||||
<ChannelLogo feature={feature} showBrandLogos={showBrandLogos} />
|
||||
<div className="min-w-0 flex-1">
|
||||
<h3 className="truncate text-[14px] font-semibold leading-5 text-foreground">
|
||||
<h3 className="text-[14px] font-semibold leading-5 text-foreground [overflow-wrap:anywhere]">
|
||||
{displayName}
|
||||
</h3>
|
||||
{failed ? (
|
||||
<div id={statusId} className="mt-0.5">
|
||||
<ChannelStatusBadge status="failed">{channelStatusLabel(feature, tx)}</ChannelStatusBadge>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
@@ -86,22 +92,23 @@ export function ChannelCatalogRow({
|
||||
name: displayName,
|
||||
defaultValue: "View {{name}} settings",
|
||||
})}
|
||||
aria-haspopup="dialog"
|
||||
aria-haspopup={feature.installed ? "dialog" : undefined}
|
||||
aria-describedby={failed ? statusId : undefined}
|
||||
disabled={actionsDisabled}
|
||||
onClick={() => feature.installed ? onSelect() : pointToInstall()}
|
||||
onClick={(event) => {
|
||||
if (feature.installed) {
|
||||
onSelect(event.currentTarget);
|
||||
} else {
|
||||
setInstallHint(true);
|
||||
if (event.detail === 0) installButtonRef.current?.focus({ preventScroll: true });
|
||||
}
|
||||
}}
|
||||
className="group flex min-w-0 flex-1 select-none items-center gap-3 rounded-control text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border/80"
|
||||
>
|
||||
{channelIdentity}
|
||||
</button>
|
||||
)}
|
||||
{feature.runtime_status === "failed" ? (
|
||||
<div className="min-w-0 shrink truncate">
|
||||
<ChannelStatusBadge status={feature.runtime_status}>
|
||||
{channelStatusLabel(feature, tx)}
|
||||
</ChannelStatusBadge>
|
||||
</div>
|
||||
) : null}
|
||||
<div className="flex w-16 shrink-0 items-center justify-center">
|
||||
<div className="flex w-11 shrink-0 items-center justify-center">
|
||||
{!feature.installed ? (
|
||||
<HoverHint enabled={showInstallRestartHint}
|
||||
content={t(isRestarting ? "app.system.restarting" : "settings.channels.restartBeforeInstall")}>
|
||||
@@ -111,7 +118,7 @@ export function ChannelCatalogRow({
|
||||
className="inline-flex rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2">
|
||||
<Button ref={installButtonRef} type="button" variant="outline" size="icon"
|
||||
className={cn(
|
||||
"h-[22px] w-[38px] min-w-0 shrink-0 rounded-full border-border/70 bg-background p-0",
|
||||
CHANNEL_ACTION_CLASS,
|
||||
installHint && "border-[#2997FF]/60 bg-[#2997FF]/10 text-[#087FE7] ring-2 ring-[#2997FF]/25 ring-offset-2",
|
||||
)}
|
||||
disabled={actionsDisabled || anyActionBusy || !feature.install_supported}
|
||||
@@ -130,7 +137,7 @@ export function ChannelCatalogRow({
|
||||
) : feature.restart_pending ? (
|
||||
<HoverHint content={t("settings.channels.restartRequired")}>
|
||||
<Button type="button" variant="outline" size="icon"
|
||||
className="h-[22px] w-[38px] min-w-0 shrink-0 rounded-full border-border/70 bg-background p-0"
|
||||
className={CHANNEL_ACTION_CLASS}
|
||||
aria-label={t("app.system.restart")}
|
||||
aria-busy={isRestarting}
|
||||
disabled={isRestarting || anyActionBusy || !onRestart}
|
||||
@@ -141,12 +148,12 @@ export function ChannelCatalogRow({
|
||||
</Button>
|
||||
</HoverHint>
|
||||
) : (
|
||||
<ToggleButton checked={checked}
|
||||
<ToggleButton ref={toggleRef} checked={checked}
|
||||
label={checked ? tx("settings.values.on", "On") : tx("settings.values.off", "Off")}
|
||||
disabled={alwaysEnabled || actionsDisabled || anyActionBusy}
|
||||
ariaLabel={t("settings.channels.toggleChannel", { name: displayName, defaultValue: "{{name}} channel" })}
|
||||
onChange={(enabled) => {
|
||||
if (enabled && feature.configured === false) onSelect(true);
|
||||
if (enabled && feature.configured === false) onSelect(toggleRef.current, true);
|
||||
else onAction(enabled ? "enable" : "disable", feature.name);
|
||||
}} />
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import i18n from "i18next";
|
||||
import { useMemo, type ReactNode } from "react";
|
||||
import type { ReactNode } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import {
|
||||
@@ -19,7 +19,6 @@ import type {
|
||||
import { channelValidationMessage } from "@/components/settings/channels/validationMessages";
|
||||
import { useLogoFallback } from "@/hooks/useLogoFallback";
|
||||
import { normalizeLocale } from "@/i18n/config";
|
||||
import { logoFallbackUrls } from "@/lib/provider-brand";
|
||||
import type { ChannelRuntimeStatus, NanobotFeatureInfo } from "@/lib/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
@@ -154,23 +153,17 @@ export function ChannelLogo({
|
||||
?? channelUiPresentation(feature.name);
|
||||
const initials = presentation?.initials ?? feature.display_name.slice(0, 2).toUpperCase();
|
||||
const Icon = presentation?.icon;
|
||||
const logoUrls = useMemo(() => {
|
||||
const fallbackUrls = logoFallbackUrls(presentation?.logoFallbackUrl ?? presentation?.logoUrl);
|
||||
return presentation?.logoUrl && presentation.logoFallbackUrl
|
||||
? [...new Set([presentation.logoUrl, ...fallbackUrls])]
|
||||
: fallbackUrls;
|
||||
}, [presentation?.logoUrl, presentation?.logoFallbackUrl]);
|
||||
const { logoUrl, logoLoaded, onLogoError, onLogoLoad } = useLogoFallback(logoUrls);
|
||||
const showRemoteLogo = showBrandLogos && Boolean(logoUrl);
|
||||
const showLoadedLogo = showRemoteLogo && logoLoaded;
|
||||
const isLogoTile = presentation?.logoLayout === "tile" && logoUrl === presentation.logoUrl;
|
||||
const brandLogoUrl = presentation?.logoUrl;
|
||||
const { logoUrl, logoLoaded, onLogoError, onLogoLoad } = useLogoFallback(brandLogoUrl ? [brandLogoUrl] : undefined);
|
||||
const showLogo = showBrandLogos && Boolean(logoUrl);
|
||||
const showLoadedLogo = showLogo && logoLoaded;
|
||||
|
||||
return (
|
||||
<span
|
||||
data-testid={`channel-logo-${feature.name}`}
|
||||
className={cn(
|
||||
"relative grid h-8 w-8 shrink-0 place-items-center overflow-hidden rounded-[9px] text-[11px] font-semibold text-muted-foreground",
|
||||
showLoadedLogo ? (isLogoTile ? "bg-transparent" : "bg-white") : "bg-muted",
|
||||
showLoadedLogo ? "bg-white" : "bg-muted",
|
||||
)}
|
||||
aria-hidden
|
||||
>
|
||||
@@ -180,7 +173,7 @@ export function ChannelLogo({
|
||||
)}>
|
||||
{Icon ? <Icon className="h-6 w-6" strokeWidth={2} /> : initials}
|
||||
</span>
|
||||
{showRemoteLogo ? <img
|
||||
{showLogo ? <img
|
||||
src={logoUrl}
|
||||
alt=""
|
||||
decoding="async"
|
||||
@@ -188,8 +181,7 @@ export function ChannelLogo({
|
||||
referrerPolicy="no-referrer"
|
||||
draggable={false}
|
||||
className={cn(
|
||||
"absolute object-contain transition-opacity duration-150 motion-reduce:transition-none",
|
||||
isLogoTile ? "h-8 w-8" : "h-6 w-6",
|
||||
"absolute h-6 w-6 object-contain transition-opacity duration-150 motion-reduce:transition-none",
|
||||
logoLoaded ? "opacity-100" : "opacity-0",
|
||||
)}
|
||||
onLoad={onLogoLoad}
|
||||
|
||||
@@ -23,7 +23,6 @@ import {
|
||||
} from "@/components/settings/channels/ChannelIdentity";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useLogoFallback } from "@/hooks/useLogoFallback";
|
||||
import { logoFallbackUrls } from "@/lib/provider-brand";
|
||||
import type {
|
||||
NanobotChannelInstanceInfo,
|
||||
NanobotFeatureInfo,
|
||||
@@ -344,8 +343,8 @@ function ChannelInstanceAvatar({
|
||||
}) {
|
||||
const presentation = channelUiPresentation(feature.name, feature.webui);
|
||||
const [avatarFailed, setAvatarFailed] = useState(false);
|
||||
const fallbackLogoUrls = useMemo(() => logoFallbackUrls(presentation?.logoUrl), [presentation?.logoUrl]);
|
||||
const { logoUrl, onLogoError, onLogoLoad } = useLogoFallback(fallbackLogoUrls);
|
||||
const brandLogoUrl = presentation?.logoUrl;
|
||||
const { logoUrl, onLogoError, onLogoLoad } = useLogoFallback(brandLogoUrl ? [brandLogoUrl] : undefined);
|
||||
const remoteAvatarUrl = !avatarFailed ? instance.avatar_url?.trim() : "";
|
||||
const imageUrl = remoteAvatarUrl || (showBrandLogos ? logoUrl : "");
|
||||
const Icon = presentation?.icon;
|
||||
|
||||
@@ -20,6 +20,12 @@ export type SettingsSectionKey =
|
||||
| "runtime"
|
||||
| "advanced";
|
||||
|
||||
export type AppsSectionKey = "apps" | "skills" | "channels";
|
||||
|
||||
export function isAppsSection(section: SettingsSectionKey): section is AppsSectionKey {
|
||||
return section === "apps" || section === "skills" || section === "channels";
|
||||
}
|
||||
|
||||
export function isCapabilitySection(section: SettingsSectionKey): boolean {
|
||||
return ["capabilities", "image", "voice", "browser", "memory"].includes(section);
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -26,19 +26,18 @@ import {
|
||||
PauseCircle,
|
||||
PlayCircle,
|
||||
Plus,
|
||||
Search,
|
||||
TriangleAlert,
|
||||
Trash2,
|
||||
} from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { CatalogSkeleton } from "@/components/settings/shared/CatalogSkeleton";
|
||||
import { CatalogControls, CatalogFilter, CatalogToggle, CatalogToolbar } from "@/components/settings/shared/CatalogToolbar";
|
||||
import { ProxySettingsControl } from "@/components/settings/shared/ProxySettingsControl";
|
||||
|
||||
import {
|
||||
DismissibleStatusMessage,
|
||||
RestartRequiredNotice,
|
||||
SETTINGS_SEARCH_INPUT_CLASS,
|
||||
SettingsSectionTitle,
|
||||
} from "@/components/settings/shared/SettingsControls";
|
||||
import { AgentPluginDialog } from "@/components/settings/system/AgentPluginDialog";
|
||||
@@ -53,7 +52,7 @@ import {
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { Input, SearchInput } from "@/components/ui/input";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { SegmentedControl } from "@/components/ui/segmented-control";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { SettingsTextEditor } from "@/components/settings/shared/SettingsTextEditor";
|
||||
@@ -68,7 +67,10 @@ import type {
|
||||
} from "@/lib/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export type AppsKindFilter = "ready" | "cli" | "plugins" | "mcp";
|
||||
export type AppsCatalogFilter = {
|
||||
kind: "all" | "cli" | "plugins" | "mcp";
|
||||
status: "all" | "ready";
|
||||
};
|
||||
type AppsCatalogItem =
|
||||
| { id: string; kind: "cli"; app: CliAppInfo }
|
||||
| { id: string; kind: "mcp"; preset: McpPresetInfo };
|
||||
@@ -104,20 +106,20 @@ export const DEFAULT_CUSTOM_MCP_FORM: CustomMcpForm = {
|
||||
};
|
||||
|
||||
export function AppsCatalogPage(props: Omit<ComponentProps<typeof AppsCatalogSettings>, "filter" | "onFilterChange">) {
|
||||
const [selection, setSelection] = useState<AppsKindFilter | null>(() => props.setupName ? "mcp" : null);
|
||||
const [selection, setSelection] = useState<AppsCatalogFilter | null>(() => props.setupName ? { kind: "mcp", status: "all" } : null);
|
||||
const hasReady = Boolean(
|
||||
props.cliApps?.apps.some((app) => app.installed) || props.mcpPresets?.presets.some(mcpPresetReady),
|
||||
);
|
||||
const waiting = (props.cliAppsLoading && !props.cliApps) || (props.mcpPresetsLoading && !props.mcpPresets);
|
||||
const filter = selection ?? (hasReady || waiting ? "ready" : "cli");
|
||||
const filter: AppsCatalogFilter = selection ?? { kind: "all", status: hasReady || waiting ? "ready" : "all" };
|
||||
|
||||
useEffect(() => {
|
||||
if (selection === null && (hasReady || (props.cliApps && props.mcpPresets))) {
|
||||
setSelection(hasReady ? "ready" : "cli");
|
||||
setSelection({ kind: "all", status: hasReady ? "ready" : "all" });
|
||||
}
|
||||
}, [selection, hasReady, props.cliApps, props.mcpPresets]);
|
||||
|
||||
return <AppsCatalogSettings {...props} filter={filter} onFilterChange={setSelection} />;
|
||||
return <AppsCatalogSettings {...props} filter={filter} onFilterChange={setSelection} showSearch={false} />;
|
||||
}
|
||||
|
||||
export function AppsCatalogSettings({
|
||||
@@ -129,6 +131,7 @@ export function AppsCatalogSettings({
|
||||
cliAppsLoading,
|
||||
mcpPresetsLoading,
|
||||
query,
|
||||
showSearch = true,
|
||||
filter,
|
||||
cliActionKey,
|
||||
mcpActionKey,
|
||||
@@ -175,7 +178,8 @@ export function AppsCatalogSettings({
|
||||
cliAppsLoading: boolean;
|
||||
mcpPresetsLoading: boolean;
|
||||
query: string;
|
||||
filter: AppsKindFilter;
|
||||
showSearch?: boolean;
|
||||
filter: AppsCatalogFilter;
|
||||
cliActionKey: string | null;
|
||||
mcpActionKey: string | null;
|
||||
mcpOAuthFlow: McpOAuthFlowPayload | null;
|
||||
@@ -194,7 +198,7 @@ export function AppsCatalogSettings({
|
||||
showBrandLogos: boolean;
|
||||
requiresRestartPending: boolean;
|
||||
onQueryChange: (value: string) => void;
|
||||
onFilterChange: (value: AppsKindFilter) => void;
|
||||
onFilterChange: (value: AppsCatalogFilter) => void;
|
||||
onCliAction: (action: "install" | "update" | "uninstall" | "test", name: string) => void;
|
||||
onMcpAction: (action: "enable" | "disable" | "remove" | "test" | "reconnect" | "proxy", name: string, values?: Record<string, string>) => void;
|
||||
onMcpOAuthConnect: (name: string, reset?: boolean, values?: Record<string, string>) => void;
|
||||
@@ -215,12 +219,12 @@ export function AppsCatalogSettings({
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const tx = (key: string, fallback: string) => t(key, { defaultValue: fallback });
|
||||
const filterOptions = [
|
||||
{ value: "ready", label: tx("settings.apps.filterAll", "Ready") },
|
||||
const kindOptions = [
|
||||
{ value: "all", label: t("settings.apps.allTypes") },
|
||||
{ value: "cli", label: tx("settings.apps.filterCli", "CLI Apps") },
|
||||
{ value: "plugins", label: tx("settings.apps.filterPlugins", "Plugins") },
|
||||
{ value: "mcp", label: tx("settings.apps.filterMcp", "MCP") },
|
||||
];
|
||||
] as const;
|
||||
const normalizedQuery = query.trim().toLowerCase();
|
||||
const installedCliNames = new Set((cliApps?.apps ?? []).filter((app) => app.installed).map((app) => app.name));
|
||||
const managedPlugins = new Map(
|
||||
@@ -228,50 +232,39 @@ export function AppsCatalogSettings({
|
||||
.filter((preset) => preset.source === "agent-plugin" && preset.managed_by_cli)
|
||||
.map((preset) => [preset.managed_by_cli!, preset]),
|
||||
);
|
||||
const items: AppsCatalogItem[] = [
|
||||
const catalogItems: AppsCatalogItem[] = [
|
||||
...(cliApps?.apps ?? []).map((app) => ({ id: `cli:${app.name}`, kind: "cli" as const, app })),
|
||||
...(mcpPresets?.presets ?? [])
|
||||
.filter((preset) => !preset.managed_by_cli || !installedCliNames.has(preset.managed_by_cli))
|
||||
.map((preset) => ({ id: `mcp:${preset.name}`, kind: "mcp" as const, preset })),
|
||||
]
|
||||
.filter((item) => {
|
||||
const matchesFilter = filter === "ready"
|
||||
? appsReady(item)
|
||||
: filter === "cli"
|
||||
? item.kind === "cli"
|
||||
: filter === "plugins"
|
||||
? item.kind === "mcp" && item.preset.source === "agent-plugin"
|
||||
: item.kind === "mcp" && item.preset.source !== "agent-plugin";
|
||||
return matchesFilter && (!normalizedQuery || appsSearchText(item).includes(normalizedQuery));
|
||||
})
|
||||
.sort((left, right) => {
|
||||
const rank = Number(!appsReady(left)) - Number(!appsReady(right));
|
||||
return rank || appsTitle(left).localeCompare(appsTitle(right));
|
||||
});
|
||||
];
|
||||
const matches = catalogItems.filter((item) => {
|
||||
const matchesKind = filter.kind === "all" || (filter.kind === "cli"
|
||||
? item.kind === "cli"
|
||||
: filter.kind === "plugins"
|
||||
? item.kind === "mcp" && item.preset.source === "agent-plugin"
|
||||
: item.kind === "mcp" && item.preset.source !== "agent-plugin");
|
||||
return matchesKind && (!normalizedQuery || appsSearchText(item).includes(normalizedQuery));
|
||||
});
|
||||
const items = (filter.status === "ready" ? matches.filter(appsReady) : matches).sort((left, right) => {
|
||||
const rank = Number(!appsReady(left)) - Number(!appsReady(right));
|
||||
return rank || appsTitle(left).localeCompare(appsTitle(right));
|
||||
});
|
||||
const hiddenByReadyFilter = matches.length > items.length;
|
||||
const focusedApp = cliFocusName
|
||||
? (cliApps?.apps ?? []).find((app) => app.name === cliFocusName && app.installed)
|
||||
: null;
|
||||
const loading = (mcpPresetsLoading && !mcpPresets)
|
||||
|| (filter !== "mcp" && cliAppsLoading && !cliApps);
|
||||
const cliAppCount = cliApps?.apps.length ?? 0;
|
||||
const emptyTitle = normalizedQuery
|
||||
? tx("settings.apps.empty", "No tools match your search.")
|
||||
: filter === "cli"
|
||||
? tx("settings.apps.emptyApps", "No apps available.")
|
||||
: filter === "plugins"
|
||||
? tx("settings.apps.emptyPlugins", "No Agent Plugins installed.")
|
||||
: filter === "mcp"
|
||||
? tx("settings.apps.emptyIntegrations", "No MCP tools available.")
|
||||
: tx("settings.apps.emptyReady", "No tools are ready yet.");
|
||||
const emptyBrowseTarget: AppsKindFilter | null = normalizedQuery || filter === "plugins"
|
||||
? null
|
||||
: filter === "cli"
|
||||
? "mcp"
|
||||
: filter === "mcp"
|
||||
? (cliAppCount ? "cli" : null)
|
||||
: cliAppCount
|
||||
? "cli"
|
||||
: "mcp";
|
||||
|| (filter.kind !== "mcp" && cliAppsLoading && !cliApps);
|
||||
const emptyTitle = hiddenByReadyFilter
|
||||
? tx("settings.apps.emptyReady", "No tools are ready yet")
|
||||
: normalizedQuery
|
||||
? tx("settings.apps.empty", "No tools match your search")
|
||||
: filter.kind === "plugins"
|
||||
? tx("settings.apps.emptyPlugins", "No Agent Plugins installed")
|
||||
: filter.kind === "mcp"
|
||||
? tx("settings.apps.emptyIntegrations", "No MCP tools available")
|
||||
: tx("settings.apps.emptyApps", "No tools available");
|
||||
const statusMessage =
|
||||
cliError ||
|
||||
mcpError ||
|
||||
@@ -286,30 +279,20 @@ export function AppsCatalogSettings({
|
||||
)
|
||||
: "";
|
||||
return (
|
||||
<div className="settings-stack">
|
||||
<div className="catalog-section">
|
||||
<CatalogToolbar search={showSearch ? {
|
||||
value: query,
|
||||
onChange: (event) => onQueryChange(event.target.value),
|
||||
placeholder: t("settings.apps.searchPlaceholder"),
|
||||
} : undefined}>
|
||||
<CatalogControls>
|
||||
<CatalogFilter label={t("settings.apps.typeFilter")} value={filter.kind} options={kindOptions}
|
||||
onChange={(kind) => onFilterChange({ ...filter, kind })} />
|
||||
<CatalogToggle label={t("settings.apps.readyOnly")} checked={filter.status === "ready"}
|
||||
onChange={(ready) => onFilterChange({ ...filter, status: ready ? "ready" : "all" })} />
|
||||
</CatalogControls>
|
||||
</CatalogToolbar>
|
||||
<div role="status" className="sr-only">{oauthStatusAnnouncement}</div>
|
||||
<section className="space-y-4">
|
||||
<div className="flex flex-col gap-3 lg:flex-row lg:items-center">
|
||||
<div className="relative flex-1">
|
||||
<Search className="pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" aria-hidden />
|
||||
<SearchInput
|
||||
value={query}
|
||||
onChange={(event) => onQueryChange(event.target.value)}
|
||||
placeholder={tx("settings.apps.searchPlaceholder", "Search Apps")}
|
||||
className={cn(
|
||||
"h-12 pl-11 text-[15px]",
|
||||
SETTINGS_SEARCH_INPUT_CLASS,
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<SegmentedControl
|
||||
value={filter}
|
||||
options={filterOptions}
|
||||
onChange={(value) => onFilterChange(value as AppsKindFilter)}
|
||||
className="max-[480px]:grid max-[480px]:w-full max-[480px]:grid-cols-2 max-[480px]:rounded-2xl"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{statusMessage ? (
|
||||
<DismissibleStatusMessage
|
||||
@@ -334,9 +317,9 @@ export function AppsCatalogSettings({
|
||||
<section className="rounded-panel bg-settings-surface px-3 py-3 sm:px-4">
|
||||
<div className="settings-section-heading border-b border-border/45 pb-2">
|
||||
<SettingsSectionTitle>
|
||||
{filter === "mcp"
|
||||
{filter.kind === "mcp"
|
||||
? tx("settings.apps.mcpTools", "MCP tools")
|
||||
: filter === "plugins"
|
||||
: filter.kind === "plugins"
|
||||
? tx("settings.apps.filterPlugins", "Plugins")
|
||||
: tx("settings.apps.featured", "Tools")}
|
||||
</SettingsSectionTitle>
|
||||
@@ -373,7 +356,7 @@ export function AppsCatalogSettings({
|
||||
oauthCompleting={mcpOAuthCompleting}
|
||||
oauthCallbackError={mcpOAuthCallbackError}
|
||||
showBrandLogos={showBrandLogos}
|
||||
showTypeBadge={filter !== "mcp"}
|
||||
showTypeBadge={filter.kind !== "mcp"}
|
||||
onFieldChange={onMcpFieldChange}
|
||||
onAction={onMcpAction}
|
||||
onOAuthConnect={onMcpOAuthConnect}
|
||||
@@ -389,11 +372,11 @@ export function AppsCatalogSettings({
|
||||
) : null}
|
||||
{loading ? (
|
||||
<CatalogSkeleton label={tx("settings.apps.loading", "Loading apps…")} layout="apps"
|
||||
appActionLabel={filter === "cli" ? undefined : tx("settings.mcp.manage", "Manage")} />
|
||||
appActionLabel={filter.kind === "cli" ? undefined : tx("settings.mcp.manage", "Manage")} />
|
||||
) : !items.length && !statusIsError ? (
|
||||
<div className="px-3 py-12 text-center text-sm text-muted-foreground">
|
||||
<p>{emptyTitle}</p>
|
||||
{normalizedQuery ? (
|
||||
{hiddenByReadyFilter ? null : normalizedQuery ? (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
@@ -402,29 +385,18 @@ export function AppsCatalogSettings({
|
||||
>
|
||||
{tx("settings.apps.clearSearch", "Clear search")}
|
||||
</Button>
|
||||
) : emptyBrowseTarget ? (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
className="mt-4 rounded-full"
|
||||
onClick={() => onFilterChange(emptyBrowseTarget)}
|
||||
>
|
||||
{emptyBrowseTarget === "cli"
|
||||
? tx("settings.apps.browseApps", "Browse apps")
|
||||
: tx("settings.apps.browseIntegrations", "Browse MCP tools")}
|
||||
</Button>
|
||||
) : (
|
||||
) : filter.kind === "mcp" || filter.kind === "plugins" ? (
|
||||
<p className="mx-auto mt-2 max-w-[28rem] text-[12px] leading-5">
|
||||
{filter === "plugins"
|
||||
? tx("settings.apps.emptyPluginsHint", "Add a plugin to the workspace plugins directory to enable it here.")
|
||||
: tx("settings.apps.emptyIntegrationsHint", "Add a custom MCP server below.")}
|
||||
{filter.kind === "mcp"
|
||||
? tx("settings.apps.emptyIntegrationsHint", "Add a custom MCP server below")
|
||||
: tx("settings.apps.emptyPluginsHint", "Add a plugin to the workspace plugins directory to enable it here")}
|
||||
</p>
|
||||
)}
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
</section>
|
||||
|
||||
{filter === "mcp" ? (
|
||||
{filter.kind === "mcp" ? (
|
||||
<McpCustomServerPanel
|
||||
onConfigureProxy={onConfigureProxy}
|
||||
form={customMcpForm}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { useCallback, useLayoutEffect, useRef, useState } from "react";
|
||||
import { Search, X } from "lucide-react";
|
||||
import { X } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { SearchInput } from "@/components/ui/input";
|
||||
import { SegmentedControl } from "@/components/ui/segmented-control";
|
||||
import { SETTINGS_SEARCH_INPUT_CLASS } from "@/components/settings/shared/SettingsControls";
|
||||
import { CatalogControls, CatalogToggle, CatalogToolbar } from "@/components/settings/shared/CatalogToolbar";
|
||||
import { CatalogSkeleton } from "@/components/settings/shared/CatalogSkeleton";
|
||||
import type { ChannelFeatureAction } from "@/channel-plugins/types";
|
||||
import { ChannelCatalogRow } from "@/components/settings/channels/ChannelCatalogRow";
|
||||
@@ -18,7 +16,7 @@ import { Dialog, DialogClose, DialogContent, DialogTitle } from "@/components/ui
|
||||
type ChannelFilter = "all" | "enabled";
|
||||
|
||||
export function ChannelsSettings({
|
||||
token, nanobotFeatures, loading, actionKey, chatAppsDocsUrl, showBrandLogos,
|
||||
token, nanobotFeatures, loading, actionKey, chatAppsDocsUrl, showBrandLogos, query,
|
||||
error, requiresRestartPending, onAction, onFeaturesUpdate, onDismissStatus,
|
||||
onRestart, isRestarting, onConfigureMcp, onBeforeCloseChange,
|
||||
}: {
|
||||
@@ -28,6 +26,7 @@ export function ChannelsSettings({
|
||||
actionKey: string | null;
|
||||
chatAppsDocsUrl?: string;
|
||||
showBrandLogos: boolean;
|
||||
query: string;
|
||||
error: string | null;
|
||||
requiresRestartPending: boolean;
|
||||
onAction: ChannelFeatureAction;
|
||||
@@ -40,11 +39,10 @@ export function ChannelsSettings({
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [selectedChannelName, setSelectedChannelName] = useState<string | null>(null);
|
||||
const [query, setQuery] = useState("");
|
||||
const [filter, setFilter] = useState<ChannelFilter>("enabled");
|
||||
const [connectRequestId, setConnectRequestId] = useState(0);
|
||||
const filterInitializedRef = useRef(false);
|
||||
const triggerRef = useRef<HTMLElement | null>(null);
|
||||
const triggerRef = useRef<HTMLButtonElement | null>(null);
|
||||
const dialogRef = useRef<HTMLDivElement | null>(null);
|
||||
const beforeCloseRef = useRef<(() => Promise<boolean>) | null>(null);
|
||||
const closePendingRef = useRef(false);
|
||||
@@ -103,23 +101,16 @@ export function ChannelsSettings({
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="settings-stack">
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-center">
|
||||
<div className="relative min-w-0 flex-1">
|
||||
<Search className="pointer-events-none absolute start-4 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" aria-hidden />
|
||||
<SearchInput type="search" value={query} onChange={(event) => setQuery(event.target.value)}
|
||||
aria-label={t("settings.channels.search")}
|
||||
placeholder={t("settings.channels.search")}
|
||||
className={`h-12 ps-11 text-[15px] ${SETTINGS_SEARCH_INPUT_CLASS}`} />
|
||||
</div>
|
||||
<SegmentedControl value={filter} onChange={(value) => {
|
||||
filterInitializedRef.current = true;
|
||||
setFilter(value);
|
||||
}} options={[
|
||||
{ value: "all", label: t("settings.channels.filterAll") },
|
||||
{ value: "enabled", label: t("settings.channels.filterEnabled") },
|
||||
]} />
|
||||
</div>
|
||||
<div className="catalog-section">
|
||||
<CatalogToolbar>
|
||||
<CatalogControls>
|
||||
<CatalogToggle label={t("settings.channels.enabledOnly")} checked={filter === "enabled"}
|
||||
onChange={(enabled) => {
|
||||
filterInitializedRef.current = true;
|
||||
setFilter(enabled ? "enabled" : "all");
|
||||
}} />
|
||||
</CatalogControls>
|
||||
</CatalogToolbar>
|
||||
{error && !selectedChannel ? <DismissibleStatusMessage message={error} isError onDismiss={onDismissStatus} /> : null}
|
||||
{restartRequired && !hasPendingChannelRestart ? (
|
||||
<RestartRequiredNotice message={t("settings.channels.restartRequired")}
|
||||
@@ -146,8 +137,8 @@ export function ChannelsSettings({
|
||||
<ChannelCatalogRow key={feature.name} feature={feature} showBrandLogos={showBrandLogos}
|
||||
actionKey={actionKey} restartRequired={restartRequired} onAction={onAction}
|
||||
onRestart={onRestart} isRestarting={isRestarting}
|
||||
onSelect={(connect = false) => {
|
||||
triggerRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
||||
onSelect={(trigger, connect = false) => {
|
||||
triggerRef.current = trigger;
|
||||
beforeCloseRef.current = null;
|
||||
setConnectRequestId(connect ? 1 : 0);
|
||||
setSelectedChannelName(feature.name);
|
||||
@@ -168,7 +159,10 @@ export function ChannelsSettings({
|
||||
event.preventDefault();
|
||||
dialogRef.current?.focus({ preventScroll: true });
|
||||
}}
|
||||
onCloseAutoFocus={(event) => { event.preventDefault(); triggerRef.current?.focus(); }}>
|
||||
onCloseAutoFocus={(event) => {
|
||||
event.preventDefault();
|
||||
triggerRef.current?.focus({ preventScroll: true });
|
||||
}}>
|
||||
<DialogTitle className="sr-only">{t("settings.nav.channels")}</DialogTitle>
|
||||
<div className="max-h-[85dvh] min-h-0 overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
|
||||
<div className="relative">
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/* The width clips one sidebar, while its panel paint and labels fade to the rail. */
|
||||
.sidebar-dock-frame {
|
||||
--sidebar-dock-duration: 300ms;
|
||||
--sidebar-dock-ease: cubic-bezier(0, 0, 0.2, 1);
|
||||
transition: width var(--sidebar-dock-duration) var(--sidebar-dock-ease);
|
||||
}
|
||||
.sidebar-dock-frame[data-resizing] { --sidebar-dock-duration: 0ms; }
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.sidebar-dock-frame { --sidebar-dock-duration: 0ms; }
|
||||
}
|
||||
.sidebar-dock-surface,
|
||||
.sidebar-dock-history,
|
||||
.sidebar-dock-label,
|
||||
.sidebar-dock-host [data-sidebar-host-label] {
|
||||
transition: opacity var(--sidebar-dock-duration) var(--sidebar-dock-ease),
|
||||
visibility var(--sidebar-dock-duration) var(--sidebar-dock-ease);
|
||||
}
|
||||
.sidebar-dock-history {
|
||||
/* Keep the rows at their open width until they are clipped out of sight. */
|
||||
min-width: var(--sidebar-open-width);
|
||||
}
|
||||
.sidebar-dock-frame[data-collapsed] .sidebar-dock-surface,
|
||||
[data-sidebar-collapsed="true"] :is(.sidebar-dock-history, .sidebar-dock-label, .sidebar-dock-host [data-sidebar-host-label]) {
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
.sidebar-dock-footer-row {
|
||||
--sidebar-settings-width: max(5.5rem, 36%);
|
||||
position: relative;
|
||||
padding-block-end: 0;
|
||||
transition: padding-block-end var(--sidebar-dock-duration) var(--sidebar-dock-ease);
|
||||
}
|
||||
.sidebar-dock-footer-row > .sidebar-dock-settings {
|
||||
width: var(--sidebar-settings-width);
|
||||
}
|
||||
.sidebar-dock-host {
|
||||
position: absolute;
|
||||
inset-block-end: 0;
|
||||
inset-inline-end: 0;
|
||||
inset-inline-start: calc(var(--sidebar-settings-width) + 0.25rem);
|
||||
transition: inset-inline-start var(--sidebar-dock-duration) var(--sidebar-dock-ease);
|
||||
}
|
||||
.sidebar-dock-host [data-host-switcher] { overflow: hidden; }
|
||||
[data-sidebar-collapsed="true"] .sidebar-dock-footer-row { padding-block-end: 2.25rem; }
|
||||
[data-sidebar-collapsed="true"] .sidebar-dock-footer-row > .sidebar-dock-settings { width: 100%; }
|
||||
[data-sidebar-collapsed="true"] .sidebar-dock-host { inset-inline-start: 0; }
|
||||
@@ -5,24 +5,31 @@ html.dark .startup-shell { --startup-fill: hsl(0 0% 72% / .2); --startup-surface
|
||||
.startup-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
|
||||
.startup-block { height: 14px; border-radius: 4px; background: var(--startup-fill); }
|
||||
.startup-navigation { display: none; flex: 0 0 var(--startup-sidebar-width); padding: 20px 12px; background: var(--startup-nav); overflow: hidden; }
|
||||
.startup-shell[data-sidebar-expanded="false"] .startup-navigation { background: transparent; }
|
||||
.startup-nav-brand { width: 32px; height: 32px; margin-bottom: 28px; border-radius: 10px; }
|
||||
.startup-nav-row { display: flex; height: 40px; align-items: center; gap: 12px; padding: 0 8px; }
|
||||
.startup-nav-icon { flex: 0 0 16px; height: 16px; }
|
||||
.startup-nav-label { width: 96px; height: 12px; }
|
||||
.startup-content { flex: 1; min-width: 0; height: 100%; }
|
||||
.startup-scroll { height: 100%; overflow-y: auto; scrollbar-gutter: stable; scrollbar-width: thin; }
|
||||
.startup-page { width: 100%; max-width: 816px; padding: 24px 12px; margin: 0 auto; }
|
||||
.startup-page { --startup-page-gutter: 0.75rem; container-type: inline-size; width: 100%; max-width: calc(var(--content-column-width) + 2 * var(--startup-page-gutter)); padding: 24px var(--startup-page-gutter); margin: 0 auto; }
|
||||
.startup-page-header { margin-bottom: 28px; }
|
||||
.startup-back { display: flex; align-items: center; height: 30px; margin-bottom: 16px; padding-left: 10px; }
|
||||
@media (pointer: coarse) { .startup-back { height: 44px; } }
|
||||
.startup-back .startup-block { width: 96px; height: 12px; }
|
||||
.startup-title { display: flex; align-items: center; height: 30px; }
|
||||
.startup-title .startup-block { width: 112px; height: 24px; }
|
||||
.startup-tabs { display: none; height: 35.5px; margin-bottom: 20px; }
|
||||
.startup-tabs .startup-block { width: 174px; height: 100%; border-radius: 9999px; }
|
||||
.startup-toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
|
||||
.startup-search { flex: 1; height: 48px; min-height: 48px; border-radius: 9999px; }
|
||||
.startup-filters { width: 100%; height: 34px; border-radius: 9999px; }
|
||||
.startup-tabs { display: flex; gap: 4px; width: 208px; height: 36px; padding: 4px; border-radius: 12px; background: var(--startup-surface); }
|
||||
.startup-tabs .startup-block { flex: 1; height: 28px; border-radius: 8px; }
|
||||
.startup-search { height: 36px; border-radius: 12px; }
|
||||
.startup-shell[data-startup-surface="skills"] .startup-primary-choices > :nth-child(n+3),
|
||||
.startup-shell[data-startup-surface="channels"] .startup-primary-choices,
|
||||
.startup-shell:not([data-startup-surface="skills"]) .startup-secondary-choices > :nth-child(3) { display: none; }
|
||||
.startup-controls .catalog-choices .startup-block { width: 38px; height: 20px; margin-inline: 4px; border-radius: 8px; }
|
||||
.startup-controls .catalog-choices .startup-block:nth-child(2) { width: 52px; }
|
||||
.startup-controls .catalog-choices .startup-block:nth-child(3) { width: 64px; }
|
||||
.startup-shell:not([data-startup-surface="skills"]) .startup-secondary-choices .startup-block:first-child { width: 52px; height: 12px; }
|
||||
.startup-shell:not([data-startup-surface="skills"]) .startup-secondary-choices .startup-block:nth-child(2) { width: 36px; border-radius: 9999px; }
|
||||
.startup-catalog-heading { display: none; height: 29px; align-items: start; padding: 3px 16px 8px; border-bottom: 1px solid var(--startup-fill); }
|
||||
.startup-catalog-heading .startup-block { width: 40px; }
|
||||
.startup-shell[data-startup-surface="apps"] .startup-catalog-frame { padding: 12px; border-radius: 22px; background: var(--startup-surface); }
|
||||
@@ -37,11 +44,7 @@ html.dark .startup-shell { --startup-fill: hsl(0 0% 72% / .2); --startup-surface
|
||||
.startup-catalog-copy .startup-block + .startup-block { width: 80%; height: 12px; opacity: .6; margin: 4px 0; }
|
||||
.startup-catalog-action { flex: 0 0 36px; height: 36px; border-radius: 9999px; }
|
||||
.startup-catalog-row:nth-child(odd) .startup-catalog-copy .startup-block:first-child { width: 50%; }
|
||||
.startup-shell[data-startup-surface="skills"] .startup-tabs { display: block; }
|
||||
.startup-shell[data-startup-surface="skills"] .startup-panel { overflow: hidden; border-radius: 22px; background: var(--startup-surface); }
|
||||
.startup-shell[data-startup-surface="skills"] .startup-toolbar { padding: 16px 16px 8px; margin: 0; }
|
||||
.startup-shell[data-startup-surface="skills"] .startup-search { height: 36px; min-height: 36px; }
|
||||
.startup-shell[data-startup-surface="skills"] .startup-filters { height: 32.5px; }
|
||||
.startup-shell[data-startup-surface="skills"] .startup-catalog-frame { overflow: hidden; padding-top: 12px; border-radius: 22px; background: var(--startup-surface); }
|
||||
.startup-shell[data-startup-surface="skills"] .startup-catalog { display: block; padding: 8px 12px 12px; }
|
||||
.startup-shell[data-startup-surface="skills"] .startup-catalog-group { display: flex; }
|
||||
.startup-shell[data-startup-surface="skills"] .startup-catalog-row { margin-top: 4px; padding-inline: 8px; }
|
||||
@@ -50,11 +53,10 @@ html.dark .startup-shell { --startup-fill: hsl(0 0% 72% / .2); --startup-surface
|
||||
.startup-shell[data-startup-surface="channels"] .startup-catalog { padding: 0; column-gap: 16px; }
|
||||
.startup-shell[data-startup-surface="channels"] .startup-catalog-row { height: 60px; padding: 10px 16px; }
|
||||
.startup-shell[data-startup-surface="channels"] .startup-catalog-icon { flex-basis: 32px; height: 32px; border-radius: 9px; }
|
||||
.startup-shell[data-startup-surface="channels"] .startup-catalog-action { flex-basis: 38px; height: 20px; margin-inline: 13px; }
|
||||
.startup-shell[data-startup-surface="channels"] .startup-catalog-action { flex-basis: 38px; height: 20px; margin-inline: 3px; }
|
||||
.startup-shell[data-startup-surface="channels"] .startup-catalog-copy .startup-block + .startup-block { display: none; }
|
||||
.startup-automation, .startup-settings, .startup-chat { display: none; }
|
||||
.startup-shell:is([data-startup-surface="automations"], [data-startup-surface="settings"], [data-startup-surface="remote"]) .startup-panel { display: none; }
|
||||
.startup-shell[data-startup-surface="automations"] .startup-page { max-width: 984px; }
|
||||
.startup-shell[data-startup-surface="automations"] .startup-automation { display: block; }
|
||||
.startup-automation-composer { display: flex; align-items: center; height: 110px; margin-bottom: 20px; padding: 16px; border: 1px solid var(--startup-fill); border-radius: 28px; }
|
||||
.startup-automation-composer .startup-block { width: 60%; }
|
||||
@@ -123,7 +125,7 @@ html.dark .startup-composer-surface { background: hsl(0 0% 22%); box-shadow: ins
|
||||
.startup-shell[data-existing-chat="true"] .startup-header-title { display: block; width: 96px; height: 12px; }
|
||||
.startup-shell[data-existing-chat="true"] .startup-chat-layout { display: flex; flex-direction: column; }
|
||||
.startup-shell[data-existing-chat="true"] .startup-messages { display: block; }
|
||||
.startup-shell[data-existing-chat="true"] .startup-composer { max-width: 792px; margin-top: auto; }
|
||||
.startup-shell[data-existing-chat="true"] .startup-composer { max-width: var(--content-column-width); margin-top: auto; }
|
||||
.startup-shell[data-existing-chat="true"] :is(.startup-chat-empty, .startup-workspace-row) { display: none; }
|
||||
@media (min-width: 640px) {
|
||||
.startup-chat-layout { grid-template-rows: minmax(min-content, 1fr) auto 1fr; padding: 48px 16px; }
|
||||
@@ -131,21 +133,14 @@ html.dark .startup-composer-surface { background: hsl(0 0% 22%); box-shadow: ins
|
||||
.startup-composer-input { padding-inline: 20px; }
|
||||
.startup-composer-footer { padding-inline: 16px; }
|
||||
.startup-workspace-row { padding-inline-end: 12px; }
|
||||
.startup-page { max-width: 824px; padding: 32px 16px; }
|
||||
.startup-page { --startup-page-gutter: 1rem; padding-block: 32px; }
|
||||
.startup-shell:is([data-startup-surface="apps"], [data-startup-surface="skills"], [data-startup-surface="channels"], [data-startup-surface="automations"]) .startup-scroll { scrollbar-gutter: stable both-edges; }
|
||||
.startup-title { height: 35px; }
|
||||
.startup-toolbar { flex-direction: row; align-items: center; }
|
||||
.startup-filters { width: 174px; }
|
||||
.startup-shell[data-startup-surface="apps"] .startup-toolbar { flex-direction: column; align-items: stretch; }
|
||||
.startup-shell[data-startup-surface="apps"] .startup-filters { width: 100%; }
|
||||
.startup-shell[data-startup-surface="apps"] .startup-catalog-frame { padding-inline: 16px; }
|
||||
.startup-shell[data-startup-surface="skills"] .startup-filters { width: 233px; }
|
||||
.startup-shell[data-startup-surface="skills"] .startup-search { max-width: 320px; }
|
||||
.startup-shell[data-startup-surface="skills"] .startup-toolbar { justify-content: space-between; }
|
||||
.startup-shell[data-startup-surface="skills"] .startup-catalog { padding-inline: 16px; }
|
||||
.startup-shell[data-startup-surface="skills"] .startup-catalog-action { display: block; flex-basis: 80px; height: 12px; margin-left: 12px; }
|
||||
.startup-shell[data-startup-surface="channels"] .startup-catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
||||
.startup-shell[data-startup-surface="settings"] .startup-page { padding-inline: 32px; }
|
||||
.startup-shell[data-startup-surface="automations"] .startup-page { max-width: 992px; }
|
||||
}
|
||||
@media (min-width: 1024px) {
|
||||
.startup-header-menu { display: none; }
|
||||
@@ -156,9 +151,6 @@ html.dark .startup-composer-surface { background: hsl(0 0% 22%); box-shadow: ins
|
||||
.startup-page { padding-top: 48px; }
|
||||
.startup-back { display: none; }
|
||||
.startup-shell[data-sidebar-expanded="true"]:not([data-startup-surface="settings"]) .startup-page-header { display: none; }
|
||||
.startup-shell[data-startup-surface="apps"] .startup-toolbar { flex-direction: row; align-items: center; }
|
||||
.startup-shell[data-startup-surface="apps"][data-sidebar-expanded="true"] .startup-toolbar { margin-top: 20px; }
|
||||
.startup-shell[data-startup-surface="apps"] .startup-filters { width: 156px; }
|
||||
.startup-automation-composer { height: 62px; }
|
||||
}
|
||||
@media (min-width: 1280px) {
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
import type { ComponentProps } from "react";
|
||||
import { forwardRef, type ComponentProps } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function ToggleButton({
|
||||
type ToggleButtonProps = {
|
||||
checked: boolean;
|
||||
disabled?: boolean;
|
||||
onChange: (checked: boolean) => void;
|
||||
ariaLabel?: string;
|
||||
label: string;
|
||||
} & Pick<ComponentProps<"button">, "id" | "aria-describedby" | "aria-invalid">;
|
||||
|
||||
export const ToggleButton = forwardRef<HTMLButtonElement, ToggleButtonProps>(function ToggleButton({
|
||||
checked,
|
||||
disabled,
|
||||
onChange,
|
||||
ariaLabel,
|
||||
label,
|
||||
...accessibility
|
||||
}: {
|
||||
checked: boolean;
|
||||
disabled?: boolean;
|
||||
onChange: (checked: boolean) => void;
|
||||
ariaLabel?: string;
|
||||
label: string;
|
||||
} & Pick<ComponentProps<"button">, "id" | "aria-describedby" | "aria-invalid">) {
|
||||
}, ref) {
|
||||
return (
|
||||
<button
|
||||
ref={ref}
|
||||
{...accessibility}
|
||||
type="button"
|
||||
role="switch"
|
||||
@@ -48,4 +51,4 @@ export function ToggleButton({
|
||||
<span className="sr-only">{label}</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user