diff --git a/apps/client/src/widgets/note_bars/CollectionProperties.tsx b/apps/client/src/widgets/note_bars/CollectionProperties.tsx index 2ede18a94d..66bfb32c45 100644 --- a/apps/client/src/widgets/note_bars/CollectionProperties.tsx +++ b/apps/client/src/widgets/note_bars/CollectionProperties.tsx @@ -86,8 +86,8 @@ function ViewOptions({ note, viewType }: { note: FNote, viewType: ViewTypeOption dropdownContainerClassName="mobile-bottom-menu" mobileBackdrop > - {properties.map(property => ( - + {properties.map((property, index) => ( + ))} {properties.length > 0 && } diff --git a/apps/client/src/widgets/react/NotePropertyMenu.tsx b/apps/client/src/widgets/react/NotePropertyMenu.tsx index cbc4985e68..6d8070741d 100644 --- a/apps/client/src/widgets/react/NotePropertyMenu.tsx +++ b/apps/client/src/widgets/react/NotePropertyMenu.tsx @@ -53,7 +53,7 @@ export interface ComboBoxItem { label: string; } -interface ComboBoxGroup { +export interface ComboBoxGroup { title: string; items: ComboBoxItem[]; } diff --git a/apps/client/src/widgets/ribbon/CollectionPropertiesTab.tsx b/apps/client/src/widgets/ribbon/CollectionPropertiesTab.tsx index 4af8247a3f..e25f2650c9 100644 --- a/apps/client/src/widgets/ribbon/CollectionPropertiesTab.tsx +++ b/apps/client/src/widgets/ribbon/CollectionPropertiesTab.tsx @@ -1,18 +1,20 @@ -import { useContext, useMemo } from "preact/hooks"; -import { t } from "../../services/i18n"; -import FormSelect, { FormSelectWithGroups } from "../react/FormSelect"; -import { TabContext } from "./ribbon-interface"; -import { mapToKeyValueArray } from "../../services/utils"; -import { useNoteLabel, useNoteLabelBoolean } from "../react/hooks"; -import { bookPropertiesConfig, BookProperty, ButtonProperty, CheckBoxProperty, ComboBoxProperty, NumberProperty, SplitButtonProperty } from "./collection-properties-config"; -import Button, { SplitButton } from "../react/Button"; -import { ParentComponent } from "../react/react_utils"; -import FNote from "../../entities/fnote"; -import FormCheckbox from "../react/FormCheckbox"; -import FormTextBox from "../react/FormTextBox"; import { ComponentChildren } from "preact"; -import { ViewTypeOptions } from "../collections/interface"; +import { useContext, useMemo } from "preact/hooks"; + +import FNote from "../../entities/fnote"; import { isExperimentalFeatureEnabled } from "../../services/experimental_features"; +import { t } from "../../services/i18n"; +import { mapToKeyValueArray } from "../../services/utils"; +import { ViewTypeOptions } from "../collections/interface"; +import Button, { SplitButton } from "../react/Button"; +import FormCheckbox from "../react/FormCheckbox"; +import FormSelect, { FormSelectWithGroups } from "../react/FormSelect"; +import FormTextBox from "../react/FormTextBox"; +import { useNoteLabel, useNoteLabelBoolean } from "../react/hooks"; +import { BookProperty, ButtonProperty, CheckBoxProperty, ComboBoxGroup, ComboBoxItem, ComboBoxProperty, NumberProperty, SplitButtonProperty } from "../react/NotePropertyMenu"; +import { ParentComponent } from "../react/react_utils"; +import { bookPropertiesConfig } from "./collection-properties-config"; +import { TabContext } from "./ribbon-interface"; export const VIEW_TYPE_MAPPINGS: Record = { grid: t("book_properties.grid"), @@ -50,70 +52,70 @@ export function useViewType(note: FNote | null | undefined) { } function CollectionTypeSwitcher({ viewType, setViewType }: { viewType: string, setViewType: (newValue: string) => void }) { - const collectionTypes = useMemo(() => mapToKeyValueArray(VIEW_TYPE_MAPPINGS), []); + const collectionTypes = useMemo(() => mapToKeyValueArray(VIEW_TYPE_MAPPINGS), []); - return ( -
- {t("book_properties.view_type")}:    - -
- ) + return ( +
+ {t("book_properties.view_type")}:    + +
+ ); } -function BookProperties({ viewType, note, properties }: { viewType: ViewTypeOptions, note: FNote, properties: BookProperty[] }) { - return ( - <> - {properties.map(property => ( -
- {mapPropertyView({ note, property })} -
- ))} +function BookProperties({ note, properties }: { viewType: ViewTypeOptions, note: FNote, properties: BookProperty[] }) { + return ( + <> + {properties.map((property, index) => ( +
+ {mapPropertyView({ note, property })} +
+ ))} - - - ) + + + ); } function mapPropertyView({ note, property }: { note: FNote, property: BookProperty }) { - switch (property.type) { - case "button": - return - case "split-button": - return - case "checkbox": - return - case "number": - return - case "combobox": - return - } + switch (property.type) { + case "button": + return ; + case "split-button": + return ; + case "checkbox": + return ; + case "number": + return ; + case "combobox": + return ; + } } function ButtonPropertyView({ note, property }: { note: FNote, property: ButtonProperty }) { - const parentComponent = useContext(ParentComponent); + const parentComponent = useContext(ParentComponent); - return