-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from terryli710/feature/google-calendar-api
Feature/google calendar api
- Loading branch information
Showing
26 changed files
with
713 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
|
||
<script> | ||
import LucideIcon from './LucideIcon.svelte'; | ||
export let width = "24"; | ||
export let height = "24"; | ||
export let ariaLabel = "chevrons-up-down"; | ||
const svgPath = ` | ||
<path d="M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5"/> | ||
<path d="M16 2v4"/> | ||
<path d="M8 2v4"/> | ||
<path d="M3 10h5"/> | ||
<path d="M17.5 17.5 16 16.25V14"/> | ||
<path d="M22 16a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z"/> | ||
`; | ||
</script> | ||
<LucideIcon width={width} height={height} svgPath={svgPath} ariaLabel={ariaLabel} class="task-card-icon" /> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
|
||
<script> | ||
import LucideIcon from './LucideIcon.svelte'; | ||
export let width = "24"; | ||
export let height = "24"; | ||
export let ariaLabel = "chevrons-up-down"; | ||
const svgPath = ` | ||
<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/> | ||
<path d="M3 3v5h5"/><path d="M12 7v5l4 2"/> | ||
`; | ||
</script> | ||
<LucideIcon width={width} height={height} svgPath={svgPath} ariaLabel={ariaLabel} class="task-card-icon" /> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { App, Modal, Notice, Setting } from 'obsidian'; | ||
import { Project } from '../taskModule/project'; | ||
|
||
export class CreateProjectModal extends Modal { | ||
result: Partial<Project> = { | ||
id: '', | ||
name: '', | ||
color: '' | ||
}; | ||
onSubmit: (result: Partial<Project>) => boolean; | ||
|
||
constructor(app: App, onSubmit: (result: Partial<Project>) => boolean) { | ||
super(app); | ||
this.onSubmit = onSubmit; | ||
} | ||
|
||
onOpen() { | ||
const { contentEl } = this; | ||
|
||
contentEl.createEl('h1', { text: "Task Card: Create a Project" }); | ||
|
||
new Setting(contentEl) | ||
.setName('Project Name') | ||
.setDesc('The name of the project. Cannot be empty.') | ||
.addText((text) => | ||
text.onChange((value) => { | ||
this.result.name = value; | ||
}) | ||
); | ||
|
||
new Setting(contentEl) | ||
.setName('Project Color') | ||
.setDesc('The color of the project. Optional. If not provided, a random color will be assigned.') | ||
.addColorPicker((colorPicker) => | ||
colorPicker.onChange((value) => { | ||
this.result.color = value; | ||
}) | ||
); | ||
|
||
new Setting(contentEl).addButton((btn) => | ||
btn | ||
.setButtonText('Submit') | ||
.setCta() | ||
.onClick(() => { | ||
this.close(); | ||
}) | ||
); | ||
} | ||
|
||
checkValidity() { | ||
// check if the project name is valid (not empty) | ||
if (!this.result.name) { | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
} | ||
|
||
onClose() { | ||
// Clear content first | ||
let { contentEl } = this; | ||
contentEl.empty(); | ||
|
||
// Check validity | ||
if (!this.checkValidity()) { | ||
new Notice('[TaskCard] Project name cannot be empty.'); | ||
return; // Exit function early if not valid | ||
} | ||
|
||
// Handle submission | ||
const result = this.onSubmit(this.result); | ||
if (result === true) { | ||
new Notice(`[TaskCard] Project created: ${this.result.name}`); | ||
} else { | ||
new Notice('[TaskCard] Project creation failed. Make sure the project name is unique.'); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.