This is what i have so far I use templates, calendar, dataview, periodic notes, trackerI think. Still working on it
const goals = {
DeepWork: 240, // minutes
Mood: 6, // scale from 1-10
Gym: 60, // minutes
Language: 30, // minutes
Cardio: 30, // minutes
Courses: 10, // number of courses
Meditation: 1, // boolean, 0 or 1
Sleep: 1 // boolean, 0 or 1
};
// Retrieve current values from frontmatter
const currentValues = {
DeepWork: dv.current().file.frontmatter["DeepWork"] || 0,
Mood: dv.current().file.frontmatter["Mood"] || 0,
Gym: dv.current().file.frontmatter["Gym"] || 0,
Language: dv.current().file.frontmatter["Language"] || 0,
Cardio: dv.current().file.frontmatter["Cardio"] || 0,
Courses: dv.current().file.frontmatter["Courses"] || 0,
Meditation: dv.current().file.frontmatter["Meditation"] ? 1 : 0,
Sleep: dv.current().file.frontmatter["Sleep"] ? 1 : 0
};
// Function to create progress bar and percentage
function progress(current, goal) {
let value;
// Check if the goal is a boolean, if so, the progress is either 0 or 100%
if (typeof goal === 'boolean') {
value = current ? 100 : 0;
} else {
// Calculate the progress percentage
value = (current / goal) * 100;
}
// Cap the value at 100% and round it
value = Math.min(value, 100);
let roundedValue = Math.round(value);
return `<progress value="${roundedValue}" max="100"></progress> ${roundedValue}%`;
}
// Generate the table content
let tableContent = "| Activity | Progress |\n|---|---|\n";
Object.entries(goals).forEach(([activity, goal]) => {
const current = currentValues[activity];
tableContent += `| **${activity}** | ${progress(current, goal)} |\n`;
});
dv.span(tableContent);
const today = DateTime.now();
const lifespan = { years: 80 };
const birthday = DateTime.fromObject({
year: 1997,
month: 6,
day: 14
});
const deathday = birthday.plus(lifespan);
// Calculate weeks left until deathday
const weeksLeft = deathday.diff(today, 'weeks').weeks;
function progress(type) {
let value;
switch(type) {
case "lifespan":
value = (today.year - birthday.year) / lifespan.years * 100;
break;
case "year":
value = today.month / 12 * 100;
break;
case "month":
value = today.day / today.daysInMonth * 100;
break;
case "day":
value = today.hour / 24 * 100;
break;
}
return `<progress value="${parseInt(value)}" max="100"></progress> | ${parseInt(value)} %`;
}
dv.span(`
| | Progress | Percentage |
| --- | --- |:---:|
| **Year** | ${progress("year")} |
| **Month**| ${progress("month")} |
| **Day**| ${progress("day")} |
| **Life** | ${progress("lifespan")} |
| **Weeks Left**| ${Math.floor(weeksLeft)} | weeks left |
`);
Streaks
searchType: frontmatter
searchTarget: Mood
folder: Journal/Daily
startDate: <% moment(tp.file.title, "YYYY-MM-DD").startOf("week").format("YYYY-MM-DD") %>
endDate: <% moment(tp.file.title, "YYYY-MM-DD").endOf("week").format("YYYY-MM-DD") %>
line:
title: "Mood"
yAxisLabel: Mood
lineColor: "#d65d0e"
yAxisTickInterval: 1
yMin: 0
[[Journal/Daily/<% tp.date.now(“YYYY-MM-DD”, -1, tp.file.title, “YYYY-MM-DD dddd”) %>| Yesterday ]] ----- [[Journal/Daily/<% tp.date.now(“YYYY-MM-DD”, 1, tp.file.title, “YYYY-MM-DD dddd”) %>| Tomorrow ]]