From 218343ca144882f3a6d4406e60f3206374588ecc Mon Sep 17 00:00:00 2001 From: Adorian Doran Date: Sat, 14 Feb 2026 01:14:54 +0200 Subject: [PATCH] client/list view: use a sectioned card to display the list items --- .../collections/legacy/ListOrGridView.css | 35 +++++++++++++++++-- .../collections/legacy/ListOrGridView.tsx | 33 ++++++++++------- apps/client/src/widgets/react/Card.css | 3 +- 3 files changed, 56 insertions(+), 15 deletions(-) diff --git a/apps/client/src/widgets/collections/legacy/ListOrGridView.css b/apps/client/src/widgets/collections/legacy/ListOrGridView.css index 1bfa389e5c..ef609c1d0d 100644 --- a/apps/client/src/widgets/collections/legacy/ListOrGridView.css +++ b/apps/client/src/widgets/collections/legacy/ListOrGridView.css @@ -102,9 +102,8 @@ .note-expander { font-size: x-large; - position: relative; - top: 3px; cursor: pointer; + opacity: .65; } .note-list-pager { @@ -117,6 +116,38 @@ opacity: 0.5; } +:root .list-view-card { + --card-nested-section-indent: 40px; +} + +.note-list h5 { + display: flex; + align-items: center; + font-size: 1em; + margin: 0; + + .tn-icon { + color: var(--left-pane-icon-color); + margin-inline-end: 8px; + font-size: 1.2em; + } + + .note-book-title { + color: inherit; + } + + .note-list-attributes { + flex-grow: 1; + text-align: right; + font-size: .75em; + opacity: .75; + } +} + +.note-content-preview:has(.note-book-content:empty) { + display: none; +} + /* #region Grid view */ .note-list.grid-view .note-list-container { display: flex; diff --git a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx index 61c7193a6e..6bf77c644f 100644 --- a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx +++ b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx @@ -1,4 +1,5 @@ import "./ListOrGridView.css"; +import { Card, CardSection } from "../../react/Card"; import { useEffect, useRef, useState } from "preact/hooks"; @@ -33,7 +34,7 @@ export function ListView({ note, noteIds: unfilteredNoteIds, highlightedTokens } { noteIds.length > 0 &&
{!hasCollectionProperties && } - +
} @@ -93,27 +94,35 @@ function ListNoteCard({ note, parentNote, highlightedTokens, currentLevel, expan // Reset expand state if switching to another note, or if user manually toggled expansion state. useEffect(() => setExpanded(currentLevel <= expandDepth), [ note, currentLevel, expandDepth ]); + const children = <> + {isExpanded && <> + + + + + } + + return ( -
setExpanded(!isExpanded)} data-note-id={note.noteId} > -
+
setExpanded(!isExpanded)} + onClick={(e) => {setExpanded(!isExpanded); e.stopPropagation();}} />
- - {isExpanded && <> - - - } -
+ ); } diff --git a/apps/client/src/widgets/react/Card.css b/apps/client/src/widgets/react/Card.css index d717354be1..53fd889b21 100644 --- a/apps/client/src/widgets/react/Card.css +++ b/apps/client/src/widgets/react/Card.css @@ -2,6 +2,7 @@ --card-border-radius: 8px; --card-padding: 8px 16px; --card-section-gap: 3px; + --card-nested-section-indent: 30px; display: flex; flex-direction: column; @@ -23,7 +24,7 @@ } &.tn-card-section-nested { - padding-left: calc(30px * var(--tn-card-section-nesting-level)); + padding-left: calc(8px + (var(--card-nested-section-indent) * var(--tn-card-section-nesting-level))); background-color: color-mix(in srgb, var(--card-background-color) calc(100% / (var(--tn-card-section-nesting-level) + 1)) , transparent); }