Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(client): format ListOrGridView
Elian Doran3207f37ac35f
diff --git a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsxindex 850aa3fba1..fc1b45692b 100644--- a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx+++ b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx@@ -1,16 +1,18 @@+import "./ListOrGridView.css";+import { useEffect, useRef, useState } from "preact/hooks";+import FNote from "../../../entities/fnote";-import Icon from "../../react/Icon";-import { ViewModeProps } from "../interface";+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 "./ListOrGridView.css";-import content_renderer from "../../../services/content_renderer";+import { ViewModeProps } from "../interface";import { Pager, usePagination } from "../Pagination";-import tree from "../../../services/tree";-import link from "../../../services/link";-import { t } from "../../../services/i18n";-import attribute_renderer from "../../../services/attribute_renderer";import { filterChildNotes, useFilteredNoteIds } from "./utils";export function ListView({ note, noteIds: unfilteredNoteIds, highlightedTokens }: ViewModeProps<{}>) {@@ -91,7 +93,7 @@ function ListNoteCard({ note, parentNote, highlightedTokens, currentLevel, expan<NoteChildren note={note} parentNote={parentNote} highlightedTokens={highlightedTokens} currentLevel={currentLevel} expandDepth={expandDepth} /></>}</div>- )+ );}function GridNoteCard({ note, parentNote, highlightedTokens }: { note: FNote, parentNote: FNote, highlightedTokens: string[] | null | undefined }) {@@ -124,7 +126,7 @@ function GridNoteCard({ note, parentNote, highlightedTokens }: { note: FNote, pahighlightedTokens={highlightedTokens}/></div>- )+ );}function NoteAttributes({ note }: { note: FNote }) {@@ -135,7 +137,7 @@ function NoteAttributes({ note }: { note: FNote }) {});}, [ note ]);- return <span className="note-list-attributes" ref={ref} />+ return <span className="note-list-attributes" ref={ref} />;}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 <div ref={contentRef} className="note-book-content" />;@@ -185,16 +187,16 @@ function NoteChildren({ note, parentNote, highlightedTokens, currentLevel, expanparentNote={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 pathreturn 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);+}