Skip to content

Commit 7c7bab0

Browse files
committed
Add sidebar-tab hotkey and scrollbar styles
Add styling for .current-box-list scrollbars (hide horizontal overflow, stable gutter, thin scrollbar, and custom colors for Firefox/WebKit) and refine track/thumb visuals. Introduce SIDEBAR_TAB_VIEWS constant and a new hotkey action 'switchSidebarTab' (default binding: Tab). Implement selectNextSidebarTab to rotate between 'main' and 'plugins' views and wire it into the global hotkey handler, respecting sidebar visibility and preventing default behavior when used.
1 parent 71a6754 commit 7c7bab0

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

frontend/src/App.css

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2390,7 +2390,24 @@
23902390
display: grid;
23912391
gap: 4px;
23922392
max-height: min(22svh, 220px);
2393-
overflow: auto;
2393+
overflow-x: hidden;
2394+
overflow-y: auto;
2395+
scrollbar-gutter: stable;
2396+
scrollbar-width: thin;
2397+
scrollbar-color: rgba(255, 255, 255, 0.34) rgba(255, 255, 255, 0.04);
2398+
}
2399+
2400+
.current-box-list::-webkit-scrollbar {
2401+
width: 8px;
2402+
}
2403+
2404+
.current-box-list::-webkit-scrollbar-track {
2405+
background: rgba(255, 255, 255, 0.04);
2406+
}
2407+
2408+
.current-box-list::-webkit-scrollbar-thumb {
2409+
background: rgba(255, 255, 255, 0.28);
2410+
border: 2px solid rgba(5, 5, 5, 0.92);
23942411
}
23952412

23962413
.current-box-row {

frontend/src/App.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ type ViewportTool = 'draw' | 'new-box' | 'sam-click' | 'sam-box'
8484
type SidebarView = 'main' | 'info' | 'plugins'
8585
type ProjectInfoStatus = 'idle' | 'loading' | 'error'
8686

87+
const SIDEBAR_TAB_VIEWS: readonly SidebarView[] = ['main', 'plugins']
88+
8789
type PendingImageLoad = {
8890
promise: Promise<void>
8991
cancel: () => void
@@ -177,6 +179,13 @@ const HOTKEY_ACTIONS = [
177179
description: 'Go to the next image',
178180
defaultBindings: ['D', 'ArrowRight'],
179181
},
182+
{
183+
id: 'switchSidebarTab',
184+
section: 'Navigation',
185+
title: 'Switch sidebar tab',
186+
description: 'Switch between Main Menu and Plugins',
187+
defaultBindings: ['Tab'],
188+
},
180189
{
181190
id: 'deleteSelection',
182191
section: 'Annotation',
@@ -2950,6 +2959,13 @@ function App() {
29502959
}
29512960
}
29522961

2962+
const selectNextSidebarTab = () => {
2963+
const currentIndex = SIDEBAR_TAB_VIEWS.indexOf(sidebarView)
2964+
const nextIndex =
2965+
currentIndex >= 0 ? (currentIndex + 1) % SIDEBAR_TAB_VIEWS.length : 0
2966+
selectSidebarView(SIDEBAR_TAB_VIEWS[nextIndex] ?? 'main')
2967+
}
2968+
29532969
const openProjectInfo = () => {
29542970
setOpenMenu(null)
29552971
setIsSidebarVisible(true)
@@ -4295,6 +4311,16 @@ function App() {
42954311
if (matchesHotkeyAction(event, 'nextImage')) {
42964312
event.preventDefault()
42974313
goNextImage()
4314+
return
4315+
}
4316+
4317+
if (matchesHotkeyAction(event, 'switchSidebarTab')) {
4318+
if (!isSidebarVisible) {
4319+
return
4320+
}
4321+
4322+
event.preventDefault()
4323+
selectNextSidebarTab()
42984324
}
42994325
})
43004326

0 commit comments

Comments
 (0)