add more object content fields

This commit is contained in:
marlon-erler
2024-07-11 21:30:57 +02:00
parent 990f115463
commit 9a312780d1
4 changed files with 125 additions and 12 deletions
+4
View File
@@ -39,6 +39,10 @@ export interface MessageObjectContent {
id: string;
noteContent?: string;
categoryName?: string;
isoDate?: string;
isoTime?: string;
priority?: number;
}
// chat
+66 -2
View File
@@ -21,13 +21,30 @@ export function ObjectDetailModal(
chat.getObjectContentFromId(messageObject, selectedMessageObjectId.value)
);
// properties
const didEditContent = new React.State(false);
const editingNoteContent = React.createProxyState(
[selectedMessageObject],
() => selectedMessageObject.value.noteContent ?? ""
);
const editingCategory = React.createProxyState(
[selectedMessageObject],
() => selectedMessageObject.value.categoryName ?? ""
);
const editingDate = React.createProxyState(
[selectedMessageObject],
() => selectedMessageObject.value.isoDate ?? new Date().toISOString()
);
const editingTime = React.createProxyState(
[selectedMessageObject],
() => selectedMessageObject.value.isoTime ?? new Date().toISOString()
);
const editingPriority = React.createProxyState(
[selectedMessageObject],
() => selectedMessageObject.value.priority ?? 0
);
React.bulkSubscribe(
[editingNoteContent],
[editingNoteContent, editingCategory, editingDate, editingPriority],
() => (didEditContent.value = true)
);
@@ -56,6 +73,10 @@ export function ObjectDetailModal(
id: React.UUID(),
noteContent: editingNoteContent.value,
priority: editingPriority.value,
categoryName: editingCategory.value,
isoDate: editingDate.value,
isoTime: editingTime.value,
});
}
@@ -115,10 +136,12 @@ export function ObjectDetailModal(
</div>
</label>
<hr></hr>
<label class="tile">
<span class="icon">sticky_note_2</span>
<div>
<span>{translation.noteContent}</span>
<span>{translation.note}</span>
<textarea
rows="5"
bind:value={editingNoteContent}
@@ -127,6 +150,47 @@ export function ObjectDetailModal(
</div>
</label>
<label class="tile">
<span class="icon">category</span>
<div>
<span>{translation.category}</span>
<input
bind:value={editingCategory}
placeholder={translation.categoryPlaceholder}
></input>
</div>
</label>
<label class="tile">
<span class="icon">priority_high</span>
<div>
<span>{translation.priority}</span>
<input
type="number"
bind:value={editingPriority}
placeholder={translation.priorityPlaceholder}
></input>
</div>
</label>
<hr></hr>
<label class="tile">
<span class="icon">calendar_month</span>
<div>
<span>{translation.date}</span>
<input type="date" bind:value={editingDate}></input>
</div>
</label>
<label class="tile">
<span class="icon">schedule</span>
<div>
<span>{translation.time}</span>
<input type="time" bind:value={editingTime}></input>
</div>
</label>
<hr></hr>
<button class="danger width-input" on:click={deleteAndClose}>
+9 -3
View File
@@ -96,8 +96,14 @@ const englishTranslations = {
objectTitlePlaceholder: "My object",
objectVersion: "Object version",
noteContent: "Note",
note: "Note",
noteContentPlaceholder: "Take a note...",
category: "Category",
priority: "Priority",
priorityPlaceholder: "2",
categoryPlaceholder: "Define a category",
date: "Date",
time: "Time",
resendObjects: "Resend all objects",
deleteObject: "Delete object",
@@ -203,7 +209,7 @@ const allTranslations: { [key: string]: typeof englishTranslations } = {
objectTitlePlaceholder: "Mi objeto",
objectVersion: "Version del objeto",
noteContent: "Nota",
note: "Nota",
noteContentPlaceholder: "Toma nota...",
resendObjects: "Reenviar todos objetos",
@@ -307,7 +313,7 @@ const allTranslations: { [key: string]: typeof englishTranslations } = {
objectTitlePlaceholder: "Mein Objekt",
objectVersion: "Version des Objekts",
noteContent: "Notiz",
note: "Notiz",
noteContentPlaceholder: "Notiz eingeben...",
resendObjects: "Objekte erneut senden",