diff --git a/apps/client/src/widgets/note_type.ts b/apps/client/src/widgets/note_type.ts index d1a40b408..1147d0ba6 100644 --- a/apps/client/src/widgets/note_type.ts +++ b/apps/client/src/widgets/note_type.ts @@ -65,19 +65,9 @@ export default class NoteTypeWidget extends NoteContextAwareWidget { return; } - for (const noteType of NOTE_TYPES.filter((nt) => !nt.reserved && !nt.static)) { + for (const noteType of ) { let $typeLink: JQuery; - const $title = $("").text(noteType.title); - - if (noteType.isNew) { - $title.append($(``).text(t("note_types.new-feature"))); - } - - if (noteType.isBeta) { - $title.append($(``).text(t("note_types.beta-feature"))); - } - if (noteType.type !== "code") { $typeLink = $('') .attr("data-note-type", noteType.type) diff --git a/apps/client/src/widgets/react/FormList.tsx b/apps/client/src/widgets/react/FormList.tsx index f3bf12ce4..bbb994758 100644 --- a/apps/client/src/widgets/react/FormList.tsx +++ b/apps/client/src/widgets/react/FormList.tsx @@ -63,15 +63,21 @@ export default function FormList({ children, onSelect, style, fullHeight }: Form ); } +export interface FormListBadge { + className?: string; + text: string; +} + interface FormListItemOpts { children: ComponentChildren; icon?: string; value?: string; title?: string; active?: boolean; + badges?: FormListBadge[]; } -export function FormListItem({ children, icon, value, title, active }: FormListItemOpts) { +export function FormListItem({ children, icon, value, title, active, badges }: FormListItemOpts) { return (   {children} + {badges && badges.map(({ className, text }) => ( + {text} + ))} ); } diff --git a/apps/client/src/widgets/ribbon/BasicPropertiesTab.tsx b/apps/client/src/widgets/ribbon/BasicPropertiesTab.tsx index e00787358..865898041 100644 --- a/apps/client/src/widgets/ribbon/BasicPropertiesTab.tsx +++ b/apps/client/src/widgets/ribbon/BasicPropertiesTab.tsx @@ -1,3 +1,42 @@ +import { useCallback, useMemo } from "preact/hooks"; +import Dropdown from "../react/Dropdown"; +import { NOTE_TYPES } from "../../services/note_types"; +import { FormListBadge, FormListItem } from "../react/FormList"; +import { t } from "../../services/i18n"; + export default function BasicPropertiesTab() { - return

Hi

; + return ( +
+ +
+ ); +} + +function NoteTypeWidget() { + const noteTypes = useMemo(() => NOTE_TYPES.filter((nt) => !nt.reserved && !nt.static), []); + + return ( + + {noteTypes.map(noteType => { + const badges: FormListBadge[] = []; + if (noteType.isNew) { + badges.push({ + className: "new-note-type-badge", + text: t("note_types.new-feature") + }); + } + if (noteType.isBeta) { + badges.push({ + text: t("note_types.beta-feature") + }); + } + + return ( + {noteType.title} + ); + })} + + ) } \ No newline at end of file diff --git a/apps/client/src/widgets/ribbon/Ribbon.tsx b/apps/client/src/widgets/ribbon/Ribbon.tsx index fc0646a86..dd2d0228b 100644 --- a/apps/client/src/widgets/ribbon/Ribbon.tsx +++ b/apps/client/src/widgets/ribbon/Ribbon.tsx @@ -101,7 +101,7 @@ const TAB_CONFIGURATION: TabConfiguration[] = [ export default function Ribbon() { const { note } = useNoteContext(); const context: TabContext = { note }; - const [ activeTab, setActiveTab ] = useState(); + const [ activeTab, setActiveTab ] = useState(8); const activeTabConfiguration = activeTab ? TAB_CONFIGURATION[activeTab] : undefined; return ( diff --git a/apps/client/src/widgets/ribbon/style.css b/apps/client/src/widgets/ribbon/style.css index 832388dd3..93190578e 100644 --- a/apps/client/src/widgets/ribbon/style.css +++ b/apps/client/src/widgets/ribbon/style.css @@ -91,4 +91,27 @@ .ribbon-tab-title.active .ribbon-tab-title-label { display: inline; +} + +.basic-properties-widget { + padding: 0px 12px 6px 12px; + display: flex; + align-items: baseline; + flex-wrap: wrap; +} + +.basic-properties-widget > * { + margin-top: 9px; + margin-bottom: 2px; +} + +.basic-properties-widget > * > :last-child { + margin-right: 30px; +} + +.note-type-container, +.editability-select-container, +.note-language-container { + display: flex; + align-items: center; } \ No newline at end of file diff --git a/apps/client/src/widgets/ribbon_widgets/basic_properties.ts b/apps/client/src/widgets/ribbon_widgets/basic_properties.ts index aaa2bf934..603dee60f 100644 --- a/apps/client/src/widgets/ribbon_widgets/basic_properties.ts +++ b/apps/client/src/widgets/ribbon_widgets/basic_properties.ts @@ -10,32 +10,6 @@ import type FNote from "../../entities/fnote.js"; import NoteLanguageWidget from "../note_language.js"; const TPL = /*html*/` -
- -
${t("basic_properties.note_type")}:  
@@ -55,7 +29,7 @@ const TPL = /*html*/`
${t("basic_properties.language")}:  
-
`; +`; export default class BasicPropertiesWidget extends NoteContextAwareWidget {