Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(ui): unify pill tabs and center the chat empty-state icon (#2590)

Joshua4a76a4f492da
diff --git a/src/components/DictionaryView.tsx b/src/components/DictionaryView.tsx
index 7744df7e8..36c558420 100644
--- a/src/components/DictionaryView.tsx
+++ b/src/components/DictionaryView.tsx
@@ -202,12 +202,12 @@ export default function DictionaryView() {
/>
<div className={cn(PAGE_CONTENT_WIDTH_CLASS, "px-6 pt-6")}>
- <TabsList className="h-10 rounded-full p-1">
- <TabsTrigger value="dictionary" className="h-8 gap-2 rounded-full px-4 text-sm">
+ <TabsList variant="pill">
+ <TabsTrigger value="dictionary" variant="pill">
<NotebookPen size={17} />
{t("dictionary.tabDictionary")}
</TabsTrigger>
- <TabsTrigger value="snippets" className="h-8 gap-2 rounded-full px-4 text-sm">
+ <TabsTrigger value="snippets" variant="pill">
<PanelRight size={17} />
{t("dictionary.tabSnippets")}
</TabsTrigger>
diff --git a/src/components/InsightsView.tsx b/src/components/InsightsView.tsx
index bd20fb977..ee43b7526 100644
--- a/src/components/InsightsView.tsx
+++ b/src/components/InsightsView.tsx
@@ -506,12 +506,12 @@ export default function InsightsView({ onSignIn }: InsightsViewProps) {
return (
<div className={cn(PAGE_CONTENT_WIDTH_CLASS, "flex min-h-full flex-col px-6 py-6")}>
<Tabs value={activeTab} onValueChange={setActiveTab} className="flex flex-1 flex-col">
- <div className="flex min-h-8 items-center justify-between gap-4">
- <TabsList className="h-7 p-0.5 rounded-[7px]">
- <TabsTrigger value="usage" className="h-6 px-2.5 text-xs rounded-[5px]">
+ <div className="flex min-h-10 flex-wrap items-center justify-between gap-4">
+ <TabsList variant="pill">
+ <TabsTrigger value="usage" variant="pill">
{t("insights.yourUsage")}
</TabsTrigger>
- <TabsTrigger value="leaderboard" className="h-6 px-2.5 text-xs rounded-[5px]">
+ <TabsTrigger value="leaderboard" variant="pill">
{t("insights.leaderboard.title")}
</TabsTrigger>
</TabsList>
diff --git a/src/components/chat/ChatView.tsx b/src/components/chat/ChatView.tsx
index 00a9b36b8..c550cccc4 100644
--- a/src/components/chat/ChatView.tsx
+++ b/src/components/chat/ChatView.tsx
@@ -8,59 +8,15 @@ import { ChatInput } from "./ChatInput";
import ConversationList from "./ConversationList";
import { ConfirmDialog } from "../ui/dialog";
import { PAGE_CONTENT_WIDTH_CLASS } from "../ui/pageWidth";
-import { BrandMarkIcon } from "../dictation/BrandMarkIcon";
+import { NewChatEmptyState } from "./NewChatEmptyState";
import { useDialogs } from "../../hooks/useDialogs";
import { getCachedPlatform } from "../../utils/platform";
-import { Check, FileText, Video } from "../icons";
import { observeChatComposerInset } from "./composerLayout";
const CommandSearch = lazy(() => import("../CommandSearch"));
const platform = getCachedPlatform();
-const STARTER_PROMPTS = [
- { key: "chat.starters.todos", icon: Check },
- { key: "chat.starters.meeting", icon: Video },
- { key: "chat.starters.sharedNotes", icon: FileText },
-] as const;
-
-function NewChatEmptyState({
- onPrompt,
- showSuggestions,
- disabled,
-}: {
- onPrompt: (prompt: string) => void;
- showSuggestions: boolean;
- disabled: boolean;
-}) {
- const { t } = useTranslation();
- return (
- <div className="flex h-full min-h-80 flex-col items-center justify-center px-4 pb-[var(--chat-composer-inset,5rem)] text-center">
- <BrandMarkIcon size={64} className="text-foreground/15 dark:text-muted-foreground/35" />
- {showSuggestions && (
- <div className="mt-8 grid w-full max-w-2xl grid-cols-1 gap-3 sm:grid-cols-3">
- {STARTER_PROMPTS.map(({ key, icon: Icon }) => (
- <button
- key={key}
- type="button"
- disabled={disabled}
- onClick={() => onPrompt(t(key))}
- className="flex min-h-24 flex-col items-start justify-between rounded-2xl border border-border bg-card p-4 text-start text-sm font-medium text-foreground transition-colors hover:border-primary/40 hover:bg-primary/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/10"
- >
- <span className="flex h-8 w-8 items-center justify-center rounded-lg bg-muted text-muted-foreground">
- <Icon size={16} />
- </span>
- <span className="max-w-full truncate" title={t(key)}>
- {t(key)}
- </span>
- </button>
- ))}
- </div>
- )}
- </div>
- );
-}
-
export default function ChatView() {
const { t } = useTranslation();
const [activeConversationId, setActiveConversationId] = useState<number | null>(null);
diff --git a/src/components/chat/NewChatEmptyState.tsx b/src/components/chat/NewChatEmptyState.tsx
new file mode 100644
index 000000000..9abe2f681
--- /dev/null
+++ b/src/components/chat/NewChatEmptyState.tsx
@@ -0,0 +1,49 @@
+import { useTranslation } from "react-i18next";
+import { BrandMarkIcon } from "../dictation/BrandMarkIcon";
+import { Check, FileText, Video } from "../icons";
+
+const STARTER_PROMPTS = [
+ { key: "chat.starters.todos", icon: Check },
+ { key: "chat.starters.meeting", icon: Video },
+ { key: "chat.starters.sharedNotes", icon: FileText },
+] as const;
+
+export function NewChatEmptyState({
+ onPrompt,
+ showSuggestions,
+ disabled,
+}: {
+ onPrompt: (prompt: string) => void;
+ showSuggestions: boolean;
+ disabled: boolean;
+}) {
+ const { t } = useTranslation();
+ return (
+ <div className="grid h-full min-h-min grid-rows-[minmax(1rem,1fr)_auto_minmax(min-content,1fr)] justify-items-center px-4 pb-[var(--chat-composer-inset,5rem)] text-center">
+ <BrandMarkIcon
+ size={64}
+ className="row-start-2 text-foreground/15 dark:text-muted-foreground/35"
+ />
+ {showSuggestions && (
+ <div className="row-start-3 mt-8 grid self-start w-full max-w-2xl grid-cols-1 gap-3 sm:grid-cols-3">
+ {STARTER_PROMPTS.map(({ key, icon: Icon }) => (
+ <button
+ key={key}
+ type="button"
+ disabled={disabled}
+ onClick={() => onPrompt(t(key))}
+ className="flex min-h-24 flex-col items-start justify-between rounded-2xl border border-border bg-card p-4 text-start text-sm font-medium text-foreground transition-colors hover:border-primary/40 hover:bg-primary/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/10"
+ >
+ <span className="flex h-8 w-8 items-center justify-center rounded-lg bg-muted text-muted-foreground">
+ <Icon size={16} />
+ </span>
+ <span className="max-w-full truncate" title={t(key)}>
+ {t(key)}
+ </span>
+ </button>
+ ))}
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/src/components/notes/ActionManagerDialog.tsx b/src/components/notes/ActionManagerDialog.tsx
index 56cd1f629..f5c89e072 100644
--- a/src/components/notes/ActionManagerDialog.tsx
+++ b/src/components/notes/ActionManagerDialog.tsx
@@ -216,11 +216,11 @@ export default function ActionManagerDialog({
onValueChange={(value) => showKind(value as ActionKind)}
className="flex-1 min-w-0"
>
- <TabsList className="h-7 w-full px-1 py-0.5">
- <TabsTrigger value="template" className="flex-1 px-2 py-0.5 text-xs">
+ <TabsList variant="pill" className="w-full">
+ <TabsTrigger value="template" variant="pill" className="flex-1 px-2 text-xs">
{t("notes.templates.tab")}
</TabsTrigger>
- <TabsTrigger value="action" className="flex-1 px-2 py-0.5 text-xs">
+ <TabsTrigger value="action" variant="pill" className="flex-1 px-2 text-xs">
{t("notes.actions.tab")}
</TabsTrigger>
</TabsList>
diff --git a/src/components/ui/tabs.tsx b/src/components/ui/tabs.tsx
index c7e0fb8d3..94dff98ab 100644
--- a/src/components/ui/tabs.tsx
+++ b/src/components/ui/tabs.tsx
@@ -7,12 +7,13 @@ const Tabs = TabsPrimitive.Root;
const TabsList = React.forwardRef<
React.ElementRef<typeof TabsPrimitive.List>,
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
->(({ className, ...props }, ref) => (
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & { variant?: "default" | "pill" }
+>(({ className, variant = "default", ...props }, ref) => (
<TabsPrimitive.List
ref={ref}
className={cn(
"inline-flex h-10 items-center justify-center rounded-lg bg-muted dark:bg-surface-raised p-1 text-muted-foreground",
+ variant === "pill" && "rounded-full",
className
)}
{...props}
@@ -22,8 +23,8 @@ TabsList.displayName = TabsPrimitive.List.displayName;
const TabsTrigger = React.forwardRef<
React.ElementRef<typeof TabsPrimitive.Trigger>,
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
->(({ className, ...props }, ref) => (
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger> & { variant?: "default" | "pill" }
+>(({ className, variant = "default", ...props }, ref) => (
<TabsPrimitive.Trigger
ref={ref}
className={cn(
@@ -31,6 +32,7 @@ const TabsTrigger = React.forwardRef<
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
"disabled:pointer-events-none disabled:opacity-50",
"data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:shadow-sm",
+ variant === "pill" && "h-8 gap-2 rounded-full px-4 py-0",
className
)}
{...props}
diff --git a/test/components/chatEmptyState.test.js b/test/components/chatEmptyState.test.js
new file mode 100644
index 000000000..3be06f1ff
--- /dev/null
+++ b/test/components/chatEmptyState.test.js
@@ -0,0 +1,26 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+const React = require("react");
+const { renderToStaticMarkup } = require("react-dom/server");
+const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");
+
+test("new-chat suggestions keep busy state and returning-chat visibility", async (t) => {
+ installBrowserGlobals(t);
+ const server = await createRendererServer(t, {
+ noExternal: ["react-i18next"],
+ mockModules: {
+ "react-i18next": `export const useTranslation = () => ({ t: key => "localized:" + key });`,
+ },
+ });
+ const { NewChatEmptyState } = await server.ssrLoadModule(
+ "/components/chat/NewChatEmptyState.tsx"
+ );
+ const props = { showSuggestions: true, disabled: false, onPrompt: () => {} };
+ const render = (overrides = {}) =>
+ renderToStaticMarkup(React.createElement(NewChatEmptyState, { ...props, ...overrides }));
+ const html = render();
+ assert.equal((html.match(/<button/g) ?? []).length, 3);
+ assert.doesNotMatch(html, /disabled=""/);
+ assert.equal((render({ disabled: true }).match(/disabled=""/g) ?? []).length, 3);
+ assert.doesNotMatch(render({ showSuggestions: false }), /<button/);
+});
diff --git a/test/components/leaderboardNavigation.test.js b/test/components/leaderboardNavigation.test.js
index 934f989ed..34f2a35e4 100644
--- a/test/components/leaderboardNavigation.test.js
+++ b/test/components/leaderboardNavigation.test.js
@@ -21,8 +21,6 @@ test("the leaderboard is tabbed inside the Insights view", () => {
assert.ok(insights.includes('value="usage"'));
assert.ok(insights.includes('t("insights.yourUsage")'));
assert.ok(insights.includes('value="leaderboard"'));
- assert.ok(insights.includes('className="h-7 p-0.5 rounded-[7px]"'));
- assert.ok(insights.includes('className="h-6 px-2.5 text-xs rounded-[5px]"'));
assert.ok(insights.includes("<LeaderboardView"));
assert.ok(insights.includes("syncService.syncAnalyticsNow()"));
assert.ok(insights.includes("const authValidated = hasValidatedAuthContext()"));