This commit is contained in:
Bram Adams
2022-12-08 19:17:10 -06:00
parent 6a505f7e99
commit ce3130bd79
32 changed files with 21757 additions and 58162 deletions

View File

@@ -1,31 +1,54 @@
module.exports = async function createProject(params) {
const PROJECTS_FOLDER = "_PARA/Projects/";
const PROJECTS_FOLDER = "_PARA/Projects/";
const userInput = await params.quickAddApi.inputPrompt(
"CREATE a new Project (and remember to have fun!)",
"Project Name"
);
const userInput = await params.quickAddApi.inputPrompt("CREATE a new Project (and remember to have fun!)", "Project Name")
// Check if user cancelled
if (!userInput) {
return;
}
// Check if user cancelled
if (!userInput) {
return;
// add a checkbox prompt to see if for optional settings
const settings = await params.quickAddApi.checkboxPrompt(
["Create a Kanban", "Create a Scratchpad", "Add Readwise Dataview"],
["Create a Kanban", "Create a Scratchpad", "Add Readwise Dataview"]
);
// Get the project name
const absolutePath = PROJECTS_FOLDER + userInput;
// Create a new folder
await params.app.vault.createFolder(`${absolutePath}`);
// // Create a new file in the new folder
const newFile = await params.app.vault.create(
`${absolutePath}/${userInput}.md`,
`> [!info]\n> Project Description Here\n\n`
);
// // Create a scratchpad file in the new folder
if (settings.includes("Create a Scratchpad")) {
await params.app.vault.create(`${absolutePath}/Scratchpad.md`, "");
}
if (settings.includes("Add Readwise Dataview")) {
await params.app.vault.create(
`${absolutePath}/Readwise Resources.md`, `# Readwise Resources\n\n\`\`\`dataview
list from "Readwise"
where project = "${userInput}"
\`\`\``
)
}
// Get the project name
const absolutePath = PROJECTS_FOLDER + userInput;
// Create a new folder
await params.app.vault.createFolder(`${absolutePath}`);
// // Create a new file in the new folder
const newFile = await params.app.vault.create(`${absolutePath}/${userInput}.md`, `# ${userInput}\n\n`);
// // Create a scratchpad file in the new folder
await params.app.vault.create(`${absolutePath}/Scratchpad.md`, "# Scratchpad\n\n");
if (settings.includes("Create a Kanban")) {
// // Create a Kanban file in the new folder
await params.app.vault.create(`${absolutePath}/Kanban.md`, `---
await params.app.vault.create(
`${absolutePath}/Kanban.md`,
`---
kanban-plugin: basic
@@ -54,7 +77,7 @@ kanban-plugin: basic
\`\`\`
{"kanban-plugin":"basic"}
\`\`\`
%%`);
}
%%`
);
}
};