From 3207f37ac35fe87c3b869c8f9c40713eafd386ef Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 24 Dec 2025 13:20:00 +0200 Subject: [PATCH] chore(client): format ListOrGridView --- .../collections/legacy/ListOrGridView.tsx | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx index 850aa3fba..fc1b45692 100644 --- a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx +++ b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx @@ -1,16 +1,18 @@ -import { useEffect, useRef, useState } from "preact/hooks"; -import FNote from "../../../entities/fnote"; -import Icon from "../../react/Icon"; -import { ViewModeProps } from "../interface"; -import { useImperativeSearchHighlighlighting, useNoteLabel } from "../../react/hooks"; -import NoteLink from "../../react/NoteLink"; import "./ListOrGridView.css"; -import content_renderer from "../../../services/content_renderer"; -import { Pager, usePagination } from "../Pagination"; -import tree from "../../../services/tree"; -import link from "../../../services/link"; -import { t } from "../../../services/i18n"; + +import { useEffect, useRef, useState } from "preact/hooks"; + +import FNote from "../../../entities/fnote"; import attribute_renderer from "../../../services/attribute_renderer"; +import content_renderer from "../../../services/content_renderer"; +import { t } from "../../../services/i18n"; +import link from "../../../services/link"; +import tree from "../../../services/tree"; +import { useImperativeSearchHighlighlighting, useNoteLabel } from "../../react/hooks"; +import Icon from "../../react/Icon"; +import NoteLink from "../../react/NoteLink"; +import { ViewModeProps } from "../interface"; +import { Pager, usePagination } from "../Pagination"; import { filterChildNotes, useFilteredNoteIds } from "./utils"; export function ListView({ note, noteIds: unfilteredNoteIds, highlightedTokens }: ViewModeProps<{}>) { @@ -91,7 +93,7 @@ function ListNoteCard({ note, parentNote, highlightedTokens, currentLevel, expan } - ) + ); } function GridNoteCard({ note, parentNote, highlightedTokens }: { note: FNote, parentNote: FNote, highlightedTokens: string[] | null | undefined }) { @@ -124,7 +126,7 @@ function GridNoteCard({ note, parentNote, highlightedTokens }: { note: FNote, pa highlightedTokens={highlightedTokens} /> - ) + ); } function NoteAttributes({ note }: { note: FNote }) { @@ -135,7 +137,7 @@ function NoteAttributes({ note }: { note: FNote }) { }); }, [ note ]); - return + return ; } function NoteContent({ note, trim, noChildrenList, highlightedTokens }: { note: FNote, trim?: boolean, noChildrenList?: boolean, highlightedTokens: string[] | null | undefined }) { @@ -161,7 +163,7 @@ function NoteContent({ note, trim, noChildrenList, highlightedTokens }: { note: console.warn(`Caught error while rendering note '${note.noteId}' of type '${note.type}'`); console.error(e); contentRef.current?.replaceChildren(t("collections.rendering_error")); - }) + }); }, [ note, highlightedTokens ]); return
; @@ -185,16 +187,16 @@ function NoteChildren({ note, parentNote, highlightedTokens, currentLevel, expan parentNote={parentNote} highlightedTokens={highlightedTokens} currentLevel={currentLevel + 1} expandDepth={expandDepth} - />) + />); } function getNotePath(parentNote: FNote, childNote: FNote) { if (parentNote.type === "search") { // for search note parent, we want to display a non-search path return childNote.noteId; - } else { - return `${parentNote.noteId}/${childNote.noteId}` - } + } + return `${parentNote.noteId}/${childNote.noteId}`; + } function useExpansionDepth(note: FNote) { @@ -206,7 +208,7 @@ function useExpansionDepth(note: FNote) { return 1; } else if (expandDepth === "all") { return Number.MAX_SAFE_INTEGER; - } else { - return parseInt(expandDepth, 10); - } + } + return parseInt(expandDepth, 10); + }