diff --git a/apps/client/src/widgets/collections/Pagination.tsx b/apps/client/src/widgets/collections/Pagination.tsx index 26d22215cb..256d3a39f9 100644 --- a/apps/client/src/widgets/collections/Pagination.tsx +++ b/apps/client/src/widgets/collections/Pagination.tsx @@ -9,7 +9,8 @@ import Button from "../react/Button"; import "./Pagination.css"; import clsx from "clsx"; -interface PaginationContext { +export interface PaginationContext { + className?: string; page: number; setPage: Dispatch>; pageNotes?: FNote[]; @@ -18,11 +19,11 @@ interface PaginationContext { totalNotes: number; } -export function Pager({ page, pageSize, setPage, pageCount, totalNotes }: Omit) { +export function Pager({ className, page, pageSize, setPage, pageCount, totalNotes }: Omit) { if (pageCount < 2) return; return ( -
+
) { const expandDepth = useExpansionDepth(note); @@ -27,32 +27,18 @@ export function ListView({ note, noteIds: unfilteredNoteIds, highlightedTokens } const { pageNotes, ...pagination } = usePagination(note, noteIds); const [ includeArchived ] = useNoteLabelBoolean(note, "includeArchived"); const noteType = useNoteProperty(note, "type"); - const hasCollectionProperties = [ "book", "search" ].includes(noteType ?? ""); - return ( -
- } - /> - - { noteIds.length > 0 &&
- {!hasCollectionProperties && } - - - {pageNotes?.map(childNote => ( - - ))} - - - -
} -
- ); + return + + {pageNotes?.map(childNote => ( + + ))} + + ; } export function GridView({ note, noteIds: unfilteredNoteIds, highlightedTokens }: ViewModeProps<{}>) { @@ -60,32 +46,47 @@ export function GridView({ note, noteIds: unfilteredNoteIds, highlightedTokens } const { pageNotes, ...pagination } = usePagination(note, noteIds); const [ includeArchived ] = useNoteLabelBoolean(note, "includeArchived"); const noteType = useNoteProperty(note, "type"); - const hasCollectionProperties = [ "book", "search" ].includes(noteType ?? ""); - return ( -
- } - /> - -
- {!hasCollectionProperties && } - -
- {pageNotes?.map(childNote => ( - - ))} -
- - -
+ return +
+ {pageNotes?.map(childNote => ( + + ))}
- ); +
+} + +interface NoteListProps { + note: FNote, + viewMode: "list-view" | "grid-view", + noteIds: string[], + pagination: PaginationContext, + children: ComponentChildren +} + +function NoteList(props: NoteListProps) { + const noteType = useNoteProperty(props.note, "type"); + const hasCollectionProperties = ["book", "search"].includes(noteType ?? ""); + + return
+ } + /> + + {props.noteIds.length > 0 &&
+ {!hasCollectionProperties && } + + {props.children} + + +
} + +
} function ListNoteCard({ note, parentNote, highlightedTokens, currentLevel, expandDepth, includeArchived }: { @@ -175,7 +176,8 @@ function GridNoteCard(props: GridNoteCardProps) { showNotePath={props.parentNote.type === "search"} highlightedTokens={props.highlightedTokens} /> - + {!props.note.isOptions() && } + { "application/pdf" ] + const COLLECTIONS_WITH_BACKGROUND_EFFECTS = [ + "grid", + "list" + ] + if (note.isOptions()) { return true; } @@ -102,6 +107,10 @@ export default class NoteWrapperWidget extends FlexContainer { return true; } + if (note.type === "book" && COLLECTIONS_WITH_BACKGROUND_EFFECTS.includes(note.getLabelValue("viewType") ?? "none")) { + return true; + } + return false; } diff --git a/apps/client/src/widgets/react/Card.css b/apps/client/src/widgets/react/Card.css index b14279d2ad..0aecb56dbd 100644 --- a/apps/client/src/widgets/react/Card.css +++ b/apps/client/src/widgets/react/Card.css @@ -7,7 +7,7 @@ } .tn-card-frame, -.tn-card-section { +.tn-card-body .tn-card-section { padding: var(--card-padding-block) var(--card-padding-inline); border: 1px solid var(--card-border-color, var(--main-border-color)); background: var(--card-background-color);