diff --git a/apps/client/src/stylesheets/theme-next/shell.css b/apps/client/src/stylesheets/theme-next/shell.css index 77d2a9ba6..fa3cda1e0 100644 --- a/apps/client/src/stylesheets/theme-next/shell.css +++ b/apps/client/src/stylesheets/theme-next/shell.css @@ -212,7 +212,7 @@ body[dir=ltr] #launcher-container { } #launcher-pane .launcher-button, -#launcher-pane .dropdown { +#launcher-pane .right-dropdown-widget { width: calc(var(--launcher-pane-size) - (var(--launcher-pane-button-margin) * 2)) !important; height: calc(var(--launcher-pane-size) - (var(--launcher-pane-button-margin) * 2)) !important; margin: var(--launcher-pane-button-gap) var(--launcher-pane-button-margin); diff --git a/apps/client/src/widgets/buttons/calendar.ts b/apps/client/src/widgets/buttons/calendar.ts index a8f507fd1..22a62e193 100644 --- a/apps/client/src/widgets/buttons/calendar.ts +++ b/apps/client/src/widgets/buttons/calendar.ts @@ -10,20 +10,7 @@ import type { EventData } from "../../components/app_context.js"; import { dayjs, type Dayjs } from "@triliumnext/commons"; import type { AttributeRow, OptionDefinitions } from "@triliumnext/commons"; -const MONTHS = [ - t("calendar.january"), - t("calendar.february"), - t("calendar.march"), - t("calendar.april"), - t("calendar.may"), - t("calendar.june"), - t("calendar.july"), - t("calendar.august"), - t("calendar.september"), - t("calendar.october"), - t("calendar.november"), - t("calendar.december") -]; + const DROPDOWN_TPL = `
diff --git a/apps/client/src/widgets/launch_bar/CalendarWidget.tsx b/apps/client/src/widgets/launch_bar/CalendarWidget.tsx index 557d05f5e..cda7b8444 100644 --- a/apps/client/src/widgets/launch_bar/CalendarWidget.tsx +++ b/apps/client/src/widgets/launch_bar/CalendarWidget.tsx @@ -1,4 +1,4 @@ -import { Dispatch, StateUpdater, useEffect, useState } from "preact/hooks"; +import { Dispatch, StateUpdater, useEffect, useMemo, useState } from "preact/hooks"; import FNote from "../../entities/fnote"; import { LaunchBarDropdownButton, useLauncherIconAndTitle } from "./launch_bar_widgets"; import { Dayjs, dayjs } from "@triliumnext/commons"; @@ -6,6 +6,24 @@ import appContext from "../../components/app_context"; import "./CalendarWidget.css"; import Calendar from "./Calendar"; import ActionButton from "../react/ActionButton"; +import Dropdown from "../react/Dropdown"; +import { t } from "../../services/i18n"; +import FormDropdownList from "../react/FormDropdownList"; + +const MONTHS = [ + t("calendar.january"), + t("calendar.february"), + t("calendar.march"), + t("calendar.april"), + t("calendar.may"), + t("calendar.june"), + t("calendar.july"), + t("calendar.august"), + t("calendar.september"), + t("calendar.october"), + t("calendar.november"), + t("calendar.december") +]; export default function CalendarWidget({ launcherNote }: { launcherNote: FNote }) { const { title, icon } = useLauncherIconAndTitle(launcherNote); @@ -21,6 +39,9 @@ export default function CalendarWidget({ launcherNote }: { launcherNote: FNote } const date = dayjs(activeDate || todaysDate).startOf('month'); setDate(date); }} + dropdownOptions={{ + autoClose: "outside" + }} > {date &&