Replace dashboard tabs with one selector

A tab per dashboard pushed the board controls onto a second row and
grew with every board added. The bar now carries a single selector
that lists the dashboards, with New, Rename and Delete in its menu, so
the whole bar stays on one line. Dashboard layout baselines updated.
This commit is contained in:
Juan Denis committed 2026-11-14 13:40:13 -05:00
1 parent 1183dbb99c
commit 4e6f47da1c
24 files changed
+104 -113

No files matched your search

-1
View File
@@ -1664,7 +1664,6 @@
"couldNotReset": "لا يمكن إعادة التعيين",
"couldNotSave": "لا يمكن الحفظ",
"dashboardSaved": "تم حفظ لوحة المعلومات",
"delete": "حذف {{name}}",
"deleteRemovesIt": "يؤدي الحذف إلى إزالتها",
"discard": "ينبذ",
"dragHeadersToMoveDragThe": "اسحب الرؤوس للتحرك · اسحب الزاوية لتغيير حجمها · انقر فوق عنصر واجهة المستخدم لتكوينه",
-1
View File
@@ -1664,7 +1664,6 @@
"couldNotReset": "রিসেট করা যায়নি",
"couldNotSave": "বাঁচাতে পারেনি",
"dashboardSaved": "ড্যাশবোর্ড সংরক্ষিত",
"delete": "{{name}} মুছুন",
"deleteRemovesIt": "মুছলে এটি সরানো হয়",
"discard": "বাতিল করুন",
"dragHeadersToMoveDragThe": "সরাতে হেডার টেনে আনুন · আকার পরিবর্তন করতে কোণে টেনে আনুন · এটি কনফিগার করতে একটি উইজেট ক্লিক করুন",
-1
View File
@@ -1664,7 +1664,6 @@
"couldNotReset": "Konnte nicht zurückgesetzt werden",
"couldNotSave": "Konnte nicht gespeichert werden",
"dashboardSaved": "Dashboard gespeichert",
"delete": "{{name}} löschen",
"deleteRemovesIt": "Löschen entfernt es",
"discard": "Verwerfen",
"dragHeadersToMoveDragThe": "Ziehen Sie die Kopfzeilen, um sie zu verschieben. Ziehen Sie die Ecke, um die Größe zu ändern. Klicken Sie auf ein Widget, um es zu konfigurieren",
+5 -1
View File
@@ -1704,8 +1704,10 @@
"buildThisDashboard": "Build this dashboard",
"couldNotReset": "Couldn't reset the board.",
"couldNotSave": "Couldn't save the board.",
"dashboardName": "Dashboard name",
"dashboardSaved": "Dashboard saved",
"delete": "Delete {{name}}",
"dashboards": "Dashboards",
"deleteDashboard": "Delete dashboard",
"deleteRemovesIt": "Delete removes it",
"discard": "Discard",
"dragHeadersToMoveDragThe": "Drag headers to move · drag the corner to resize · click a widget to configure it",
@@ -1718,9 +1720,11 @@
"reconnecting": "Reconnecting",
"refresh": "· refresh",
"refreshNow": "Refresh now",
"renameDashboard": "Rename dashboard",
"resetToTheShippedLayout": "Reset to the shipped layout",
"restoreDefaultLayout": "Restore default layout",
"restoreTheShippedLayout": "Restore the shipped layout",
"switchDashboard": "Switch dashboard",
"switchServer": "Switch server",
"thisBoardHasNoShippedDefault": "This board has no shipped default.",
"thisBoardHasNoWidgetsYet": "This board has no widgets yet. Add one, or restore the layout it shipped with.",
-1
View File
@@ -1664,7 +1664,6 @@
"couldNotReset": "No se pudo restablecer",
"couldNotSave": "No se pudo guardar",
"dashboardSaved": "Panel guardado",
"delete": "Eliminar {{name}}",
"deleteRemovesIt": "Eliminar lo quita",
"discard": "Descartar",
"dragHeadersToMoveDragThe": "Arrastra los encabezados para mover · arrastra la esquina para redimensionar · haz clic en un widget para configurarlo",
-1
View File
@@ -1664,7 +1664,6 @@
"couldNotReset": "Impossible de réinitialiser",
"couldNotSave": "Impossible d'enregistrer",
"dashboardSaved": "Tableau de bord enregistré",
"delete": "Supprimer {{name}}",
"deleteRemovesIt": "Supprimer le retire",
"discard": "Jeter",
"dragHeadersToMoveDragThe": "Faites glisser les en-têtes pour déplacer · faites glisser le coin pour redimensionner · cliquez sur un widget pour le configurer",
-1
View File
@@ -1664,7 +1664,6 @@
"couldNotReset": "Tidak dapat menyetel ulang",
"couldNotSave": "Tidak dapat menyimpan",
"dashboardSaved": "Dasbor disimpan",
"delete": "Hapus {{name}}",
"deleteRemovesIt": "Hapus akan menghilangkannya",
"discard": "Membuang",
"dragHeadersToMoveDragThe": "Seret header untuk dipindahkan · seret sudut untuk mengubah ukurannya · klik widget untuk mengonfigurasinya",
-1
View File
@@ -1664,7 +1664,6 @@
"couldNotReset": "Impossibile reimpostare",
"couldNotSave": "Impossibile salvare",
"dashboardSaved": "Pannello di controllo salvato",
"delete": "Elimina {{name}}",
"deleteRemovesIt": "Elimina la rimuove",
"discard": "Scartare",
"dragHeadersToMoveDragThe": "Trascina le intestazioni per spostare · trascina l'angolo per ridimensionare · fai clic su un widget per configurarlo",
-1
View File
@@ -1664,7 +1664,6 @@
"couldNotReset": "재설정할 수 없습니다.",
"couldNotSave": "저장할 수 없습니다.",
"dashboardSaved": "대시보드가 저장되었습니다",
"delete": "{{name}} 삭제",
"deleteRemovesIt": "삭제하면 제거됩니다",
"discard": "폐기",
"dragHeadersToMoveDragThe": "이동하려면 헤더를 드래그하세요. 크기를 조정하려면 모서리를 드래그하세요. 위젯을 클릭하여 구성하세요.",
-1
View File
@@ -1664,7 +1664,6 @@
"couldNotReset": "Nie udało się zresetować",
"couldNotSave": "Nie udało się zapisać",
"dashboardSaved": "Panel został zapisany",
"delete": "Usuń {{name}}",
"deleteRemovesIt": "Usunięcie go usuwa",
"discard": "Wyrzucać",
"dragHeadersToMoveDragThe": "Przeciągnij nagłówki, aby przenieść · przeciągnij róg, aby zmienić rozmiar · kliknij widżet, aby go skonfigurować",
-1
View File
@@ -1664,7 +1664,6 @@
"couldNotReset": "Não foi possível redefinir",
"couldNotSave": "Não foi possível salvar",
"dashboardSaved": "Painel salvo",
"delete": "Excluir {{name}}",
"deleteRemovesIt": "Excluir o remove",
"discard": "Descartar",
"dragHeadersToMoveDragThe": "Arraste os cabeçalhos para mover · arraste o canto para redimensionar · clique em um widget para configurá-lo",
-1
View File
@@ -1664,7 +1664,6 @@
"couldNotReset": "Не удалось сбросить",
"couldNotSave": "Не удалось сохранить",
"dashboardSaved": "Панель управления сохранена.",
"delete": "Удалить {{name}}",
"deleteRemovesIt": "Удаление уберёт её",
"discard": "Отказаться",
"dragHeadersToMoveDragThe": "Перетащите заголовки для перемещения · перетащите угол, чтобы изменить размер · щелкните виджет, чтобы настроить его",
-1
View File
@@ -1664,7 +1664,6 @@
"couldNotReset": "ไม่สามารถรีเซ็ตได้",
"couldNotSave": "ไม่สามารถบันทึกได้",
"dashboardSaved": "บันทึกแดชบอร์ดแล้ว",
"delete": "ลบ {{name}}",
"deleteRemovesIt": "การลบจะนำออก",
"discard": "ทิ้ง",
"dragHeadersToMoveDragThe": "ลากส่วนหัวเพื่อย้าย · ลากมุมเพื่อปรับขนาด · คลิกวิดเจ็ตเพื่อกำหนดค่า",
-1
View File
@@ -1664,7 +1664,6 @@
"couldNotReset": "Sıfırlanamadı",
"couldNotSave": "Kaydedilemedi",
"dashboardSaved": "Kontrol paneli kaydedildi",
"delete": "{{name}}'yi sil",
"deleteRemovesIt": "Silmek onu kaldırır",
"discard": "At",
"dragHeadersToMoveDragThe": "Taşımak için başlıkları sürükleyin · yeniden boyutlandırmak için köşeyi sürükleyin · yapılandırmak için bir widget'ı tıklayın",
-1
View File
@@ -1664,7 +1664,6 @@
"couldNotReset": "Không thể đặt lại",
"couldNotSave": "Không thể lưu",
"dashboardSaved": "Đã lưu trang tổng quan",
"delete": "Xóa {{name}}",
"deleteRemovesIt": "Xóa sẽ loại bỏ nó",
"discard": "Loại bỏ",
"dragHeadersToMoveDragThe": "Kéo tiêu đề để di chuyển · kéo góc để thay đổi kích thước · nhấp vào tiện ích để định cấu hình nó",
-1
View File
@@ -1664,7 +1664,6 @@
"couldNotReset": "无法重置",
"couldNotSave": "无法保存",
"dashboardSaved": "仪表板已保存",
"delete": "删除{{name}}",
"deleteRemovesIt": "删除即移除",
"discard": "丢弃",
"dragHeadersToMoveDragThe": "拖动标题进行移动·拖动角部进行调整大小·单击小部件进行配置",
-1
View File
@@ -1664,7 +1664,6 @@
"couldNotReset": "無法重設",
"couldNotSave": "無法儲存",
"dashboardSaved": "儀表板已儲存",
"delete": "刪除{{name}}",
"deleteRemovesIt": "刪除即會移除",
"discard": "丟棄",
"dragHeadersToMoveDragThe": "拖曳標題進行移動·拖曳角落進行調整大小·點選小工具進行設定",
+74 -52
View File
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import {
Grid2x2, History, Keyboard, Maximize2, Plus,
RefreshCw, SlidersHorizontal, X,
ChevronDown, Grid2x2, History, Keyboard, Maximize2, Pencil, Plus,
RefreshCw, SlidersHorizontal, Trash2, X,
} from 'lucide-react';
import api from '../services/api';
import { useAuth } from '../contexts/useAuth.js';
@@ -12,6 +12,10 @@ import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@
import ServerPicker from '../components/ServerPicker';
import { SegControl } from '@/components/ds';
import { Button } from '@/components/ui/button';
import {
DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel,
DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
import ChangeBar from '../components/ds/ChangeBar';
import ShortcutSheet from '../components/ds/ShortcutSheet';
import EmptyState from '../components/EmptyState';
@@ -494,59 +498,77 @@ const Dashboard = () => {
{/* Board tabs + board-wide controls */}
<div className="skw-bar">
<div className="skw-tabs">
{boards.map((board) => (
<div
key={board.id}
className={`skw-tab${board.id === activeBoardId ? ' is-on' : ''}`}
onClick={() => handleBoardSwitch(board.id)}
onDoubleClick={() => edit && setRenamingId(board.id)}
role="button"
tabIndex={0}
onKeyDown={(e) => { if (e.key === 'Enter') handleBoardSwitch(board.id); }}
>
<Grid2x2 size={14} aria-hidden="true" />
{renamingId === board.id ? (
<input
className="skw-rename"
autoFocus
defaultValue={board.name}
onBlur={(e) => {
renameBoard(board.id, e.target.value.trim() || board.name);
setRenamingId(null);
}}
onKeyDown={(e) => {
if (e.key === 'Enter') e.target.blur();
if (e.key === 'Escape') setRenamingId(null);
}}
/>
) : (
<span>{board.name}</span>
)}
<span className="skw-tab__count">
{board.id === activeBoardId && edit ? widgets.length : (board.widgets || []).length}
</span>
{edit && boards.length > 1 && board.id === activeBoardId && (
<Button variant="unstyled"
{/* One selector for every dashboard, however many there are: a
row of tabs wrapped the bar onto a second line and only got
longer with each board. */}
<div className="skw-boardpick">
{renamingId === activeBoardId && activeBoard ? (
<input
className="skw-rename"
autoFocus
aria-label={t('app.dashboard.dashboardName', 'Dashboard name')}
defaultValue={activeBoard.name}
onBlur={(e) => {
renameBoard(activeBoard.id, e.target.value.trim() || activeBoard.name);
setRenamingId(null);
}}
onKeyDown={(e) => {
if (e.key === 'Enter') e.target.blur();
if (e.key === 'Escape') setRenamingId(null);
}}
/>
) : (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
variant="unstyled"
type="button"
className="skw-iconbtn skw-iconbtn--bare"
aria-label={t('app.dashboard.delete', 'Delete {{name}}', { name: board.name })}
onClick={(e) => { e.stopPropagation(); handleRemoveBoard(board.id); }}
className="skw-barbtn skw-boardpick__btn"
aria-label={t('app.dashboard.switchDashboard', 'Switch dashboard')}
>
<X size={12} />
<Grid2x2 size={14} aria-hidden="true" />
<span className="skw-boardpick__name">{activeBoard?.name}</span>
<span className="skw-boardpick__count">{widgets.length}</span>
<ChevronDown size={14} aria-hidden="true" />
</Button>
)}
</div>
))}
<Button variant="unstyled"
type="button"
className="skw-tab skw-tab--add"
onClick={handleCreateBoard}
aria-label={t('app.dashboard.newDashboard', 'New dashboard')}
title={t('app.dashboard.newDashboard', 'New dashboard')}
>
<Plus size={14} />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" className="skw-boardpick__menu">
<DropdownMenuLabel>{t('app.dashboard.dashboards', 'Dashboards')}</DropdownMenuLabel>
<DropdownMenuRadioGroup
value={String(activeBoardId)}
onValueChange={(value) => {
const next = boards.find((board) => String(board.id) === value);
if (next) handleBoardSwitch(next.id);
}}
>
{boards.map((board) => (
<DropdownMenuRadioItem key={board.id} value={String(board.id)}>
<span className="skw-boardpick__name">{board.name}</span>
<span className="skw-boardpick__count">
{board.id === activeBoardId ? widgets.length : (board.widgets || []).length}
</span>
</DropdownMenuRadioItem>
))}
</DropdownMenuRadioGroup>
<DropdownMenuSeparator />
<DropdownMenuItem onClick={handleCreateBoard}>
<Plus size={14} /> {t('app.dashboard.newDashboard', 'New dashboard')}
</DropdownMenuItem>
{edit && activeBoard && (
<>
<DropdownMenuItem onClick={() => setRenamingId(activeBoard.id)}>
<Pencil size={14} /> {t('app.dashboard.renameDashboard', 'Rename dashboard')}
</DropdownMenuItem>
{boards.length > 1 && (
<DropdownMenuItem className="text-destructive" onClick={() => handleRemoveBoard(activeBoard.id)}>
<Trash2 size={14} /> {t('app.dashboard.deleteDashboard', 'Delete dashboard')}
</DropdownMenuItem>
)}
</>
)}
</DropdownMenuContent>
</DropdownMenu>
)}
</div>
<div className="skw-bar__ctl">
+1 -3
View File
@@ -10,7 +10,6 @@
.btn,
.quick-create,
.sk-notif__bell,
.skw-tab,
.skw-iconbtn,
.skw-barbtn,
.skw-actions__row,
@@ -32,8 +31,7 @@
.sk-notif__bell,
.sk-gridicon,
.skw-iconbtn,
.setup-health-widget__dismiss,
.skw-tab--add {
.setup-health-widget__dismiss {
min-width: $control-lg;
}
@@ -48,7 +48,7 @@ $skw-z-tv: 200;
margin-bottom: $space-4;
// Range / refresh / variable pickers + edit toggle. `margin-left:auto`
// rather than a spacer element so the tabs keep their natural width.
// rather than a spacer element so the selector keeps its natural width.
&__ctl {
display: flex;
align-items: center;
@@ -127,47 +127,31 @@ $skw-z-tv: 200;
}
}
.skw-tabs {
// Dashboard selector: the active board's name on a bar button that opens the
// list of boards. One control whether there are three boards or thirty.
.skw-boardpick {
display: flex;
align-items: center;
gap: $space-1;
flex-wrap: wrap;
}
min-width: 0;
.skw-tab {
display: flex;
align-items: center;
gap: $space-2;
height: $control-md;
padding: 0 $space-3;
border: 1px solid transparent;
border-radius: $radius-control;
background: none;
color: var(--text-faint);
font-family: inherit;
font-size: $text-sm;
cursor: pointer;
transition: 0.13s;
&:hover {
&__btn {
height: $control-md;
max-width: 100%;
color: var(--text);
background: var(--surface-2);
> svg:first-child { color: var(--accent-bright); }
}
// Active board. Set apart by fill + border, never by weight, so switching
// boards cannot re-flow the row (same rule as .sk-topbar__tab).
&--on,
&.is-on,
&.is-active {
color: var(--text);
background: var(--surface-2);
border-color: var(--border-strong);
svg { color: var(--accent-bright); }
&__name {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
// Widget count on the tab.
// Widget count beside a board's name.
&__count {
margin-left: auto;
padding: 1px $space-tight;
border-radius: $radius-control;
background: var(--surface-3);
@@ -175,18 +159,17 @@ $skw-z-tv: 200;
font-size: $text-xs;
}
// "+" new-board affordance — icon only, so it drops the label padding.
&--add {
padding: $space-2;
color: var(--text-faint);
}
&__menu { min-width: 220px; } // geometry: menu width
&__menu [role='menuitemradio'] { gap: $space-3; }
}
// Inline board rename. Accent border rather than a focus ring: the input
// replaces the tab in place and has to read as "editing" without growing.
// replaces the selector in place and has to read as "editing" without growing.
.skw-rename {
width: 130px;
padding: $space-hair $space-tight;
width: 180px;
height: $control-md;
padding: $space-hair $space-3;
border: 1px solid var(--accent);
border-radius: $radius-control;
background: var(--surface-3);
Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 32 KiB