add navigation for calendar
This commit is contained in:
@@ -381,7 +381,6 @@ export class Chat {
|
||||
}
|
||||
|
||||
const latest = this.getMostRecentContent(messageObject);
|
||||
if (!latest) return;
|
||||
if (latest.categoryName) usedObjectCategories.add(latest.categoryName);
|
||||
if (latest.status) usedObjectStatuses.add(latest.status);
|
||||
};
|
||||
|
||||
@@ -151,6 +151,8 @@ export const isPresentingSettingsModal = new React.State(false);
|
||||
export const isEncryptionAvailable = window.crypto.subtle != undefined;
|
||||
export const senderName = React.restoreState("sender-name", "");
|
||||
export const pageZoom = React.restoreState("page-zoom", 100);
|
||||
export const dayInCalendar = React.restoreState("calendar-day", new Date().toISOString().split("T")[0])
|
||||
|
||||
pageZoom.subscribe(() => {
|
||||
document.body.style.zoom = `${pageZoom.value}%`;
|
||||
document.body.style.webkitTextSizeAdjust = `${pageZoom.value}%`;
|
||||
|
||||
@@ -3,6 +3,8 @@ import * as React from "bloatless-react";
|
||||
import { Chat, MessageObject } from "../../Model/chatModel";
|
||||
|
||||
import { ObjectGridView } from "./objectGridView";
|
||||
import { DayView } from "./dayView";
|
||||
import { dayInCalendar } from "../../Model/model";
|
||||
|
||||
export function CalendarView(
|
||||
chat: Chat,
|
||||
@@ -10,19 +12,10 @@ export function CalendarView(
|
||||
selectedObject: React.State<MessageObject | undefined>,
|
||||
isShowingObjectModal: React.State<boolean>
|
||||
) {
|
||||
const notes = new React.ListState<MessageObject>();
|
||||
messageObjects.handleAddition((messageObject) => {
|
||||
const latest = chat.getMostRecentContent(messageObject);
|
||||
if (!latest) return;
|
||||
if (!latest.date) return;
|
||||
|
||||
notes.add(messageObject);
|
||||
messageObjects.handleRemoval(messageObject, () =>
|
||||
notes.remove(messageObject)
|
||||
);
|
||||
});
|
||||
|
||||
return <div class="width-100 height-100 scroll-v padding">
|
||||
{ObjectGridView(chat, notes, selectedObject, isShowingObjectModal)}
|
||||
</div>;
|
||||
return <div class="calendar-wrapper">
|
||||
<div class="month-grid">
|
||||
<input type="date" bind:value={dayInCalendar}></input>
|
||||
</div>
|
||||
{DayView(chat, messageObjects, selectedObject, isShowingObjectModal)}
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import * as React from "bloatless-react";
|
||||
|
||||
import { Chat, MessageObject } from "../../Model/chatModel";
|
||||
|
||||
import { ObjectEntryView } from "./objectEntryView";
|
||||
import { dayInCalendar } from "../../Model/model";
|
||||
|
||||
export function DayView(
|
||||
chat: Chat,
|
||||
messageObjects:
|
||||
| React.ListState<MessageObject>
|
||||
| React.MapState<MessageObject>,
|
||||
selectedObject: React.State<MessageObject | undefined>,
|
||||
isShowingObjectModal: React.State<boolean>
|
||||
) {
|
||||
const objectsForDayView = new React.ListState<MessageObject>();
|
||||
|
||||
function processObject(messageObject: MessageObject) {
|
||||
const latest = chat.getMostRecentContent(messageObject);
|
||||
if (!latest.date || latest.date != dayInCalendar.value) return;
|
||||
|
||||
objectsForDayView.add(messageObject);
|
||||
messageObjects.handleRemoval(messageObject, () => {
|
||||
objectsForDayView.remove(messageObject);
|
||||
})
|
||||
}
|
||||
|
||||
messageObjects.handleAddition(processObject);
|
||||
dayInCalendar.subscribeSilent(() => {
|
||||
objectsForDayView.clear();
|
||||
chat.objects.value.forEach(processObject);
|
||||
})
|
||||
|
||||
const objectConverter: React.StateItemConverter<MessageObject> = (
|
||||
messageObject
|
||||
) => {
|
||||
const latest = chat.getMostRecentContent(messageObject);
|
||||
const timeString = latest.time ?? "00:00";
|
||||
const [hour, minute] = timeString.split(":");
|
||||
const hourInMinutes = parseInt(hour) * 60;
|
||||
const minutesTotal = parseInt(minute) + hourInMinutes;
|
||||
|
||||
const view = ObjectEntryView(
|
||||
chat,
|
||||
messageObject,
|
||||
selectedObject,
|
||||
isShowingObjectModal
|
||||
);
|
||||
view.style.order = minutesTotal;
|
||||
return view;
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
class="day-view padding flex-column gap"
|
||||
children:prepend={[objectsForDayView, objectConverter]}
|
||||
></div>
|
||||
);
|
||||
}
|
||||
@@ -30,7 +30,6 @@ export function KanbanView(
|
||||
|
||||
messageObjects.handleAddition((messageObject) => {
|
||||
const latest = chat.getMostRecentContent(messageObject);
|
||||
if (!latest) return;
|
||||
if (!latest.categoryName) return;
|
||||
|
||||
const categoryName = latest.categoryName!;
|
||||
|
||||
@@ -13,7 +13,6 @@ export function NoteObjectsView(
|
||||
const notes = new React.ListState<MessageObject>();
|
||||
messageObjects.handleAddition((messageObject) => {
|
||||
const latest = chat.getMostRecentContent(messageObject);
|
||||
if (!latest) return;
|
||||
if (!latest.noteContent) return;
|
||||
|
||||
notes.add(messageObject);
|
||||
|
||||
@@ -145,7 +145,6 @@ function StatusHeaderView(chat: Chat, status: StatusData) {
|
||||
function rename() {
|
||||
status.items.forEach((messageObject) => {
|
||||
const latest = chat.getMostRecentContent(messageObject);
|
||||
if (!latest) return;
|
||||
|
||||
latest.status = editingStatus.value;
|
||||
chat.addObject(messageObject);
|
||||
|
||||
+60
-7
@@ -60,14 +60,13 @@
|
||||
width: var(--split-thread-width);
|
||||
}
|
||||
|
||||
@media (max-width: 1300px) {
|
||||
main:has([showingobjects][chatopen]) {
|
||||
display: flex;
|
||||
}
|
||||
/* hide settings tab */
|
||||
main:has([showingobjects][chatopen]) {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
main:has([showingobjects][chatopen]) #settings-tab {
|
||||
display: none;
|
||||
}
|
||||
main:has([showingobjects][chatopen]) #settings-tab {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
@@ -93,3 +92,57 @@
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
/* calendar */
|
||||
:root {
|
||||
--day-view-width: 400px;
|
||||
}
|
||||
|
||||
.calendar-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.calendar-wrapper .month-grid {
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.calendar-wrapper > * {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
@media (min-width: 900px) {
|
||||
.calendar-wrapper:not([chatvisible] *) {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.calendar-wrapper:not([chatvisible] *) .month-grid {
|
||||
border-bottom: none;
|
||||
border-right: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.calendar-wrapper:not([chatvisible] *) .day-view {
|
||||
max-width: var(--day-view-width);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.calendar-wrapper {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.calendar-wrapper .month-grid {
|
||||
border-bottom: none;
|
||||
border-right: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.calendar-wrapper .day-view {
|
||||
max-width: var(--day-view-width);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user