diff --git a/src/modals/daily-note-select-modal.ts b/src/modals/daily-note-select-modal.ts new file mode 100644 index 0000000..1ac8a9f --- /dev/null +++ b/src/modals/daily-note-select-modal.ts @@ -0,0 +1,25 @@ +import { App, Modal, Setting } from 'obsidian'; + +export class DailyNoteSelectModal extends Modal { + constructor(app: App, onSubmit: (result: string) => void) { + super(app); + this.setTitle('Select a daily note'); + + let name = ''; + new Setting(this.contentEl) + .setName('Date') + .addMomentFormat((component) => { + + }); + + new Setting(this.contentEl) + .addButton((btn) => + btn + .setButtonText('Submit') + .setCta() + .onClick(() => { + this.close(); + onSubmit(name); + })); + } +} diff --git a/src/views/todo-item-component.ts b/src/views/todo-item-component.ts index 0dae70d..766c6a3 100644 --- a/src/views/todo-item-component.ts +++ b/src/views/todo-item-component.ts @@ -4,6 +4,7 @@ import type { TodoItem } from '../core/types'; export interface TodoItemCallbacks { onToggle: (todo: TodoItem) => void; onMoveClick: (todo: TodoItem) => void; + onMoveDailyNoteClick: (todo: TodoItem) => void; onClick: (todo: TodoItem) => void; } diff --git a/src/views/todo-sidebar-view.ts b/src/views/todo-sidebar-view.ts index 767b3be..5f87b2d 100644 --- a/src/views/todo-sidebar-view.ts +++ b/src/views/todo-sidebar-view.ts @@ -1,8 +1,8 @@ -import { ItemView, Keymap, Platform, TFile, WorkspaceLeaf } from 'obsidian'; +import { ItemView, Platform, TFile, WorkspaceLeaf } from 'obsidian'; import type { TodoItem, TodoGroup } from '../core/types'; import { parseTodosGroupedByHeading } from '../core/todo-parser'; -import { toggleTodo, collectTodoBlockLines, removeTodoBlock } from '../core/todo-transformer'; -import { createTodoItemEl, collectChildLineNumbers } from './todo-item-component'; +import { toggleTodo } from '../core/todo-transformer'; +import { createTodoItemEl } from './todo-item-component'; export const TODO_VIEW_TYPE = 'todo-tracker-view'; @@ -144,6 +144,7 @@ export class TodoSidebarView extends ItemView { const itemEl = createTodoItemEl(container, todo, { onToggle: (t) => this.handleToggle(file, t), onMoveClick: (t) => this.handleMoveClick(t, file), + onMoveDailyNoteClick: (t) => this.handleMoveDailyNoteClick(t, file), onClick: (t) => this.openTodoInEditor(file, t), }); @@ -349,4 +350,8 @@ export class TodoSidebarView extends ItemView { new NoteSelectModal(this.app, todo, file).open(); }); } + + private handleMoveDailyNoteClick(t: TodoItem, file: TFile): void { + + } }