diff --git a/apps/client/src/widgets/mobile_widgets/TabSwitcher.css b/apps/client/src/widgets/mobile_widgets/TabSwitcher.css index e46bb0a808..895940be9f 100644 --- a/apps/client/src/widgets/mobile_widgets/TabSwitcher.css +++ b/apps/client/src/widgets/mobile_widgets/TabSwitcher.css @@ -95,7 +95,8 @@ &.type-contentWidget, &.type-search, &.type-empty, - &.type-relationMap { + &.type-relationMap, + &.tab-preview-placeholder { display: flex; align-items: center; justify-content: center; diff --git a/apps/client/src/widgets/mobile_widgets/TabSwitcher.tsx b/apps/client/src/widgets/mobile_widgets/TabSwitcher.tsx index fc72a739a2..ed3d735d1c 100644 --- a/apps/client/src/widgets/mobile_widgets/TabSwitcher.tsx +++ b/apps/client/src/widgets/mobile_widgets/TabSwitcher.tsx @@ -1,6 +1,7 @@ import "./TabSwitcher.css"; import clsx from "clsx"; +import { ComponentChild } from "preact"; import { createPortal, Fragment } from "preact/compat"; import { useCallback, useEffect, useRef, useState } from "preact/hooks"; @@ -11,6 +12,7 @@ import contextMenu from "../../menus/context_menu"; import { getHue, parseColor } from "../../services/css_class_manager"; import froca from "../../services/froca"; import { t } from "../../services/i18n"; +import type { ViewMode, ViewScope } from "../../services/link"; import { NoteContent } from "../collections/legacy/ListOrGridView"; import { LaunchBarActionButton } from "../launch_bar/launch_bar_widgets"; import { ICON_MAPPINGS } from "../note_bars/CollectionProperties"; @@ -20,6 +22,13 @@ import Icon from "../react/Icon"; import LinkButton from "../react/LinkButton"; import Modal from "../react/Modal"; +const VIEW_MODE_ICON_MAPPINGS: Record, string> = { + source: "bx bx-code", + "contextual-help": "bx bx-help-circle", + "note-map": "bx bxs-network-chart", + attachments: "bx bx-paperclip", +}; + export default function TabSwitcher() { const [ shown, setShown ] = useState(false); const mainNoteContexts = useMainNoteContexts(); @@ -158,9 +167,7 @@ function Tab({ noteContext, containerRef, selectTab, activeNtxId }: { {subContexts.map(subContext => ( -
- -
+
))} @@ -193,24 +200,31 @@ function TabHeader({ noteContext, colorClass }: { noteContext: NoteContext, colo ); } -function TabPreviewContent({ note }: { - note: FNote | null +function TabPreviewContent({ note, viewScope }: { + note: FNote | null, + viewScope: ViewScope | undefined }) { + let el: ComponentChild; + let isPlaceholder = true; + if (!note) { - return ; - } - - if (note.type === "book") { - return ; - } - - return ( - ; + } else if (note.type === "book") { + el = ; + } else if (viewScope?.viewMode !== "default") { + el = ; + } else { + el = + />; + isPlaceholder = false; + } + + return ( +
{el}
); }