diff --git a/webui/src/components/Sidebar.tsx b/webui/src/components/Sidebar.tsx index 3d4f7a6d2..671ed701f 100644 --- a/webui/src/components/Sidebar.tsx +++ b/webui/src/components/Sidebar.tsx @@ -55,12 +55,29 @@ interface SidebarProps { hostChromeInset?: boolean; } +type NavigatorWithUserAgentData = Navigator & { + userAgentData?: { platform?: string }; +}; + +function isApplePlatform(): boolean { + if (typeof navigator === "undefined") return false; + const platform = navigator.platform || ""; + const userAgentPlatform = + (navigator as NavigatorWithUserAgentData).userAgentData?.platform || ""; + return /mac|iphone|ipad|ipod/i.test(`${platform} ${userAgentPlatform}`); +} + +function newChatShortcutLabel(): string { + return isApplePlatform() ? "⌘⇧O" : "Ctrl+Shift+O"; +} + export function Sidebar(props: SidebarProps) { const { t } = useTranslation(); const [menuPortalContainer, setMenuPortalContainer] = useState(null); const collapsed = Boolean(props.collapsed); const toggleLabel = t("thread.header.toggleSidebar"); + const newChatShortcut = newChatShortcutLabel(); return (