feat(collections): add book property to include archived notes

This commit is contained in:
Elian Doran 2025-09-12 18:03:07 +03:00
parent d1e57e85b6
commit bf92280ed9
No known key found for this signature in database
2 changed files with 16 additions and 5 deletions

View File

@ -764,7 +764,8 @@
"calendar": "Calendar", "calendar": "Calendar",
"table": "Table", "table": "Table",
"geo-map": "Geo Map", "geo-map": "Geo Map",
"board": "Board" "board": "Board",
"include_archived_notes": "Include archived notes"
}, },
"edited_notes": { "edited_notes": {
"no_edited_notes_found": "No edited notes on this day yet...", "no_edited_notes_found": "No edited notes on this day yet...",

View File

@ -24,7 +24,7 @@ const VIEW_TYPE_MAPPINGS: Record<ViewTypeOptions, string> = {
export default function CollectionPropertiesTab({ note }: TabContext) { export default function CollectionPropertiesTab({ note }: TabContext) {
const [ viewType, setViewType ] = useNoteLabel(note, "viewType"); const [ viewType, setViewType ] = useNoteLabel(note, "viewType");
const viewTypeWithDefault = viewType ?? "grid"; const viewTypeWithDefault = (viewType ?? "grid") as ViewTypeOptions;
const properties = bookPropertiesConfig[viewTypeWithDefault].properties; const properties = bookPropertiesConfig[viewTypeWithDefault].properties;
return ( return (
@ -32,7 +32,7 @@ export default function CollectionPropertiesTab({ note }: TabContext) {
{note && ( {note && (
<> <>
<CollectionTypeSwitcher viewType={viewTypeWithDefault} setViewType={setViewType} /> <CollectionTypeSwitcher viewType={viewTypeWithDefault} setViewType={setViewType} />
<BookProperties note={note} properties={properties} /> <BookProperties viewType={viewTypeWithDefault} note={note} properties={properties} />
</> </>
)} )}
</div> </div>
@ -54,7 +54,7 @@ function CollectionTypeSwitcher({ viewType, setViewType }: { viewType: string, s
) )
} }
function BookProperties({ note, properties }: { note: FNote, properties: BookProperty[] }) { function BookProperties({ viewType, note, properties }: { viewType: ViewTypeOptions, note: FNote, properties: BookProperty[] }) {
return ( return (
<div className="book-properties-container"> <div className="book-properties-container">
{properties.map(property => ( {properties.map(property => (
@ -62,6 +62,16 @@ function BookProperties({ note, properties }: { note: FNote, properties: BookPro
{mapPropertyView({ note, property })} {mapPropertyView({ note, property })}
</div> </div>
))} ))}
{viewType !== "list" && viewType !== "grid" && (
<CheckboxPropertyView
note={note} property={{
bindToLabel: "includeArchived",
label: t("book_properties.include_archived_notes"),
type: "checkbox"
}}
/>
)}
</div> </div>
) )
} }
@ -146,4 +156,4 @@ function LabelledEntry({ label, children }: { label: string, children: Component
</label> </label>
</> </>
) )
} }