diff --git a/apps/client/src/widgets/collections/legacy/ListOrGridView.css b/apps/client/src/widgets/collections/legacy/ListOrGridView.css index 79b11d88cf..643c2be097 100644 --- a/apps/client/src/widgets/collections/legacy/ListOrGridView.css +++ b/apps/client/src/widgets/collections/legacy/ListOrGridView.css @@ -12,6 +12,11 @@ display: flex; flex-wrap: wrap; gap: 10px; + + body.mobile & { + display: grid; + grid-template-columns: 1fr 1fr; + } } .note-list-bottom-pager { @@ -269,8 +274,9 @@ overflow: hidden; user-select: none; - body.mobile & { - flex-basis: 150px; + body.mobile &.mobile-full-width { + grid-column-start: 1; + grid-column-end: 3; } &:hover { diff --git a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx index 238817d978..f8187ccdac 100644 --- a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx +++ b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx @@ -1,25 +1,25 @@ import "./ListOrGridView.css"; -import { Card, CardFrame, CardSection } from "../../react/Card"; +import { clsx } from "clsx"; +import { ComponentChildren, TargetedMouseEvent } from "preact"; import { useCallback, useEffect, useRef, useState } from "preact/hooks"; +import { JSX } from "preact/jsx-runtime"; import FNote from "../../../entities/fnote"; +import linkContextMenuService from "../../../menus/link_context_menu"; 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 CollectionProperties from "../../note_bars/CollectionProperties"; +import ActionButton from "../../react/ActionButton"; +import { Card, CardFrame, CardSection } from "../../react/Card"; import { useImperativeSearchHighlighlighting, useNoteLabel, useNoteLabelBoolean, useNoteProperty } from "../../react/hooks"; import Icon from "../../react/Icon"; import NoteLink from "../../react/NoteLink"; import { ViewModeProps } from "../interface"; -import { Pager, usePagination, PaginationContext } from "../Pagination"; +import { Pager, PaginationContext,usePagination } from "../Pagination"; import { filterChildNotes, useFilteredNoteIds } from "./utils"; -import { JSX } from "preact/jsx-runtime"; -import { clsx } from "clsx"; -import ActionButton from "../../react/ActionButton"; -import linkContextMenuService from "../../../menus/link_context_menu"; -import { ComponentChildren, TargetedMouseEvent } from "preact"; const contentSizeObserver = new ResizeObserver(onContentResized); @@ -53,13 +53,13 @@ export function GridView({ note, noteIds: unfilteredNoteIds, highlightedTokens }
{pageNotes?.map(childNote => ( + note={childNote} + parentNote={note} + highlightedTokens={highlightedTokens} + includeArchived={includeArchived} /> ))}
- + ; } interface NoteListProps { @@ -82,13 +82,13 @@ function NoteList(props: NoteListProps) { {props.noteIds.length > 0 &&
{!hasCollectionProperties && } - + {props.children}
} - + ; } function ListNoteCard({ note, parentNote, highlightedTokens, currentLevel, expandDepth, includeArchived }: { @@ -106,25 +106,25 @@ 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 ]); - let subSections: JSX.Element | undefined = undefined; + let subSections: JSX.Element | undefined; if (isExpanded) { subSections = <> + highlightedTokens={highlightedTokens} + noChildrenList + includeArchivedNotes={includeArchived} /> - + parentNote={parentNote} + highlightedTokens={highlightedTokens} + currentLevel={currentLevel} + expandDepth={expandDepth} + includeArchived={includeArchived} /> + ; } - + return (
- setExpanded(!isExpanded)}/> + setExpanded(!isExpanded)}/> + notePath={notePath} + noPreview + showNotePath={parentNote.type === "search"} + highlightedTokens={highlightedTokens} />
@@ -164,27 +164,28 @@ function GridNoteCard(props: GridNoteCardProps) { return ( link.goToLink(e)} + "archived": props.note.isArchived, + "mobile-full-width": props.note.type === "file" + })} + data-href={`#${notePath}`} + data-note-id={props.note.noteId} + onClick={(e) => link.goToLink(e)} >
{!props.note.isOptions() && } - +
); @@ -222,7 +223,7 @@ export function NoteContent({ note, trim, noChildrenList, highlightedTokens, inc return () => { contentSizeObserver.unobserve(contentElement); - } + }; }, []); useEffect(() => { @@ -281,13 +282,13 @@ function NoteChildren({ note, parentNote, highlightedTokens, currentLevel, expan function NoteMenuButton(props: {notePath: string}) { const openMenu = useCallback((e: TargetedMouseEvent) => { linkContextMenuService.openContextMenu(props.notePath, e); - e.stopPropagation() + e.stopPropagation(); }, [props.notePath]); return + icon="bx bx-dots-vertical-rounded" text="" + onClick={openMenu} + />; } function getNotePath(parentNote: FNote, childNote: FNote) { @@ -315,7 +316,7 @@ function useExpansionDepth(note: FNote) { function onContentResized(entries: ResizeObserverEntry[], observer: ResizeObserver): void { for (const contentElement of entries) { - const isOverflowing = ((contentElement.target.scrollHeight > contentElement.target.clientHeight)) + const isOverflowing = ((contentElement.target.scrollHeight > contentElement.target.clientHeight)); contentElement.target.classList.toggle("note-book-content-overflowing", isOverflowing); } -} \ No newline at end of file +}