Added
This commit is contained in:
313
HomePage.md
Normal file
313
HomePage.md
Normal file
@@ -0,0 +1,313 @@
|
||||
---
|
||||
cssclasses:
|
||||
- wide-dashboard
|
||||
- no-properties
|
||||
- note-bg-blur
|
||||
- styled-checkbox
|
||||
- styled-hr
|
||||
- small-text
|
||||
---
|
||||
<div style="
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
background-image: url('https://images8.alphacoders.com/127/thumb-1920-1275563.jpg');
|
||||
background-size: cover;
|
||||
background-position: center 35%;
|
||||
filter: blur(2px);
|
||||
border-radius: 0;
|
||||
margin: 0;
|
||||
"></div>
|
||||
|
||||
---
|
||||
# Dailys
|
||||
## Week
|
||||
```dataviewjs
|
||||
// Force English locale for weekdays
|
||||
moment.locale("en");
|
||||
|
||||
const today = moment();
|
||||
|
||||
// === CONFIGURE WEEK RANGE HERE ===
|
||||
// For current week:
|
||||
const weekStart = today.clone().startOf("isoWeek");
|
||||
const weekEnd = today.clone().endOf("isoWeek");
|
||||
|
||||
// For next week, uncomment these:
|
||||
// const weekStart = today.clone().add(1, "week").startOf("isoWeek");
|
||||
// const weekEnd = today.clone().add(1, "week").endOf("isoWeek");
|
||||
|
||||
// For weekend only (Sat & Sun):
|
||||
// const weekStart = today.clone().startOf("isoWeek").add(5, "days"); // Saturday
|
||||
// const weekEnd = today.clone().startOf("isoWeek").add(6, "days"); // Sunday
|
||||
|
||||
// All notes tagged #Calendar within the week
|
||||
const pages = dv.pages("#Calendar")
|
||||
.where(p => {
|
||||
const d = moment(p.file.name, "DD.MM.YYYY", true);
|
||||
return d.isValid() && d.isBetween(weekStart, weekEnd, "day", "[]");
|
||||
});
|
||||
|
||||
// Generate days array (Mon–Sun or custom)
|
||||
const totalDays = weekEnd.diff(weekStart, "days") + 1;
|
||||
const weekDays = Array.from({ length: totalDays }, (_, i) => weekStart.clone().add(i, "days"));
|
||||
|
||||
// Separate days with and without notes
|
||||
const daysWithNotes = [];
|
||||
const daysWithoutNotes = [];
|
||||
|
||||
for (const day of weekDays) {
|
||||
const page = pages.find(p => p.file.name === day.format("DD.MM.YYYY"));
|
||||
if (page) {
|
||||
daysWithNotes.push({ date: day, page });
|
||||
} else {
|
||||
daysWithoutNotes.push(day);
|
||||
}
|
||||
}
|
||||
|
||||
// Build Columns plugin Markdown
|
||||
let md = "````col\nheight=shortest\ntextAlign=start\n===\n";
|
||||
|
||||
// Columns for days with notes
|
||||
for (const { date, page } of daysWithNotes) {
|
||||
const isToday = date.isSame(today, "day");
|
||||
const label = `${isToday ? "📌 " : ""}${date.format("ddd")}<br>${date.format("DD.MM.YYYY")}`;
|
||||
|
||||
md += "```col-md\n";
|
||||
md += `### ${label}\n`;
|
||||
|
||||
// Show reason from frontmatter under the title
|
||||
if (page.reason) {
|
||||
md += `**Reason:** ${page.reason}\n\n`;
|
||||
}
|
||||
|
||||
// Get tasks from the note
|
||||
const tasks = page.file.tasks;
|
||||
|
||||
// Filter tasks under # Tasks heading if possible
|
||||
const tasksInSection = tasks.filter(t => {
|
||||
if (t.heading) return t.heading.toLowerCase().includes("tasks");
|
||||
return true; // fallback: include all tasks if heading not available
|
||||
});
|
||||
|
||||
if (tasksInSection.length > 0) {
|
||||
for (const t of tasksInSection) {
|
||||
md += `- [${t.completed ? "x" : " "}] ${t.text}\n`;
|
||||
}
|
||||
} else {
|
||||
md += "_No tasks found_\n";
|
||||
}
|
||||
|
||||
md += "```\n\n";
|
||||
}
|
||||
|
||||
// Single column for days without notes
|
||||
if (daysWithoutNotes.length > 0) {
|
||||
md += "```col-md\n";
|
||||
md += "### Days without notes\n";
|
||||
for (const day of daysWithoutNotes) {
|
||||
md += `- ${day.format("ddd")} — ${day.format("DD.MM.YYYY")}\n`;
|
||||
}
|
||||
md += "```\n\n";
|
||||
}
|
||||
|
||||
md += "````\n";
|
||||
|
||||
// Render the dashboard
|
||||
dv.paragraph(md);
|
||||
|
||||
```
|
||||
## Weekend
|
||||
```dataviewjs
|
||||
// Force English locale for weekdays
|
||||
moment.locale("en");
|
||||
|
||||
const today = moment();
|
||||
|
||||
// === CONFIGURE WEEK RANGE HERE ===
|
||||
// For current week:
|
||||
//const weekStart = today.clone().startOf("isoWeek");
|
||||
//const weekEnd = today.clone().endOf("isoWeek");
|
||||
|
||||
// For next week, uncomment these:
|
||||
// const weekStart = today.clone().add(1, "week").startOf("isoWeek");
|
||||
// const weekEnd = today.clone().add(1, "week").endOf("isoWeek");
|
||||
|
||||
// For weekend only (Sat & Sun):
|
||||
const weekStart = today.clone().startOf("isoWeek").add(5, "days"); // Saturday
|
||||
const weekEnd = today.clone().startOf("isoWeek").add(6, "days"); // Sunday
|
||||
|
||||
// All notes tagged #Calendar within the week
|
||||
const pages = dv.pages("#Calendar")
|
||||
.where(p => {
|
||||
const d = moment(p.file.name, "DD.MM.YYYY", true);
|
||||
return d.isValid() && d.isBetween(weekStart, weekEnd, "day", "[]");
|
||||
});
|
||||
|
||||
// Generate days array (Mon–Sun or custom)
|
||||
const totalDays = weekEnd.diff(weekStart, "days") + 1;
|
||||
const weekDays = Array.from({ length: totalDays }, (_, i) => weekStart.clone().add(i, "days"));
|
||||
|
||||
// Separate days with and without notes
|
||||
const daysWithNotes = [];
|
||||
const daysWithoutNotes = [];
|
||||
|
||||
for (const day of weekDays) {
|
||||
const page = pages.find(p => p.file.name === day.format("DD.MM.YYYY"));
|
||||
if (page) {
|
||||
daysWithNotes.push({ date: day, page });
|
||||
} else {
|
||||
daysWithoutNotes.push(day);
|
||||
}
|
||||
}
|
||||
|
||||
// Build Columns plugin Markdown
|
||||
let md = "````col\nheight=shortest\ntextAlign=start\n===\n";
|
||||
|
||||
// Columns for days with notes
|
||||
for (const { date, page } of daysWithNotes) {
|
||||
const isToday = date.isSame(today, "day");
|
||||
const label = `${isToday ? "📌 " : ""}${date.format("ddd")}<br>${date.format("DD.MM.YYYY")}`;
|
||||
|
||||
md += "```col-md\n";
|
||||
md += `### ${label}\n`;
|
||||
|
||||
// Show reason from frontmatter under the title
|
||||
if (page.reason) {
|
||||
md += `**Reason:** ${page.reason}\n\n`;
|
||||
}
|
||||
|
||||
// Get tasks from the note
|
||||
const tasks = page.file.tasks;
|
||||
|
||||
// Filter tasks under # Tasks heading if possible
|
||||
const tasksInSection = tasks.filter(t => {
|
||||
if (t.heading) return t.heading.toLowerCase().includes("tasks");
|
||||
return true; // fallback: include all tasks if heading not available
|
||||
});
|
||||
|
||||
if (tasksInSection.length > 0) {
|
||||
for (const t of tasksInSection) {
|
||||
md += `- [${t.completed ? "x" : " "}] ${t.text}\n`;
|
||||
}
|
||||
} else {
|
||||
md += "_No tasks found_\n";
|
||||
}
|
||||
|
||||
md += "```\n\n";
|
||||
}
|
||||
|
||||
// Single column for days without notes
|
||||
if (daysWithoutNotes.length > 0) {
|
||||
md += "```col-md\n";
|
||||
md += "### Days without notes\n";
|
||||
for (const day of daysWithoutNotes) {
|
||||
md += `- ${day.format("ddd")} — ${day.format("DD.MM.YYYY")}\n`;
|
||||
}
|
||||
md += "```\n\n";
|
||||
}
|
||||
|
||||
md += "````\n";
|
||||
|
||||
// Render the dashboard
|
||||
dv.paragraph(md);
|
||||
|
||||
```
|
||||
---
|
||||
|
||||
# Next Week
|
||||
```dataviewjs
|
||||
// Force English locale for weekdays
|
||||
moment.locale("en");
|
||||
|
||||
const today = moment();
|
||||
|
||||
// === CONFIGURE WEEK RANGE HERE ===
|
||||
// For current week:
|
||||
//const weekStart = today.clone().startOf("isoWeek");
|
||||
//const weekEnd = today.clone().endOf("isoWeek");
|
||||
|
||||
// For next week, uncomment these:
|
||||
const weekStart = today.clone().add(1, "week").startOf("isoWeek");
|
||||
const weekEnd = today.clone().add(1, "week").endOf("isoWeek");
|
||||
|
||||
// For weekend only (Sat & Sun):
|
||||
// const weekStart = today.clone().startOf("isoWeek").add(5, "days"); // Saturday
|
||||
// const weekEnd = today.clone().startOf("isoWeek").add(6, "days"); // Sunday
|
||||
|
||||
// All notes tagged #Calendar within the week
|
||||
const pages = dv.pages("#Calendar")
|
||||
.where(p => {
|
||||
const d = moment(p.file.name, "DD.MM.YYYY", true);
|
||||
return d.isValid() && d.isBetween(weekStart, weekEnd, "day", "[]");
|
||||
});
|
||||
|
||||
// Generate days array (Mon–Sun or custom)
|
||||
const totalDays = weekEnd.diff(weekStart, "days") + 1;
|
||||
const weekDays = Array.from({ length: totalDays }, (_, i) => weekStart.clone().add(i, "days"));
|
||||
|
||||
// Separate days with and without notes
|
||||
const daysWithNotes = [];
|
||||
const daysWithoutNotes = [];
|
||||
|
||||
for (const day of weekDays) {
|
||||
const page = pages.find(p => p.file.name === day.format("DD.MM.YYYY"));
|
||||
if (page) {
|
||||
daysWithNotes.push({ date: day, page });
|
||||
} else {
|
||||
daysWithoutNotes.push(day);
|
||||
}
|
||||
}
|
||||
|
||||
// Build Columns plugin Markdown
|
||||
let md = "````col\nheight=shortest\ntextAlign=start\n===\n";
|
||||
|
||||
// Columns for days with notes
|
||||
for (const { date, page } of daysWithNotes) {
|
||||
const isToday = date.isSame(today, "day");
|
||||
const label = `${isToday ? "📌 " : ""}${date.format("ddd")}<br>${date.format("DD.MM.YYYY")}`;
|
||||
|
||||
md += "```col-md\n";
|
||||
md += `### ${label}\n`;
|
||||
|
||||
// Show reason from frontmatter under the title
|
||||
if (page.reason) {
|
||||
md += `**Reason:** ${page.reason}\n\n`;
|
||||
}
|
||||
|
||||
// Get tasks from the note
|
||||
const tasks = page.file.tasks;
|
||||
|
||||
// Filter tasks under # Tasks heading if possible
|
||||
const tasksInSection = tasks.filter(t => {
|
||||
if (t.heading) return t.heading.toLowerCase().includes("tasks");
|
||||
return true; // fallback: include all tasks if heading not available
|
||||
});
|
||||
|
||||
if (tasksInSection.length > 0) {
|
||||
for (const t of tasksInSection) {
|
||||
md += `- [${t.completed ? "x" : " "}] ${t.text}\n`;
|
||||
}
|
||||
} else {
|
||||
md += "_No tasks found_\n";
|
||||
}
|
||||
|
||||
md += "```\n\n";
|
||||
}
|
||||
|
||||
// Single column for days without notes
|
||||
if (daysWithoutNotes.length > 0) {
|
||||
md += "```col-md\n";
|
||||
md += "### Days without notes\n";
|
||||
for (const day of daysWithoutNotes) {
|
||||
md += `- ${day.format("ddd")} — ${day.format("DD.MM.YYYY")}\n`;
|
||||
}
|
||||
md += "```\n\n";
|
||||
}
|
||||
|
||||
md += "````\n";
|
||||
|
||||
// Render the dashboard
|
||||
dv.paragraph(md);
|
||||
|
||||
```
|
||||
---
|
||||
Reference in New Issue
Block a user