prepare calendar view

This commit is contained in:
marlon-erler
2024-07-18 14:54:11 +02:00
parent 5f9a6094dc
commit 4e068a8666
4 changed files with 58 additions and 1 deletions
+23 -1
View File
@@ -516,6 +516,7 @@
viewNotes: "Notes", viewNotes: "Notes",
viewKanban: "Kanban", viewKanban: "Kanban",
viewStatus: "Status", viewStatus: "Status",
viewCalendar: "Calendar",
noObjects: "No objects", noObjects: "No objects",
objectTitle: "Object title", objectTitle: "Object title",
objectTitlePlaceholder: "My object", objectTitlePlaceholder: "My object",
@@ -622,6 +623,7 @@
viewNotes: "Notas", viewNotes: "Notas",
viewKanban: "Kanban", viewKanban: "Kanban",
viewStatus: "Estado", viewStatus: "Estado",
viewCalendar: "Calendario",
noObjects: "Sin objetos", noObjects: "Sin objetos",
objectTitle: "T\xEDtulo", objectTitle: "T\xEDtulo",
objectTitlePlaceholder: "Mi objeto", objectTitlePlaceholder: "Mi objeto",
@@ -726,6 +728,7 @@
viewNotes: "Notizen", viewNotes: "Notizen",
viewKanban: "Kanban", viewKanban: "Kanban",
viewStatus: "Status", viewStatus: "Status",
viewCalendar: "Kalender",
noObjects: "Keine Objekte", noObjects: "Keine Objekte",
objectTitle: "Titel", objectTitle: "Titel",
objectTitlePlaceholder: "Mein Objekt", objectTitlePlaceholder: "Mein Objekt",
@@ -2063,12 +2066,29 @@
); );
} }
// src/Views/Objects/calendarView.tsx
function CalendarView(chat, messageObjects, selectedObject, isShowingObjectModal) {
const notes = new ListState();
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 /* @__PURE__ */ createElement("div", { class: "width-100 height-100 scroll-v padding" }, ObjectGridView(chat, notes, selectedObject, isShowingObjectModal));
}
// src/Views/Objects/objectPane.tsx // src/Views/Objects/objectPane.tsx
var viewTypes = { var viewTypes = {
all: [translation.viewAll, "grid_view"], all: [translation.viewAll, "grid_view"],
notes: [translation.viewNotes, icons.noteContent], notes: [translation.viewNotes, icons.noteContent],
kanban: [translation.viewKanban, "view_kanban"], kanban: [translation.viewKanban, "view_kanban"],
status: [translation.viewStatus, icons.status] status: [translation.viewStatus, icons.status],
calendar: [translation.viewCalendar, icons.date]
}; };
function ObjectPane(chat) { function ObjectPane(chat) {
const isShowingObjectModal = new State(false); const isShowingObjectModal = new State(false);
@@ -2168,6 +2188,8 @@
return KanbanView; return KanbanView;
case "status": case "status":
return StatusView; return StatusView;
case "calendar":
return CalendarView;
default: default:
return AllObjectsView; return AllObjectsView;
} }
+28
View File
@@ -0,0 +1,28 @@
import * as React from "bloatless-react";
import { Chat, MessageObject } from "../../Model/chatModel";
import { ObjectGridView } from "./objectGridView";
export function CalendarView(
chat: Chat,
messageObjects: React.MapState<MessageObject>,
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>;
}
+4
View File
@@ -12,12 +12,14 @@ import { icons } from "../../icons";
import { translation } from "../../translations"; import { translation } from "../../translations";
import { previousObjectSearches } from "../../Model/model"; import { previousObjectSearches } from "../../Model/model";
import { stringToOptionTag } from "../../utility"; import { stringToOptionTag } from "../../utility";
import { CalendarView } from "./calendarView";
export const viewTypes = { export const viewTypes = {
all: [translation.viewAll, "grid_view"], all: [translation.viewAll, "grid_view"],
notes: [translation.viewNotes, icons.noteContent], notes: [translation.viewNotes, icons.noteContent],
kanban: [translation.viewKanban, "view_kanban"], kanban: [translation.viewKanban, "view_kanban"],
status: [translation.viewStatus, icons.status], status: [translation.viewStatus, icons.status],
calendar: [translation.viewCalendar, icons.date],
}; };
export function ObjectPane(chat: Chat) { export function ObjectPane(chat: Chat) {
@@ -143,6 +145,8 @@ export function ObjectPane(chat: Chat) {
return KanbanView; return KanbanView;
case "status": case "status":
return StatusView; return StatusView;
case "calendar":
return CalendarView;
default: default:
return AllObjectsView; return AllObjectsView;
} }
+3
View File
@@ -114,6 +114,7 @@ const englishTranslations = {
viewNotes: "Notes", viewNotes: "Notes",
viewKanban: "Kanban", viewKanban: "Kanban",
viewStatus: "Status", viewStatus: "Status",
viewCalendar: "Calendar",
noObjects: "No objects", noObjects: "No objects",
@@ -254,6 +255,7 @@ const allTranslations: { [key: string]: typeof englishTranslations } = {
viewNotes: "Notas", viewNotes: "Notas",
viewKanban: "Kanban", viewKanban: "Kanban",
viewStatus: "Estado", viewStatus: "Estado",
viewCalendar: "Calendario",
noObjects: "Sin objetos", noObjects: "Sin objetos",
@@ -391,6 +393,7 @@ const allTranslations: { [key: string]: typeof englishTranslations } = {
viewNotes: "Notizen", viewNotes: "Notizen",
viewKanban: "Kanban", viewKanban: "Kanban",
viewStatus: "Status", viewStatus: "Status",
viewCalendar: "Kalender",
noObjects: "Keine Objekte", noObjects: "Keine Objekte",