feat(ui): let users hide context rail surfaces

A trailing configure button on the rail — outside the sortable list and the
digit shortcuts — opens a dialog that toggles each surface. The choice is
stored as the hidden set so newly added surfaces appear for everyone, and
the rail and the mod+alt+digit switcher share the same visibility filter, so
badges and shortcuts always agree. Hidden surfaces keep their data and stay
reachable from the command palette.
This commit is contained in:
Bohdan Triapitsyn
2026-08-26 16:18:15 +03:00
parent f2ec9b1003
commit 2e49e44205
17 changed files with 195 additions and 2 deletions
+5
View File
@@ -2995,6 +2995,11 @@ export const dict = {
'gitView.pr.segment.comments': 'Kommentare',
'gitView.pr.comments.addAll': 'Alle hinzufügen',
'contextPanel.mode.pr': 'PR',
'contextRail.configure.open': 'Panels konfigurieren',
'contextRail.configure.dialogTitle': 'Leisten-Panels',
'contextRail.configure.dialogDescription': 'Wähle, welche Panels die Leiste zeigt. Ausgeblendete Panels behalten ihre Daten und bleiben über die Befehlspalette erreichbar.',
'contextRail.configure.showAll': 'Alle anzeigen',
'contextRail.configure.noneWarning': 'Alle Panels sind ausgeblendet.',
'contextRail.aria.rail': 'Kontextleiste',
'contextPanel.editorEmpty.title': 'Kein Kontext ausgewählt',
'contextPanel.editorEmpty.description': 'Wählen Sie etwas aus der Seitenleiste aus, um Kontext anzuzeigen.',
+5
View File
@@ -1139,6 +1139,11 @@ export const dict = {
'contextPanel.mode.context': 'Context',
'contextPanel.mode.preview': 'Preview',
'contextPanel.mode.browser': 'Browser',
'contextRail.configure.open': 'Configure panels',
'contextRail.configure.dialogTitle': 'Rail panels',
'contextRail.configure.dialogDescription': 'Choose which panels the rail shows. Hidden panels keep their data and stay reachable from the command palette.',
'contextRail.configure.showAll': 'Show all',
'contextRail.configure.noneWarning': 'All panels are hidden.',
'contextRail.aria.rail': 'Panel surfaces',
'contextPanel.editorEmpty.title': 'No file open',
'contextPanel.editorEmpty.description': 'Pick a file from the tree to start editing.',
+5
View File
@@ -1140,6 +1140,11 @@ export const dict: Record<I18nKey, string> = {
"contextPanel.mode.context": "Contexto",
"contextPanel.mode.preview": "Vista previa",
"contextPanel.mode.browser": "Navegador",
"contextRail.configure.open": "Configurar paneles",
"contextRail.configure.dialogTitle": "Paneles de la barra",
"contextRail.configure.dialogDescription": "Elige qué paneles muestra la barra. Los paneles ocultos conservan sus datos y siguen accesibles desde la paleta de comandos.",
"contextRail.configure.showAll": "Mostrar todos",
"contextRail.configure.noneWarning": "Todos los paneles están ocultos.",
"contextRail.aria.rail": "Superficies del panel",
"contextPanel.editorEmpty.title": "Ningún archivo abierto",
"contextPanel.editorEmpty.description": "Elige un archivo del árbol para empezar a editar.",
+5
View File
@@ -959,6 +959,11 @@ export const dict = {
'contextPanel.mode.context': 'Contexte',
'contextPanel.mode.preview': 'Aperçu',
'contextPanel.mode.browser': 'Navigateur',
'contextRail.configure.open': 'Configurer les panneaux',
'contextRail.configure.dialogTitle': 'Panneaux de la barre',
'contextRail.configure.dialogDescription': 'Choisissez les panneaux affichés par la barre. Les panneaux masqués conservent leurs données et restent accessibles via la palette de commandes.',
'contextRail.configure.showAll': 'Tout afficher',
'contextRail.configure.noneWarning': 'Tous les panneaux sont masqués.',
'contextRail.aria.rail': 'Surfaces du panneau',
'contextPanel.editorEmpty.title': 'Aucun fichier ouvert',
'contextPanel.editorEmpty.description': 'Choisissez un fichier dans larborescence pour commencer.',
+5
View File
@@ -1136,6 +1136,11 @@ export const dict: Record<I18nKey, string> = {
'contextPanel.mode.context': 'コンテキスト',
'contextPanel.mode.preview': 'プレビュー',
'contextPanel.mode.browser': 'ブラウザ',
'contextRail.configure.open': 'パネルを設定',
'contextRail.configure.dialogTitle': 'レールのパネル',
'contextRail.configure.dialogDescription': 'レールに表示するパネルを選択します。非表示のパネルもデータは保持され、コマンドパレットから引き続き開けます。',
'contextRail.configure.showAll': 'すべて表示',
'contextRail.configure.noneWarning': 'すべてのパネルが非表示です。',
'contextRail.aria.rail': 'パネルサーフェス',
'contextPanel.editorEmpty.title': 'ファイルが開かれていません',
'contextPanel.editorEmpty.description': 'ツリーからファイルを選んで編集を始めましょう。',
+5
View File
@@ -1140,6 +1140,11 @@ export const dict: Record<I18nKey, string> = {
'contextPanel.mode.context': '컨텍스트',
'contextPanel.mode.preview': '미리보기',
'contextPanel.mode.browser': '브라우저',
'contextRail.configure.open': '패널 구성',
'contextRail.configure.dialogTitle': '레일 패널',
'contextRail.configure.dialogDescription': '레일에 표시할 패널을 선택하세요. 숨긴 패널의 데이터는 유지되며 명령 팔레트에서 계속 열 수 있습니다.',
'contextRail.configure.showAll': '모두 표시',
'contextRail.configure.noneWarning': '모든 패널이 숨겨져 있습니다.',
'contextRail.aria.rail': '패널 서피스',
'contextPanel.editorEmpty.title': '열린 파일 없음',
'contextPanel.editorEmpty.description': '트리에서 파일을 선택해 편집을 시작하세요.',
+5
View File
@@ -1478,6 +1478,11 @@ export const dict: Record<I18nKey, string> = {
'contextPanel.mode.pr': 'Pull Request',
'contextPanel.mode.preview': 'Podgląd',
'contextPanel.mode.browser': 'Przeglądarka',
'contextRail.configure.open': 'Konfiguruj panele',
'contextRail.configure.dialogTitle': 'Panele paska',
'contextRail.configure.dialogDescription': 'Wybierz, które panele pokazuje pasek. Ukryte panele zachowują dane i pozostają dostępne z palety poleceń.',
'contextRail.configure.showAll': 'Pokaż wszystkie',
'contextRail.configure.noneWarning': 'Wszystkie panele są ukryte.',
'contextRail.aria.rail': 'Powierzchnie panelu',
'contextPanel.editorEmpty.title': 'Brak otwartego pliku',
'contextPanel.editorEmpty.description': 'Wybierz plik z drzewa, aby rozpocząć edycję.',
@@ -1140,6 +1140,11 @@ export const dict: Record<I18nKey, string> = {
"contextPanel.mode.context": "Contexto",
"contextPanel.mode.preview": "Prévia",
"contextPanel.mode.browser": "Navegador",
"contextRail.configure.open": "Configurar painéis",
"contextRail.configure.dialogTitle": "Painéis da barra",
"contextRail.configure.dialogDescription": "Escolha quais painéis a barra mostra. Painéis ocultos mantêm seus dados e continuam acessíveis pela paleta de comandos.",
"contextRail.configure.showAll": "Mostrar todos",
"contextRail.configure.noneWarning": "Todos os painéis estão ocultos.",
"contextRail.aria.rail": "Superfícies do painel",
"contextPanel.editorEmpty.title": "Nenhum arquivo aberto",
"contextPanel.editorEmpty.description": "Escolha um arquivo na árvore para começar a editar.",
+5
View File
@@ -1140,6 +1140,11 @@ export const dict: Record<I18nKey, string> = {
"contextPanel.mode.context": "Контекст",
"contextPanel.mode.preview": "Перегляд",
"contextPanel.mode.browser": "Браузер",
"contextRail.configure.open": "Налаштувати панелі",
"contextRail.configure.dialogTitle": "Панелі рейки",
"contextRail.configure.dialogDescription": "Обери, які панелі показує рейка. Приховані панелі зберігають дані й доступні з палітри команд.",
"contextRail.configure.showAll": "Показати всі",
"contextRail.configure.noneWarning": "Усі панелі приховано.",
"contextRail.aria.rail": "Поверхні панелі",
"contextPanel.editorEmpty.title": "Файл не відкрито",
"contextPanel.editorEmpty.description": "Виберіть файл у дереві, щоб почати редагування.",
@@ -1140,6 +1140,11 @@ export const dict: Record<I18nKey, string> = {
'contextPanel.mode.context': '上下文',
'contextPanel.mode.preview': '预览',
'contextPanel.mode.browser': '浏览器',
'contextRail.configure.open': '配置面板',
'contextRail.configure.dialogTitle': '侧栏面板',
'contextRail.configure.dialogDescription': '选择侧栏显示哪些面板。隐藏的面板会保留数据,仍可通过命令面板打开。',
'contextRail.configure.showAll': '全部显示',
'contextRail.configure.noneWarning': '所有面板均已隐藏。',
'contextRail.aria.rail': '面板界面',
'contextPanel.editorEmpty.title': '未打开文件',
'contextPanel.editorEmpty.description': '从文件树中选择一个文件开始编辑。',
@@ -1152,6 +1152,11 @@ export const dict: Record<I18nKey, string> = {
'contextPanel.mode.context': '上下文',
'contextPanel.mode.preview': '預覽',
'contextPanel.mode.browser': '瀏覽器',
'contextRail.configure.open': '設定面板',
'contextRail.configure.dialogTitle': '側欄面板',
'contextRail.configure.dialogDescription': '選擇側欄顯示哪些面板。隱藏的面板會保留資料,仍可透過命令面板開啟。',
'contextRail.configure.showAll': '全部顯示',
'contextRail.configure.noneWarning': '所有面板皆已隱藏。',
'contextRail.aria.rail': '面板介面',
'contextPanel.editorEmpty.title': '未開啟檔案',
'contextPanel.editorEmpty.description': '從檔案樹選擇檔案開始編輯。',
@@ -22,7 +22,10 @@ edge (`components/layout/ContextPanelRail.tsx`) and rendered by
registry's default order and appends any missing surfaces.
- `getVisibleContextRailSurfaces` is the single visibility filter shared by the
rail and the global surface-switch shortcut (`switch_context_surface` in
`lib/shortcuts.ts`): it drops the plan surface unless plan mode is enabled,
`lib/shortcuts`): it drops surfaces the user hid
(`useUIStore.contextRailHiddenSurfaces`, edited from the rail's trailing
configure button — `ContextRailSurfacesDialog`), drops the plan surface
unless plan mode is enabled,
drops the walkthrough on VS Code and below `WALKTHROUGH_MIN_WIDTH`, and hides
`has-content` surfaces until a tab of their mode exists. Both consumers use
it so the digit shown on a rail badge always maps to the same surface the
+6
View File
@@ -187,6 +187,9 @@ export const sortContextSurfaces = (railOrder: readonly string[]): ContextSurfac
type VisibleRailSurfacesOptions = {
railOrder: readonly string[];
/** Surfaces the user chose to hide from the rail (and from the digit
shortcuts, which share this filter). */
hiddenSurfaces?: readonly string[];
planModeEnabled: boolean;
isVSCode: boolean;
screenWidth: number;
@@ -203,6 +206,9 @@ type VisibleRailSurfacesOptions = {
*/
export const getVisibleContextRailSurfaces = (options: VisibleRailSurfacesOptions): ContextSurfaceDescriptor[] => {
return sortContextSurfaces(options.railOrder).filter((surface) => {
if (options.hiddenSurfaces?.includes(surface.id)) {
return false;
}
if (surface.id === 'plan' && !options.planModeEnabled) {
return false;
}