Skip to content

Commit

Permalink
fix(ticktick): fix new task show closed project and project sort issue
Browse files Browse the repository at this point in the history
  • Loading branch information
viduycheung committed Sep 11, 2023
1 parent d00bfb2 commit 760a8b4
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Project = {
id: string;
name: string;
sortOrder: number;
isClosed: boolean;
closed: boolean;
};

type Task = {
Expand Down Expand Up @@ -285,15 +285,23 @@ class CreateTaskModal extends Modal {
// list
const projectLine = contentEl.createDiv({ cls: "modal-line" });
projectLine.createEl("div", { cls: "label", text: "List" });
console.log(
"%c [ this.plugin.settings.projects ]-291",
"font-size:13px; background:pink; color:#bf2c9f;",
this.plugin.settings.projects
);
const projectComp = new DropdownComponent(projectLine)
.addOptions(
this.plugin.settings.projects.reduce(
(id2Name: Record<string, string>, project) => {
id2Name[project.id] = project.name;
return id2Name;
},
{ inbox: "Inbox" }
)
this.plugin.settings.projects
.filter((project) => !project.closed)
.sort((project) => project.sortOrder)
.reduce(
(id2Name: Record<string, string>, project) => {
id2Name[project.id] = project.name;
return id2Name;
},
{ inbox: "Inbox" }
)
)
.setValue(this.taskData.projectId)
.onChange((value) => {
Expand Down

0 comments on commit 760a8b4

Please sign in to comment.