From ebed49237ca171e481bdfe05f6e3bb9c35570990 Mon Sep 17 00:00:00 2001 From: Michael Freno Date: Mon, 10 Aug 2026 20:57:16 -0400 Subject: [PATCH] style(tabpanel): convert tab indentation to 2 spaces --- src/components/TabPanel.tsx | 165 ++++++++++++++++++------------------ 1 file changed, 82 insertions(+), 83 deletions(-) diff --git a/src/components/TabPanel.tsx b/src/components/TabPanel.tsx index eabebdf..e43b874 100644 --- a/src/components/TabPanel.tsx +++ b/src/components/TabPanel.tsx @@ -24,101 +24,100 @@ import { TABS } from "@/utils/navigation"; import { NF_ICONS, supportsNerdFonts } from "@/utils/nerd-fonts"; const TAB_LABEL: Record = { - [TABS.FEED]: "Feed", - [TABS.MYSHOWS]: "My Shows", - [TABS.DISCOVER]: "Discover", - [TABS.SEARCH]: "Search", - [TABS.PLAYER]: "Player", - [TABS.SETTINGS]: "Settings", + [TABS.FEED]: "Feed", + [TABS.MYSHOWS]: "My Shows", + [TABS.DISCOVER]: "Discover", + [TABS.SEARCH]: "Search", + [TABS.PLAYER]: "Player", + [TABS.SETTINGS]: "Settings", }; /** Nerd Font glyph per tab (rendered only when the terminal supports them). */ const TAB_ICON: Record = { - [TABS.FEED]: NF_ICONS.feed, - [TABS.MYSHOWS]: NF_ICONS.shows, - [TABS.DISCOVER]: NF_ICONS.discover, - [TABS.SEARCH]: NF_ICONS.search, - [TABS.PLAYER]: NF_ICONS.player, - [TABS.SETTINGS]: NF_ICONS.settings, + [TABS.FEED]: NF_ICONS.feed, + [TABS.MYSHOWS]: NF_ICONS.shows, + [TABS.DISCOVER]: NF_ICONS.discover, + [TABS.SEARCH]: NF_ICONS.search, + [TABS.PLAYER]: NF_ICONS.player, + [TABS.SETTINGS]: NF_ICONS.settings, }; /** Numeric TABS values, in declaration order (1..TabsCount). */ const TAB_ORDER = Object.values(TABS).filter( - (v): v is TABS => typeof v === "number", + (v): v is TABS => typeof v === "number", ) as TABS[]; export function TabListPane(props: { muted?: boolean }) { - // Static: detection never changes mid-session. - const nerd = supportsNerdFonts(); - const { theme } = useTheme(); - const nav = useNavigation(); - const marker = useSelectionMarker(); + // Static: detection never changes mid-session. + const nerd = supportsNerdFonts(); + const { theme } = useTheme(); + const nav = useNavigation(); + const marker = useSelectionMarker(); - const cursor = () => nav.tabCursor(); - const activeTab = () => nav.activeTab(); - /** `active=true` when this pane is the CURRENT column (Shell root); - * `false` when it is the muted UP/parent column (pages' parent pane). */ - const active = () => !props.muted; + const cursor = () => nav.tabCursor(); + const activeTab = () => nav.activeTab(); + /** `active=true` when this pane is the CURRENT column (Shell root); + * `false` when it is the muted UP/parent column (pages' parent pane). */ + const active = () => !props.muted; - // Same focus-bg / focus-fg contract every other pane uses. - const focusBg = (t: TABS) => - t === cursor() && active() - ? theme.primary - : t === cursor() - ? theme.border - : undefined; - const focusFg = (t: TABS) => - t === cursor() && active() - ? theme.surface - : t === cursor() - ? theme.selectedListItemText ?? theme.text - : theme.text; + // Same focus-bg / focus-fg contract every other pane uses. + const focusBg = (t: TABS) => + t === cursor() && active() + ? theme.primary + : t === cursor() + ? theme.border + : undefined; + const focusFg = (t: TABS) => + t === cursor() && active() + ? theme.surface + : t === cursor() + ? theme.selectedListItemText ?? theme.text + : theme.text; - return ( - - {(tab) => { - const isCursor = () => cursor() === tab; - const isActive = () => activeTab() === tab; - // The active tab is only accented in the Up/parent position — when this - // pane is CURRENT, the cursor highlight is the only highlight. - const labelFg = () => - isCursor() - ? focusFg(tab) - : isActive() && !active() - ? theme.accent - : theme.text; - const ref = useScrollIntoView(isCursor); - return ( - { - // Click = hover + open, the yazi "open" of the row - // (switches to the tab and enters its content), the same - // as l/Enter. Restores mouse support the tab-strip - // refactor dropped. - nav.setTabCursor(tab); - nav.activateTabCursor(); - }} - > - {/* ── selection marker (j/k cursor) ─────────────────────────── */} - {isCursor() ? marker() : " "} - {nerd && ( - - {TAB_ICON[tab]} - - )} - {tab} - - {TAB_LABEL[tab]} - - - ); - }} - - ); + return ( + + {(tab) => { + const isCursor = () => cursor() === tab; + const isActive = () => activeTab() === tab; + // The active tab is only accented in the Up/parent position — when this + // pane is CURRENT, the cursor highlight is the only highlight. + const labelFg = () => + isCursor() + ? focusFg(tab) + : isActive() && !active() + ? theme.accent + : theme.text; + const ref = useScrollIntoView(isCursor); + return ( + { + // Click = hover + open, the yazi "open" of the row + // (switches to the tab and enters its content), the same + // as l/Enter. Restores mouse support the tab-strip + // refactor dropped. + nav.setTabCursor(tab); + nav.activateTabCursor(); + }} + > + {/* ── selection marker (j/k cursor) ─────────────────────────── */} + {isCursor() ? marker() : " "} + {nerd && ( + + {TAB_ICON[tab]} + + )} + + {TAB_LABEL[tab]} + + + ); + }} + + ); }