返回 DeepSeek-Reasonix
DockTabPicker.tsx
根目录 / desktop / frontend / src / components / TabContainer / DockTabPicker.tsx
1 // DockTabPicker is the dock's empty state: with no tab open the panel offers
2 // the views it can hold instead of showing nothing. The layout follows the
3 // host pane's own width via a container query — a list while the dock is
4 // narrow, a card grid once it is wide enough for two or more columns.
5 import { useT } from "../../lib/i18n";
6 import { availableDockEntries } from "../../lib/dockEntries";
7 import { desktopHost } from "../../lib/desktopHost";
8 import { DOCK_ENTRY_ICONS } from "../dockEntryIcons";
9
10 export function DockTabPicker({ onSelect }: { onSelect: (entryId: string) => void }) {
11 const t = useT();
12 const entries = availableDockEntries(desktopHost().browser !== undefined);
13
14 return (
15 <div className="tab-picker">
16 <div className="tab-picker__content">
17 <div className="tab-picker__heading">
18 <h2 className="tab-picker__title">{t("rightDock.openTab")}</h2>
19 <p className="tab-picker__hint">{t("rightDock.openTabHint")}</p>
20 </div>
21 <div className="tab-picker__list">
22 {entries.map((entry) => {
23 const Icon = DOCK_ENTRY_ICONS[entry.defaultTab];
24 return (
25 <button
26 key={entry.id}
27 type="button"
28 className="tab-picker__item"
29 data-dock-picker-entry={entry.id}
30 onClick={() => onSelect(entry.id)}
31 >
32 <Icon size={16} className="tab-picker__icon" />
33 <span className="tab-picker__label">{t(entry.labelKey as never)}</span>
34 </button>
35 );
36 })}
37 </div>
38 </div>
39 </div>
40 );
41 }
42
42 lines Plain Text