feat(client/tasks): create task list note type

This commit is contained in:
Elian Doran 2025-02-18 19:42:27 +02:00
parent 17f9fa7e89
commit 1024733252
No known key found for this signature in database
7 changed files with 39 additions and 6 deletions

View File

@ -28,7 +28,8 @@ const NOTE_TYPE_ICONS = {
doc: "bx bxs-file-doc",
contentWidget: "bx bxs-widget",
mindMap: "bx bx-sitemap",
geoMap: "bx bx-map-alt"
geoMap: "bx bx-map-alt",
taskList: "bx bx-list-check"
};
/**
@ -36,7 +37,7 @@ const NOTE_TYPE_ICONS = {
* end user. Those types should be used only for checking against, they are
* not for direct use.
*/
export type NoteType = "file" | "image" | "search" | "noteMap" | "launcher" | "doc" | "contentWidget" | "text" | "relationMap" | "render" | "canvas" | "mermaid" | "book" | "webView" | "code" | "mindMap" | "geoMap";
export type NoteType = "file" | "image" | "search" | "noteMap" | "launcher" | "doc" | "contentWidget" | "text" | "relationMap" | "render" | "canvas" | "mermaid" | "book" | "webView" | "code" | "mindMap" | "geoMap" | "taskList";
export interface NotePathRecord {
isArchived: boolean;

View File

@ -20,6 +20,7 @@ async function getNoteTypeItems(command?: NoteTypeCommandNames) {
{ title: t("note_types.web-view"), command, type: "webView", uiIcon: "bx bx-globe-alt" },
{ title: t("note_types.mind-map"), command, type: "mindMap", uiIcon: "bx bx-sitemap" },
{ title: t("note_types.geo-map"), command, type: "geoMap", uiIcon: "bx bx-map-alt" },
{ title: t("note_types.task-list"), command, type: "taskList", uiIcon: "bx bx-list-check" }
];
const templateNoteIds = await server.get<string[]>("search-templates");

View File

@ -35,6 +35,7 @@ import GeoMapTypeWidget from "./type_widgets/geo_map.js";
import utils from "../services/utils.js";
import type { NoteType } from "../entities/fnote.js";
import type TypeWidget from "./type_widgets/type_widget.js";
import TaskListWidget from "./type_widgets/task_list.js";
const TPL = `
<div class="note-detail">
@ -72,7 +73,8 @@ const typeWidgetClasses = {
attachmentDetail: AttachmentDetailTypeWidget,
attachmentList: AttachmentListTypeWidget,
mindMap: MindMapWidget,
geoMap: GeoMapTypeWidget
geoMap: GeoMapTypeWidget,
taskList: TaskListWidget
};
/**

View File

@ -48,7 +48,8 @@ const NOTE_TYPES: NoteTypeMapping[] = [
{ type: "image", title: t("note_types.image"), selectable: false },
{ type: "launcher", mime: "", title: t("note_types.launcher"), selectable: false },
{ type: "noteMap", mime: "", title: t("note_types.note-map"), selectable: false },
{ type: "search", title: t("note_types.saved-search"), selectable: false }
{ type: "search", title: t("note_types.saved-search"), selectable: false },
{ type: "taskList", title: t("note_types.task-list"), selectable: false }
];
const NOT_SELECTABLE_NOTE_TYPES = NOTE_TYPES.filter((nt) => !nt.selectable).map((nt) => nt.type);

View File

@ -0,0 +1,26 @@
import type FNote from "../../entities/fnote.js";
import TypeWidget from "./type_widget.js";
const TPL = `
<div class="note-detail-task-list note-detail-printable">
Task list goes here.
</div>
`;
export default class TaskListWidget extends TypeWidget {
static getType() { return "taskList" }
doRender() {
this.$widget = $(TPL);
}
async doRefresh(note: FNote) {
this.$widget.show();
if (!this.note) {
return;
}
}
}

View File

@ -1416,7 +1416,8 @@
"widget": "Widget",
"confirm-change": "It is not recommended to change note type when note content is not empty. Do you want to continue anyway?",
"geo-map": "Geo Map",
"beta-feature": "Beta"
"beta-feature": "Beta",
"task-list": "To-Do List"
},
"protect_note": {
"toggle-on": "Protect the note",

View File

@ -15,7 +15,8 @@ const noteTypes = [
{ type: "doc", defaultMime: "" },
{ type: "contentWidget", defaultMime: "" },
{ type: "mindMap", defaultMime: "application/json" },
{ type: "geoMap", defaultMime: "application/json" }
{ type: "geoMap", defaultMime: "application/json" },
{ type: "taskList", defaultMime: "" }
];
function getDefaultMimeForNoteType(typeName: string) {