diff --git a/dist/index.css b/dist/index.css index 98e84968..da27e477 100644 --- a/dist/index.css +++ b/dist/index.css @@ -497,6 +497,9 @@ body[showing-chat] #chat-page-wrapper { .month-grid .tile { animation: slide-up var(--animation-duration); } +.month-grid .tile[today] b { + color: var(--primary); +} .month-grid .tile > div { display: flex; flex-direction: column; diff --git a/dist/index.js b/dist/index.js index 50f69da9..8ac2e560 100644 --- a/dist/index.js +++ b/dist/index.js @@ -650,6 +650,7 @@ }; generateMonthGrid = (year, month, defaultValueCreator) => { const date = /* @__PURE__ */ new Date(); + const isCurrentMonth = year == date.getFullYear() && month == date.getMonth() + 1; date.setFullYear(year); date.setMonth(month - 1); date.setDate(1); @@ -660,6 +661,7 @@ const grid = { offset, firstDayOfWeek: parseInt(this.settingsModel.firstDayOfWeek), + isCurrentMonth, days: {} }; for (let i = 0; i < daysInMonth; i++) { @@ -1618,6 +1620,7 @@ selectedMonth = new State(0); selectedDate = new State(0); monthGrid = new State(void 0); + selectedTaskViewModel = new State(void 0); // view getTaskMapState = (taskFileContent) => { if (this.monthGrid.value == null) return null; @@ -2546,16 +2549,26 @@ [selectedDate], () => selectedDate.value == parseInt(date) ); + const isToday = monthGrid.isCurrentMonth == true && parseInt(date) == (/* @__PURE__ */ new Date()).getDate(); function select() { selectedDate.value = parseInt(date); } - return /* @__PURE__ */ createElement("button", { class: "tile", "on:click": select, "toggle:selected": isSelected }, /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("b", null, date), /* @__PURE__ */ createElement( - "div", + return /* @__PURE__ */ createElement( + "button", { - class: "flex-column gap clip", - "children:append": [mapState, converter] - } - ))); + class: "tile", + "on:click": select, + "toggle:selected": isSelected, + "toggle:today": isToday + }, + /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("b", null, date), /* @__PURE__ */ createElement( + "div", + { + class: "flex-column gap clip", + "children:append": [mapState, converter] + } + )) + ); }))); } @@ -2624,7 +2637,7 @@ "aria-label": translations.chatPage.task.createTaskButtonAudioLabel }, /* @__PURE__ */ createElement("span", { class: "icon" }, "add") - ))), /* @__PURE__ */ createElement("div", { class: "content", "children:set": mainContent })))); + ))), /* @__PURE__ */ createElement("div", { class: "content", "children:set": mainContent }))), /* @__PURE__ */ createElement("div", { class: "pane-wrapper side" }, /* @__PURE__ */ createElement("div", { class: "pane" }, "hello"))); } // src/View/Components/ribbonButton.tsx diff --git a/src/Model/Files/calendarModel.ts b/src/Model/Files/calendarModel.ts index 32fef9ff..b5270118 100644 --- a/src/Model/Files/calendarModel.ts +++ b/src/Model/Files/calendarModel.ts @@ -52,8 +52,12 @@ export default class CalendarModel { month: number, defaultValueCreator: () => T ): MonthGrid => { - // get first day of month + // get today const date: Date = new Date(); + const isCurrentMonth: boolean = + year == date.getFullYear() && month == date.getMonth() + 1; + + // get first day of month date.setFullYear(year); date.setMonth(month - 1); date.setDate(1); @@ -70,6 +74,7 @@ export default class CalendarModel { const grid: MonthGrid = { offset, firstDayOfWeek: parseInt(this.settingsModel.firstDayOfWeek), + isCurrentMonth, days: {}, }; @@ -117,5 +122,6 @@ export enum CalendarModelSubPaths { export interface MonthGrid { offset: number; firstDayOfWeek: number; + isCurrentMonth: boolean; days: { [date: string]: T }; } diff --git a/src/View/ChatPages/calendarPage.tsx b/src/View/ChatPages/calendarPage.tsx index 0b987c0b..fca88b76 100644 --- a/src/View/ChatPages/calendarPage.tsx +++ b/src/View/ChatPages/calendarPage.tsx @@ -97,6 +97,9 @@ export function CalendarPage(calendarPageViewModel: CalendarPageViewModel) {
+
+
hello
+
); } diff --git a/src/View/Components/monthGrid.css b/src/View/Components/monthGrid.css index bb34c203..bf037436 100644 --- a/src/View/Components/monthGrid.css +++ b/src/View/Components/monthGrid.css @@ -27,6 +27,10 @@ animation: slide-up var(--animation-duration); } +.month-grid .tile[today] b { + color: var(--primary) +} + .month-grid .tile > div { display: flex; flex-direction: column; diff --git a/src/View/Components/monthGrid.tsx b/src/View/Components/monthGrid.tsx index 87df54c6..56d04fdb 100644 --- a/src/View/Components/monthGrid.tsx +++ b/src/View/Components/monthGrid.tsx @@ -45,12 +45,21 @@ export function MonthGrid( () => selectedDate.value == parseInt(date) ); + const isToday: boolean = + monthGrid.isCurrentMonth == true && + parseInt(date) == new Date().getDate(); + function select() { selectedDate.value = parseInt(date); } return ( -