feat(mobile/tab_switcher): display note icon

This commit is contained in:
Elian Doran 2026-01-31 17:29:24 +02:00
parent 325b8b886c
commit bf0fc57493
No known key found for this signature in database
2 changed files with 10 additions and 2 deletions

View File

@ -25,10 +25,15 @@
}
header {
padding: 0.5em 1em;
padding: 0.4em 0.5em;
border-bottom: 1px solid var(--main-border-color);
display: flex;
overflow: hidden;
align-items: center;
>.tn-icon {
margin-inline-end: 0.4em;
}
.title {
overflow: hidden;

View File

@ -9,7 +9,8 @@ import NoteContext from "../../components/note_context";
import { t } from "../../services/i18n";
import { NoteContent } from "../collections/legacy/ListOrGridView";
import { LaunchBarActionButton } from "../launch_bar/launch_bar_widgets";
import { useActiveNoteContext, useTriliumEvent } from "../react/hooks";
import { useActiveNoteContext, useNoteIcon, useTriliumEvent } from "../react/hooks";
import Icon from "../react/Icon";
import Modal from "../react/Modal";
export default function TabSwitcher() {
@ -75,6 +76,7 @@ function Tab({ noteContext, selectTab, activeNtxId }: {
activeNtxId: string | null | undefined;
}) {
const { note } = noteContext;
const iconClass = useNoteIcon(note);
return (
<div
@ -84,6 +86,7 @@ function Tab({ noteContext, selectTab, activeNtxId }: {
onClick={() => selectTab(noteContext)}
>
<header>
<Icon icon={iconClass} />
<span className="title">{noteContext.note?.title ?? t("tab_row.new_tab")}</span>
</header>
<div className={clsx("tab-preview", `type-${note?.type ?? "empty"}`)}>