dromse / obsidian-gamified-tasks

Gamify your task management with rewards system, craft your tasks by tags.
MIT License
29 stars 1 forks source link

[Feature]: add `if` tag for conditions #46

Open dromse opened 1 month ago

dromse commented 1 month ago

What kind of feature do you want?

Add tag if for showing task by specific conditions defined in scripts.

Draft example

First, you need to set path to directory where you will be store condition scripts. For example Conditions in the root of vault.

You can write script tuesday.js to show task only on tuesdays.

// Conditions/tuesday.js
const date = new Date();
const dayOfWeek = date.toLocaleString("en-US", { weekday: "long" });

function showOnTuesday() {
  if (dayOfWeek === "Tuesday") {
    return true;
  }

  return false;
}

export default showOnTuesday

Remark: Your function must return boolean value.

And then you can use your condition:

- [ ] do a very important task #if/tuesday

And then if task is not done, it will appear in UI on every tuesday.

You can define different logic like show task on location, weather, time, device conditions etc. It's all about your imagination and JavaScript API capabilities.

Impact

Impact for users

Pros:
Cons:

Impact for development

Pros:
Cons:

Additional questions