diff --git a/apps/client/src/widgets/collections/calendar/index.css b/apps/client/src/widgets/collections/calendar/index.css index b5e9fb130..196609abd 100644 --- a/apps/client/src/widgets/collections/calendar/index.css +++ b/apps/client/src/widgets/collections/calendar/index.css @@ -59,34 +59,6 @@ overflow: hidden; } -/* #region Header */ -.calendar-view .calendar-header { - margin-bottom: 10px; - display: flex; - align-items: center; - gap: 10px; -} - -.calendar-view .calendar-header .btn { - min-width: unset !important; -} - -.calendar-view .calendar-header > .title { - flex-grow: 1; - font-size: 1.3rem; - font-weight: normal; -} - -body.desktop:not(.zen):not(.experimental-feature-new-layout) .calendar-view .calendar-header { - padding-block-start: 4px; - padding-inline-end: 5em; -} - -.search-result-widget-content .calendar-view .calendar-header { - padding-inline-end: unset !important; -} -/* #endregion */ - /* #region Events */ /* diff --git a/apps/client/src/widgets/collections/calendar/index.tsx b/apps/client/src/widgets/collections/calendar/index.tsx index 0dde523c7..846fad044 100644 --- a/apps/client/src/widgets/collections/calendar/index.tsx +++ b/apps/client/src/widgets/collections/calendar/index.tsx @@ -14,6 +14,7 @@ import dialog from "../../../services/dialog"; import froca from "../../../services/froca"; import { t } from "../../../services/i18n"; import { isMobile } from "../../../services/utils"; +import CollectionProperties from "../../note_bars/CollectionProperties"; import ActionButton from "../../react/ActionButton"; import Button, { ButtonGroup } from "../../react/Button"; import { useNoteLabel, useNoteLabelBoolean, useResizeObserver, useSpacedUpdate, useTriliumEvent, useTriliumOption, useTriliumOptionInt } from "../../react/hooks"; @@ -41,24 +42,28 @@ const CALENDAR_VIEWS = [ { type: "timeGridWeek", name: t("calendar.week"), + icon: "bx bx-calendar-week", previousText: t("calendar.week_previous"), nextText: t("calendar.week_next") }, { type: "dayGridMonth", name: t("calendar.month"), + icon: "bx bx-calendar", previousText: t("calendar.month_previous"), nextText: t("calendar.month_next") }, { type: "multiMonthYear", name: t("calendar.year"), + icon: "bx bx-layer", previousText: t("calendar.year_previous"), nextText: t("calendar.year_next") }, { type: "listMonth", name: t("calendar.list"), + icon: "bx bx-list-ol", previousText: t("calendar.month_previous"), nextText: t("calendar.month_next") } @@ -140,7 +145,11 @@ export default function CalendarView({ note, noteIds }: ViewModeProps - + } + rightChildren={} + /> }) { - const { title, viewType: currentViewType } = useOnDatesSet(calendarRef); +function CalendarHeaderTitle({ calendarRef }: { calendarRef: RefObject }) { + const { title } = useOnDatesSet(calendarRef); + return {title}; +} + +function CalendarHeaderButtons({ calendarRef }: { calendarRef: RefObject }) { + const { viewType: currentViewType } = useOnDatesSet(calendarRef); const currentViewData = CALENDAR_VIEWS.find(v => calendarRef.current && v.type === currentViewType); return ( -
- {title} + <> {CALENDAR_VIEWS.map(viewData => ( -
+ ); } diff --git a/apps/client/src/widgets/layout/NoteTitleActions.tsx b/apps/client/src/widgets/layout/NoteTitleActions.tsx index dd1ed2342..6886acc7e 100644 --- a/apps/client/src/widgets/layout/NoteTitleActions.tsx +++ b/apps/client/src/widgets/layout/NoteTitleActions.tsx @@ -26,7 +26,6 @@ export default function NoteTitleActions() {
{noteType === "search" && } - {!isHiddenNote && note && noteType === "book" && }
diff --git a/apps/client/src/widgets/note_bars/CollectionProperties.css b/apps/client/src/widgets/note_bars/CollectionProperties.css index c4db1a8ae..5b0736c97 100644 --- a/apps/client/src/widgets/note_bars/CollectionProperties.css +++ b/apps/client/src/widgets/note_bars/CollectionProperties.css @@ -6,6 +6,7 @@ width: 100%; max-width: unset; font-size: 0.8em; + margin-bottom: 1em; .dropdown-menu { input.form-control { diff --git a/apps/client/src/widgets/note_bars/CollectionProperties.tsx b/apps/client/src/widgets/note_bars/CollectionProperties.tsx index d5c9ffb42..f6fd4ce89 100644 --- a/apps/client/src/widgets/note_bars/CollectionProperties.tsx +++ b/apps/client/src/widgets/note_bars/CollectionProperties.tsx @@ -1,6 +1,7 @@ import "./CollectionProperties.css"; import { t } from "i18next"; +import { ComponentChildren } from "preact"; import { useContext, useRef } from "preact/hooks"; import { Fragment } from "preact/jsx-runtime"; @@ -28,7 +29,11 @@ const ICON_MAPPINGS: Record = { presentation: "bx bx-rectangle" }; -export default function CollectionProperties({ note }: { note: FNote }) { +export default function CollectionProperties({ note, centerChildren, rightChildren }: { + note: FNote; + centerChildren?: ComponentChildren; + rightChildren?: ComponentChildren; +}) { const [ viewType, setViewType ] = useViewType(note); return ( @@ -36,6 +41,9 @@ export default function CollectionProperties({ note }: { note: FNote }) {
+ {centerChildren} +
+ {rightChildren}
);