会话支持平铺模式显示

This commit is contained in:
xintaofei
2026-03-11 08:14:36 +08:00
parent 2ab6d6ff11
commit 49196ffd4d
14 changed files with 140 additions and 35 deletions

View File

@@ -13,11 +13,13 @@ export function TabBar() {
const {
tabs,
activeTabId,
isTileMode,
switchTab,
closeTab,
closeOtherTabs,
closeAllTabs,
pinTab,
toggleTileMode,
reorderTabs,
} = useTabContext()
const { mode, activePane } = useWorkspaceContext()
@@ -89,11 +91,13 @@ export function TabBar() {
key={tab.id}
tab={tab}
isActive={tab.id === activeTabId}
isTileMode={isTileMode}
onSwitch={switchTab}
onClose={closeTab}
onCloseOthers={closeOtherTabs}
onCloseAll={closeAllTabs}
onPin={pinTab}
onToggleTile={toggleTileMode}
/>
))}
</Reorder.Group>

View File

@@ -19,21 +19,25 @@ import type { TabItem as TabItemData } from "@/contexts/tab-context"
interface TabItemProps {
tab: TabItemData
isActive: boolean
isTileMode: boolean
onSwitch: (tabId: string) => void
onClose: (tabId: string) => void
onCloseOthers: (tabId: string) => void
onCloseAll: () => void
onPin: (tabId: string) => void
onToggleTile: () => void
}
export const TabItem = memo(function TabItem({
tab,
isActive,
isTileMode,
onSwitch,
onClose,
onCloseOthers,
onCloseAll,
onPin,
onToggleTile,
}: TabItemProps) {
const t = useTranslations("Folder.tabs")
const isDragging = useRef(false)
@@ -143,6 +147,10 @@ export const TabItem = memo(function TabItem({
{t("closeOthers")}
</ContextMenuItem>
<ContextMenuSeparator />
<ContextMenuItem onSelect={onToggleTile}>
{isTileMode ? t("untileDisplay") : t("tileDisplay")}
</ContextMenuItem>
<ContextMenuSeparator />
<ContextMenuItem onSelect={onCloseAll}>
{t("closeAll")}
</ContextMenuItem>