prepare side pane, highlight today
This commit is contained in:
Vendored
+3
@@ -497,6 +497,9 @@ body[showing-chat] #chat-page-wrapper {
|
|||||||
.month-grid .tile {
|
.month-grid .tile {
|
||||||
animation: slide-up var(--animation-duration);
|
animation: slide-up var(--animation-duration);
|
||||||
}
|
}
|
||||||
|
.month-grid .tile[today] b {
|
||||||
|
color: var(--primary);
|
||||||
|
}
|
||||||
.month-grid .tile > div {
|
.month-grid .tile > div {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
Vendored
+16
-3
@@ -650,6 +650,7 @@
|
|||||||
};
|
};
|
||||||
generateMonthGrid = (year, month, defaultValueCreator) => {
|
generateMonthGrid = (year, month, defaultValueCreator) => {
|
||||||
const date = /* @__PURE__ */ new Date();
|
const date = /* @__PURE__ */ new Date();
|
||||||
|
const isCurrentMonth = year == date.getFullYear() && month == date.getMonth() + 1;
|
||||||
date.setFullYear(year);
|
date.setFullYear(year);
|
||||||
date.setMonth(month - 1);
|
date.setMonth(month - 1);
|
||||||
date.setDate(1);
|
date.setDate(1);
|
||||||
@@ -660,6 +661,7 @@
|
|||||||
const grid = {
|
const grid = {
|
||||||
offset,
|
offset,
|
||||||
firstDayOfWeek: parseInt(this.settingsModel.firstDayOfWeek),
|
firstDayOfWeek: parseInt(this.settingsModel.firstDayOfWeek),
|
||||||
|
isCurrentMonth,
|
||||||
days: {}
|
days: {}
|
||||||
};
|
};
|
||||||
for (let i = 0; i < daysInMonth; i++) {
|
for (let i = 0; i < daysInMonth; i++) {
|
||||||
@@ -1618,6 +1620,7 @@
|
|||||||
selectedMonth = new State(0);
|
selectedMonth = new State(0);
|
||||||
selectedDate = new State(0);
|
selectedDate = new State(0);
|
||||||
monthGrid = new State(void 0);
|
monthGrid = new State(void 0);
|
||||||
|
selectedTaskViewModel = new State(void 0);
|
||||||
// view
|
// view
|
||||||
getTaskMapState = (taskFileContent) => {
|
getTaskMapState = (taskFileContent) => {
|
||||||
if (this.monthGrid.value == null) return null;
|
if (this.monthGrid.value == null) return null;
|
||||||
@@ -2546,16 +2549,26 @@
|
|||||||
[selectedDate],
|
[selectedDate],
|
||||||
() => selectedDate.value == parseInt(date)
|
() => selectedDate.value == parseInt(date)
|
||||||
);
|
);
|
||||||
|
const isToday = monthGrid.isCurrentMonth == true && parseInt(date) == (/* @__PURE__ */ new Date()).getDate();
|
||||||
function select() {
|
function select() {
|
||||||
selectedDate.value = parseInt(date);
|
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(
|
return /* @__PURE__ */ createElement(
|
||||||
|
"button",
|
||||||
|
{
|
||||||
|
class: "tile",
|
||||||
|
"on:click": select,
|
||||||
|
"toggle:selected": isSelected,
|
||||||
|
"toggle:today": isToday
|
||||||
|
},
|
||||||
|
/* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("b", null, date), /* @__PURE__ */ createElement(
|
||||||
"div",
|
"div",
|
||||||
{
|
{
|
||||||
class: "flex-column gap clip",
|
class: "flex-column gap clip",
|
||||||
"children:append": [mapState, converter]
|
"children:append": [mapState, converter]
|
||||||
}
|
}
|
||||||
)));
|
))
|
||||||
|
);
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2624,7 +2637,7 @@
|
|||||||
"aria-label": translations.chatPage.task.createTaskButtonAudioLabel
|
"aria-label": translations.chatPage.task.createTaskButtonAudioLabel
|
||||||
},
|
},
|
||||||
/* @__PURE__ */ createElement("span", { class: "icon" }, "add")
|
/* @__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
|
// src/View/Components/ribbonButton.tsx
|
||||||
|
|||||||
@@ -52,8 +52,12 @@ export default class CalendarModel {
|
|||||||
month: number,
|
month: number,
|
||||||
defaultValueCreator: () => T
|
defaultValueCreator: () => T
|
||||||
): MonthGrid<T> => {
|
): MonthGrid<T> => {
|
||||||
// get first day of month
|
// get today
|
||||||
const date: Date = new Date();
|
const date: Date = new Date();
|
||||||
|
const isCurrentMonth: boolean =
|
||||||
|
year == date.getFullYear() && month == date.getMonth() + 1;
|
||||||
|
|
||||||
|
// get first day of month
|
||||||
date.setFullYear(year);
|
date.setFullYear(year);
|
||||||
date.setMonth(month - 1);
|
date.setMonth(month - 1);
|
||||||
date.setDate(1);
|
date.setDate(1);
|
||||||
@@ -70,6 +74,7 @@ export default class CalendarModel {
|
|||||||
const grid: MonthGrid<T> = {
|
const grid: MonthGrid<T> = {
|
||||||
offset,
|
offset,
|
||||||
firstDayOfWeek: parseInt(this.settingsModel.firstDayOfWeek),
|
firstDayOfWeek: parseInt(this.settingsModel.firstDayOfWeek),
|
||||||
|
isCurrentMonth,
|
||||||
days: {},
|
days: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -117,5 +122,6 @@ export enum CalendarModelSubPaths {
|
|||||||
export interface MonthGrid<T> {
|
export interface MonthGrid<T> {
|
||||||
offset: number;
|
offset: number;
|
||||||
firstDayOfWeek: number;
|
firstDayOfWeek: number;
|
||||||
|
isCurrentMonth: boolean;
|
||||||
days: { [date: string]: T };
|
days: { [date: string]: T };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,6 +97,9 @@ export function CalendarPage(calendarPageViewModel: CalendarPageViewModel) {
|
|||||||
<div class="content" children:set={mainContent}></div>
|
<div class="content" children:set={mainContent}></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="pane-wrapper side">
|
||||||
|
<div class="pane">hello</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,10 @@
|
|||||||
animation: slide-up var(--animation-duration);
|
animation: slide-up var(--animation-duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.month-grid .tile[today] b {
|
||||||
|
color: var(--primary)
|
||||||
|
}
|
||||||
|
|
||||||
.month-grid .tile > div {
|
.month-grid .tile > div {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -45,12 +45,21 @@ export function MonthGrid<T>(
|
|||||||
() => selectedDate.value == parseInt(date)
|
() => selectedDate.value == parseInt(date)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const isToday: boolean =
|
||||||
|
monthGrid.isCurrentMonth == true &&
|
||||||
|
parseInt(date) == new Date().getDate();
|
||||||
|
|
||||||
function select() {
|
function select() {
|
||||||
selectedDate.value = parseInt(date);
|
selectedDate.value = parseInt(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button class="tile" on:click={select} toggle:selected={isSelected}>
|
<button
|
||||||
|
class="tile"
|
||||||
|
on:click={select}
|
||||||
|
toggle:selected={isSelected}
|
||||||
|
toggle:today={isToday}
|
||||||
|
>
|
||||||
<div>
|
<div>
|
||||||
<b>{date}</b>
|
<b>{date}</b>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ export default class CalendarPageViewModel {
|
|||||||
monthGrid: React.State<MonthGrid<React.MapState<TaskViewModel>> | undefined> =
|
monthGrid: React.State<MonthGrid<React.MapState<TaskViewModel>> | undefined> =
|
||||||
new React.State<any>(undefined);
|
new React.State<any>(undefined);
|
||||||
|
|
||||||
|
selectedTaskViewModel: React.State<TaskViewModel | undefined> =
|
||||||
|
new React.State<any>(undefined);
|
||||||
|
|
||||||
// view
|
// view
|
||||||
getTaskMapState = (
|
getTaskMapState = (
|
||||||
taskFileContent: TaskFileContent
|
taskFileContent: TaskFileContent
|
||||||
|
|||||||
Reference in New Issue
Block a user