Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions apps/desktop/src/renderer/src/components/ThemeToggle.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { useT } from '@open-codesign/i18n';
import { IconButton, Tooltip } from '@open-codesign/ui';
import { Moon, Sun } from 'lucide-react';
import { useCodesignStore } from '../store';

export function ThemeToggle() {
const t = useT();
const theme = useCodesignStore((s) => s.theme);
const toggle = useCodesignStore((s) => s.toggleTheme);
const isDark = theme === 'dark';
return (
<Tooltip label={isDark ? 'Switch to light' : 'Switch to dark'}>
<IconButton label="Toggle theme" size="sm" onClick={toggle}>
<Tooltip label={isDark ? t('theme.switchToLight') : t('theme.switchToDark')}>
<IconButton label={t('theme.toggleAria')} size="sm" onClick={toggle}>
{isDark ? <Sun className="w-4 h-4" /> : <Moon className="w-4 h-4" />}
</IconButton>
</Tooltip>
Expand Down
5 changes: 5 additions & 0 deletions packages/i18n/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@
"byokTitle": "BYOK — bring-your-own-key. Full usage tracking coming soon.",
"spendTooltip": "Spending this week (full tracking coming soon)"
},
"theme": {
"toggleAria": "Toggle theme",
"switchToLight": "Switch to light",
"switchToDark": "Switch to dark"
},
"commands": {
"title": "Commands",
"placeholder": "Type a command or search…",
Expand Down
5 changes: 5 additions & 0 deletions packages/i18n/src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@
"byokTitle": "BYOK — 自带密钥,完整用量统计即将上线。",
"spendTooltip": "本周花费(完整统计即将上线)"
},
"theme": {
"toggleAria": "切换主题",
"switchToLight": "切换到浅色",
"switchToDark": "切换到深色"
},
"commands": {
"title": "命令面板",
"placeholder": "输入命令或搜索…",
Expand Down
Loading