Skip to content

Commit c8795f2

Browse files
committed
fix(provider): update references from "Claude" to "Provider" for consistency
- Changed all instances of the tray icon style from "Claude" to "Provider" in tests and settings for clarity. - Updated the App component to pass the provider icon URL. - Adjusted the tray icon rendering logic to improve visual consistency and functionality.
1 parent 8b0022a commit c8795f2

File tree

6 files changed

+47
-19
lines changed

6 files changed

+47
-19
lines changed

src/App.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ describe("App", () => {
532532
const settingsButtons = await screen.findAllByRole("button", { name: "Settings" })
533533
await userEvent.click(settingsButtons[0])
534534

535-
await userEvent.click(await screen.findByRole("radio", { name: "Claude" }))
535+
await userEvent.click(await screen.findByRole("radio", { name: "Provider" }))
536536
expect(state.saveTrayIconStyleMock).toHaveBeenCalledWith("provider")
537537
expect(state.saveTrayShowPercentageMock).toHaveBeenCalledWith(true)
538538
})
@@ -559,7 +559,7 @@ describe("App", () => {
559559
expect(textOnlyCheckbox).toHaveAttribute("aria-disabled", "true")
560560
expect(textOnlyCheckbox).toBeChecked()
561561

562-
await userEvent.click(await screen.findByRole("radio", { name: "Claude" }))
562+
await userEvent.click(await screen.findByRole("radio", { name: "Provider" }))
563563
const providerCheckbox = getTrayCheckbox()
564564
expect(providerCheckbox).toBeVisible()
565565
expect(providerCheckbox).toHaveAttribute("aria-disabled", "true")

src/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,7 @@ function App() {
786786
onTrayIconStyleChange={handleTrayIconStyleChange}
787787
trayShowPercentage={trayShowPercentage}
788788
onTrayShowPercentageChange={handleTrayShowPercentageChange}
789+
providerIconUrl={navPlugins[0]?.iconUrl}
789790
/>
790791
)
791792
}

src/lib/settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const DISPLAY_MODE_OPTIONS: { value: DisplayMode; label: string }[] = [
5757
export const TRAY_ICON_STYLE_OPTIONS: { value: TrayIconStyle; label: string }[] = [
5858
{ value: "bars", label: "Bars" },
5959
{ value: "circle", label: "Circle" },
60-
{ value: "provider", label: "Claude" },
60+
{ value: "provider", label: "Provider" },
6161
{ value: "textOnly", label: "%" },
6262
];
6363

src/lib/tray-bars-icon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ export function makeTrayBarsSvg(args: {
243243
}
244244
}
245245
} else if (style === "provider") {
246-
const iconSize = Math.max(6, sizePx - 2 * layout.pad)
246+
const iconSize = Math.max(6, Math.round(sizePx - 2 * layout.pad * 0.5))
247247
const x = layout.barsX
248248
const y = Math.round((height - iconSize) / 2) + 1
249249
const href = typeof providerIconUrl === "string" ? providerIconUrl.trim() : ""

src/pages/settings.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ describe("SettingsPage", () => {
131131
expect(screen.getByText("How obsessive are you")).toBeInTheDocument()
132132
})
133133

134-
it("renders appearance section with theme options", () => {
134+
it("renders app theme section with theme options", () => {
135135
render(<SettingsPage {...defaultProps} />)
136-
expect(screen.getByText("Appearance")).toBeInTheDocument()
136+
expect(screen.getByText("App Theme")).toBeInTheDocument()
137137
expect(screen.getByText("How it looks around here")).toBeInTheDocument()
138138
expect(screen.getByText("System")).toBeInTheDocument()
139139
expect(screen.getByText("Light")).toBeInTheDocument()
@@ -166,17 +166,17 @@ describe("SettingsPage", () => {
166166

167167
it("renders tray icon style section", () => {
168168
render(<SettingsPage {...defaultProps} />)
169-
expect(screen.getByText("Menu Bar Icon")).toBeInTheDocument()
169+
expect(screen.getByText("Bar Icon")).toBeInTheDocument()
170170
expect(screen.getByText("The little guy up top")).toBeInTheDocument()
171171
expect(screen.getByRole("radio", { name: "Bars" })).toBeInTheDocument()
172172
expect(screen.getByRole("radio", { name: "Circle" })).toBeInTheDocument()
173-
expect(screen.getByRole("radio", { name: "Claude" })).toBeInTheDocument()
173+
expect(screen.getByRole("radio", { name: "Provider" })).toBeInTheDocument()
174174
expect(screen.getByRole("radio", { name: "%" })).toBeInTheDocument()
175175
})
176176

177177
it("renders renamed usage section heading", () => {
178178
render(<SettingsPage {...defaultProps} />)
179-
expect(screen.getByText("Show Usage As")).toBeInTheDocument()
179+
expect(screen.getByText("Usage Mode")).toBeInTheDocument()
180180
})
181181

182182
it("updates tray icon style", async () => {
@@ -211,7 +211,7 @@ describe("SettingsPage", () => {
211211
onTrayIconStyleChange={onTrayIconStyleChange}
212212
/>
213213
)
214-
await userEvent.click(screen.getByRole("radio", { name: "Claude" }))
214+
await userEvent.click(screen.getByRole("radio", { name: "Provider" }))
215215
expect(onTrayIconStyleChange).toHaveBeenCalledWith("provider")
216216
})
217217

src/pages/settings.tsx

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
DISPLAY_MODE_OPTIONS,
2424
TRAY_ICON_STYLE_OPTIONS,
2525
THEME_OPTIONS,
26+
isTrayPercentageMandatory,
2627
type AutoUpdateIntervalMinutes,
2728
type DisplayMode,
2829
type ThemeMode,
@@ -74,9 +75,11 @@ function getPreviewBarLayout(fraction: number): { fillPercent: number; remainder
7475
function TrayIconStylePreview({
7576
style,
7677
isActive,
78+
providerIconUrl,
7779
}: {
7880
style: TrayIconStyle;
7981
isActive: boolean;
82+
providerIconUrl?: string;
8083
}) {
8184
const trackClass = isActive ? "bg-primary-foreground/30" : "bg-foreground/15";
8285
const remainderClass = isActive ? "bg-primary-foreground/55" : "bg-foreground/25";
@@ -151,11 +154,33 @@ function TrayIconStylePreview({
151154
}
152155

153156
if (style === "provider") {
157+
if (providerIconUrl) {
158+
return (
159+
<div
160+
aria-hidden
161+
className={cn(
162+
"w-[18px] h-[18px] shrink-0",
163+
isActive ? "bg-primary-foreground" : "bg-foreground"
164+
)}
165+
style={{
166+
WebkitMaskImage: `url(${providerIconUrl})`,
167+
WebkitMaskSize: "contain",
168+
WebkitMaskRepeat: "no-repeat",
169+
WebkitMaskPosition: "center",
170+
maskImage: `url(${providerIconUrl})`,
171+
maskSize: "contain",
172+
maskRepeat: "no-repeat",
173+
maskPosition: "center",
174+
}}
175+
/>
176+
);
177+
}
178+
// Fallback: generic provider icon (Anthropic logo)
154179
return (
155180
<svg
156181
aria-hidden
157-
width="13"
158-
height="13"
182+
width="18"
183+
height="18"
159184
viewBox="0 0 100 100"
160185
className={cn("shrink-0", textClass)}
161186
>
@@ -246,6 +271,7 @@ interface SettingsPageProps {
246271
onTrayIconStyleChange: (value: TrayIconStyle) => void;
247272
trayShowPercentage: boolean;
248273
onTrayShowPercentageChange: (value: boolean) => void;
274+
providerIconUrl?: string;
249275
}
250276

251277
export function SettingsPage({
@@ -262,10 +288,10 @@ export function SettingsPage({
262288
onTrayIconStyleChange,
263289
trayShowPercentage,
264290
onTrayShowPercentageChange,
291+
providerIconUrl,
265292
}: SettingsPageProps) {
266-
const isTrayPercentageMandatory =
267-
trayIconStyle === "provider" || trayIconStyle === "textOnly";
268-
const trayShowPercentageChecked = isTrayPercentageMandatory
293+
const percentageMandatory = isTrayPercentageMandatory(trayIconStyle);
294+
const trayShowPercentageChecked = percentageMandatory
269295
? true
270296
: trayShowPercentage;
271297

@@ -368,6 +394,7 @@ export function SettingsPage({
368394
<TrayIconStylePreview
369395
style={option.value}
370396
isActive={isActive}
397+
providerIconUrl={option.value === "provider" ? providerIconUrl : undefined}
371398
/>
372399
</Button>
373400
);
@@ -377,17 +404,17 @@ export function SettingsPage({
377404
<label
378405
className={cn(
379406
"mt-2 flex items-center gap-2 text-sm select-none",
380-
isTrayPercentageMandatory
407+
percentageMandatory
381408
? "text-muted-foreground cursor-not-allowed"
382409
: "text-foreground"
383410
)}
384411
>
385412
<Checkbox
386-
key={`tray-pct-${trayShowPercentageChecked}-${isTrayPercentageMandatory}`}
413+
key={`tray-pct-${trayShowPercentageChecked}-${percentageMandatory}`}
387414
checked={trayShowPercentageChecked}
388-
disabled={isTrayPercentageMandatory}
415+
disabled={percentageMandatory}
389416
onCheckedChange={(checked) => {
390-
if (isTrayPercentageMandatory) return;
417+
if (percentageMandatory) return;
391418
onTrayShowPercentageChange(checked === true);
392419
}}
393420
/>

0 commit comments

Comments
 (0)