feat: introduced a token-based theming system across the UI
* feat: added themes system * feat: smart sidebar auto-hide for files/diff tabs + lower files sidebar threshold * feat: added Checkbox component and update theming - Add reusable Checkbox component for toggles across UI - Replace several inputs with Checkbox in settings and commands panels - Add DiffIcon and apply surface/border theming to key UI areas * feat: Add convert-vscode-theme.cjs to convert VS Code themes to OpenChamber format * refactor: remove unused permission logic from ChatInput - Remove unused permission rules parsing logic from ChatInput - Memoize renderTheme in DiffWorkerProvider to avoid unnecessary recalculations - Remove forceOpaque helper in vscode theme adapter * fix: guard VSCode theme loading in MarkdownRenderer * feat: add custom user themes loading and reload - Load user themes from ~/.config/openchamber/themes at runtime - Expose /api/config/themes to fetch custom themes - Allow theme reloading from Settings → Theme → Reload themes in the UI
This commit is contained in:
committed by
GitHub
parent
5bb2c56bc0
commit
ddedc02687
@@ -27,6 +27,7 @@ interface UIStore {
|
||||
isSessionSwitcherOpen: boolean;
|
||||
activeMainTab: MainTab;
|
||||
mainTabGuard: MainTabGuard | null;
|
||||
sidebarOpenBeforeFullscreenTab: boolean | null;
|
||||
pendingDiffFile: string | null;
|
||||
isMobile: boolean;
|
||||
isKeyboardOpen: boolean;
|
||||
@@ -144,6 +145,7 @@ export const useUIStore = create<UIStore>()(
|
||||
isSessionSwitcherOpen: false,
|
||||
activeMainTab: 'chat',
|
||||
mainTabGuard: null,
|
||||
sidebarOpenBeforeFullscreenTab: null,
|
||||
pendingDiffFile: null,
|
||||
isMobile: false,
|
||||
isKeyboardOpen: false,
|
||||
@@ -238,7 +240,36 @@ export const useUIStore = create<UIStore>()(
|
||||
if (guard && !guard(tab)) {
|
||||
return;
|
||||
}
|
||||
set({ activeMainTab: tab });
|
||||
const state = get();
|
||||
const currentTab = state.activeMainTab;
|
||||
const fullscreenTabs: MainTab[] = ['files', 'diff'];
|
||||
const isEnteringFullscreen = fullscreenTabs.includes(tab) && !fullscreenTabs.includes(currentTab);
|
||||
const isLeavingFullscreen = !fullscreenTabs.includes(tab) && fullscreenTabs.includes(currentTab);
|
||||
|
||||
if (isEnteringFullscreen) {
|
||||
// Save current sidebar state and close it
|
||||
set({
|
||||
activeMainTab: tab,
|
||||
sidebarOpenBeforeFullscreenTab: state.isSidebarOpen,
|
||||
isSidebarOpen: false,
|
||||
});
|
||||
} else if (isLeavingFullscreen) {
|
||||
// Restore sidebar state if it was open before
|
||||
const shouldRestore = state.sidebarOpenBeforeFullscreenTab === true;
|
||||
set({
|
||||
activeMainTab: tab,
|
||||
sidebarOpenBeforeFullscreenTab: null,
|
||||
...(shouldRestore && typeof window !== 'undefined'
|
||||
? {
|
||||
isSidebarOpen: true,
|
||||
sidebarWidth: Math.floor(window.innerWidth * 0.2),
|
||||
hasManuallyResizedLeftSidebar: false,
|
||||
}
|
||||
: {}),
|
||||
});
|
||||
} else {
|
||||
set({ activeMainTab: tab });
|
||||
}
|
||||
},
|
||||
|
||||
setPendingDiffFile: (filePath) => {
|
||||
@@ -250,7 +281,21 @@ export const useUIStore = create<UIStore>()(
|
||||
if (guard && !guard('diff')) {
|
||||
return;
|
||||
}
|
||||
set({ pendingDiffFile: filePath, activeMainTab: 'diff' });
|
||||
const state = get();
|
||||
const currentTab = state.activeMainTab;
|
||||
const fullscreenTabs: MainTab[] = ['files', 'diff'];
|
||||
const isEnteringFullscreen = !fullscreenTabs.includes(currentTab);
|
||||
|
||||
if (isEnteringFullscreen) {
|
||||
set({
|
||||
pendingDiffFile: filePath,
|
||||
activeMainTab: 'diff',
|
||||
sidebarOpenBeforeFullscreenTab: state.isSidebarOpen,
|
||||
isSidebarOpen: false,
|
||||
});
|
||||
} else {
|
||||
set({ pendingDiffFile: filePath, activeMainTab: 'diff' });
|
||||
}
|
||||
},
|
||||
|
||||
consumePendingDiffFile: () => {
|
||||
|
||||
Reference in New Issue
Block a user