mirror of
https://github.com/zadam/trilium.git
synced 2025-12-12 10:24:23 +01:00
feat(note_bars/collection): integrate show archived notes
This commit is contained in:
parent
b540111fa4
commit
fec5ee9335
@ -1,9 +1,12 @@
|
||||
import { t } from "i18next";
|
||||
import FNote from "../../entities/fnote";
|
||||
import { ViewTypeOptions } from "../collections/interface";
|
||||
import Dropdown from "../react/Dropdown";
|
||||
import { FormListItem } from "../react/FormList";
|
||||
import { FormListItem, FormListToggleableItem } from "../react/FormList";
|
||||
import Icon from "../react/Icon";
|
||||
import { useViewType, VIEW_TYPE_MAPPINGS } from "../ribbon/CollectionPropertiesTab";
|
||||
import { BookProperty, CheckBoxProperty } from "../ribbon/collection-properties-config";
|
||||
import { useNoteLabel, useNoteLabelBoolean } from "../react/hooks";
|
||||
|
||||
const ICON_MAPPINGS: Record<ViewTypeOptions, string> = {
|
||||
grid: "bx bxs-grid",
|
||||
@ -17,7 +20,10 @@ const ICON_MAPPINGS: Record<ViewTypeOptions, string> = {
|
||||
|
||||
export default function CollectionProperties({ note }: { note: FNote }) {
|
||||
return (
|
||||
<ViewTypeSwitcher note={note} />
|
||||
<>
|
||||
<ViewTypeSwitcher note={note} />
|
||||
<ViewOptions note={note} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@ -43,3 +49,36 @@ function ViewTypeSwitcher({ note }: { note: FNote }) {
|
||||
</Dropdown>
|
||||
);
|
||||
}
|
||||
|
||||
function ViewOptions({ note }: { note: FNote }) {
|
||||
return (
|
||||
<Dropdown
|
||||
buttonClassName="bx bx-cog icon-action"
|
||||
hideToggleArrow
|
||||
>
|
||||
<ViewProperty note={note} property={{
|
||||
type: "checkbox",
|
||||
label: t("book_properties.include_archived_notes"),
|
||||
bindToLabel: "includeArchived"
|
||||
} as CheckBoxProperty} />
|
||||
</Dropdown>
|
||||
);
|
||||
}
|
||||
|
||||
function ViewProperty({ note, property }: { note: FNote, property: BookProperty }) {
|
||||
switch (property.type) {
|
||||
case "checkbox":
|
||||
return <CheckBoxPropertyView note={note} property={property} />;
|
||||
}
|
||||
}
|
||||
|
||||
function CheckBoxPropertyView({ note, property }: { note: FNote, property: CheckBoxProperty }) {
|
||||
const [ value, setValue ] = useNoteLabelBoolean(note, property.bindToLabel);
|
||||
return (
|
||||
<FormListToggleableItem
|
||||
title={property.label}
|
||||
currentValue={value}
|
||||
onChange={setValue}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user