Calm Tactile Tasker
Serene cool-alabaster personal task manager with tactile checkboxes, progress rings, and calm sidebar hierarchy.
Inspired by Sunsama ↗
WHY THIS AESTHETIC IS UNIQUE
Transforms daily task triage from an anxious backlog into a serene, tactile ritual through feather-light card elevation, crisp cerulean checks, and unhurried whitespace.
BEST FOR
TAGS
COLOR PALETTE (CLICK TO COPY HEX)
TYPOGRAPHY
- Display
- Plus Jakarta Sans
- Body
- Inter
- Mono
- IBM Plex Mono
- Scale
- Crisp 26px view titles paired with 15px task labels, 12px tag pills, and subtle progress-ring indicators.
ARCHITECTURE & MOBILE NOTES
LAYOUT
Quiet left sidebar (Today, Upcoming, Anytime, Logbook) paired with a clean white task sheet, SVG completion progress ring, tag filter strip, and floating Quick-Add action.
INTERACTION
Check off tasks with smooth tactile completion feedback that updates the SVG progress ring and moves items to Logbook; filter by tags or add new tasks inline.
MOBILE
Sidebar converts into a clean top view-switcher bar with 44px touch targets and generous task row padding for effortless thumb tapping.
AI AGENT GUARDRAILS
DO
- Use whisper-quiet borders and hairline dividers instead of heavy card shadows
- Give every checkbox and task row at least 44px of comfortable hit area
- Keep iconography refined and color-coded (gold star for Today, cerulean for checks)
DON'T
- Do not clutter task rows with 6+ metadata badges or loud urgency banners
- Do not use aggressive red alerts for ordinary daily planning
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Cairn — Calm Tactile Task Manager</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--canvas: #F7F8FA;
--surface: #FFFFFF;
--sidebar-bg: #F1F3F6;
--ink: #22262C;
--ink-soft: #4B5360;
--accent: #2D7FF9;
--accent-soft: rgba(45, 127, 249, 0.11);
--muted: #7A8494;
--border: #E5E8EE;
--gold: #F59E0B;
--coral: #EF4444;
--teal: #0EA5E9;
--emerald: #10B981;
--shadow-card: 0 1px 2px rgba(20, 28, 42, 0.04), 0 4px 14px rgba(20, 28, 42, 0.04);
--shadow-float: 0 8px 26px rgba(20, 28, 42, 0.09);
--radius: 12px;
}
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
min-height: 100%;
background: var(--canvas);
color: var(--ink);
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
-webkit-font-smoothing: antialiased;
overflow-x: hidden;
}
.app {
display: grid;
grid-template-columns: 256px 1fr;
min-height: 100dvh;
}
/* Sidebar */
.sidebar {
background: var(--sidebar-bg);
border-right: 1px solid var(--border);
padding: 20px 14px 24px;
display: flex;
flex-direction: column;
gap: 24px;
}
.brand-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 10px;
}
.brand {
display: flex;
align-items: center;
gap: 9px;
font-size: 15px;
font-weight: 700;
letter-spacing: -0.02em;
color: var(--ink);
}
.brand-mark {
width: 24px;
height: 24px;
border-radius: 7px;
background: var(--accent);
display: grid;
place-items: center;
box-shadow: 0 2px 6px rgba(45, 127, 249, 0.3);
}
.nav-group {
display: flex;
flex-direction: column;
gap: 3px;
}
.nav-label {
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--muted);
padding: 0 10px 6px;
}
.nav-btn {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
padding: 9px 10px;
border: none;
border-radius: 9px;
background: transparent;
color: var(--ink-soft);
font-family: inherit;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: background 0.14s ease, color 0.14s ease;
}
.nav-btn:hover {
background: rgba(34, 38, 44, 0.05);
color: var(--ink);
}
.nav-btn.active {
background: var(--surface);
color: var(--ink);
font-weight: 600;
box-shadow: 0 1px 3px rgba(20, 28, 42, 0.06);
}
.nav-left {
display: flex;
align-items: center;
gap: 10px;
min-width: 0;
}
.nav-count {
font-size: 12px;
font-weight: 600;
color: var(--muted);
font-variant-numeric: tabular-nums;
}
.nav-btn.active .nav-count {
color: var(--accent);
}
.project-ring {
width: 18px;
height: 18px;
flex-shrink: 0;
}
/* Main Workspace */
.main {
display: flex;
flex-direction: column;
min-width: 0;
background: var(--canvas);
}
.mobile-header {
display: none;
align-items: center;
justify-content: space-between;
padding: 10px 14px;
background: var(--surface);
border-bottom: 1px solid var(--border);
position: sticky;
top: 0;
z-index: 25;
}
.icon-btn {
display: inline-flex;
align-items: center;
justify-content: center;
width: 44px;
height: 44px;
border: none;
border-radius: 10px;
background: transparent;
color: var(--ink);
cursor: pointer;
}
.icon-btn:hover {
background: var(--canvas);
}
.content-wrap {
width: 100%;
max-width: 760px;
margin: 0 auto;
padding: 38px 28px 110px;
flex: 1;
}
/* View Header */
.view-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
margin-bottom: 22px;
}
.view-title-group {
display: flex;
align-items: center;
gap: 14px;
min-width: 0;
}
.view-icon-badge {
width: 42px;
height: 42px;
border-radius: 12px;
background: var(--surface);
border: 1px solid var(--border);
display: grid;
place-items: center;
box-shadow: var(--shadow-card);
flex-shrink: 0;
}
.view-title {
font-size: 26px;
font-weight: 700;
letter-spacing: -0.025em;
color: var(--ink);
line-height: 1.15;
}
.view-subtitle {
font-size: 13px;
color: var(--muted);
margin-top: 3px;
}
/* Progress Ring Widget */
.progress-card {
display: flex;
align-items: center;
gap: 11px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 999px;
padding: 6px 14px 6px 8px;
box-shadow: var(--shadow-card);
flex-shrink: 0;
}
.progress-svg {
width: 34px;
height: 34px;
transform: rotate(-90deg);
}
.progress-track {
fill: none;
stroke: #E8ECF2;
stroke-width: 3.5;
}
.progress-fill {
fill: none;
stroke: var(--accent);
stroke-width: 3.5;
stroke-linecap: round;
transition: stroke-dashoffset 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.progress-meta {
display: flex;
flex-direction: column;
line-height: 1.2;
}
.progress-pct {
font-size: 13px;
font-weight: 700;
color: var(--ink);
font-variant-numeric: tabular-nums;
}
.progress-lbl {
font-size: 11px;
color: var(--muted);
}
/* Tag Filter Bar */
.filter-bar {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
margin-bottom: 20px;
}
.tag-pill {
display: inline-flex;
align-items: center;
gap: 6px;
height: 32px;
padding: 0 13px;
border-radius: 999px;
border: 1px solid var(--border);
background: var(--surface);
color: var(--ink-soft);
font-family: inherit;
font-size: 12.5px;
font-weight: 500;
cursor: pointer;
transition: all 0.14s ease;
}
.tag-pill:hover {
border-color: #CBD3DF;
color: var(--ink);
}
.tag-pill.active {
background: var(--accent);
border-color: var(--accent);
color: #FFFFFF;
box-shadow: 0 2px 8px rgba(45, 127, 249, 0.25);
}
/* Task Cards */
.task-list {
display: flex;
flex-direction: column;
gap: 8px;
}
.task-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 13px 16px;
display: flex;
align-items: flex-start;
gap: 13px;
box-shadow: var(--shadow-card);
transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.22s ease;
}
.task-card:hover {
border-color: #D4DBE6;
box-shadow: 0 3px 12px rgba(20, 28, 42, 0.06);
}
.task-card.completed {
opacity: 0.64;
background: #FAFBFD;
}
.check-btn {
width: 22px;
height: 22px;
margin-top: 1px;
border-radius: 6px;
border: 1.75px solid #C1CAD8;
background: var(--surface);
display: grid;
place-items: center;
cursor: pointer;
flex-shrink: 0;
transition: all 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}
.check-btn:hover {
border-color: var(--accent);
background: var(--accent-soft);
}
.task-card.completed .check-btn {
background: var(--accent);
border-color: var(--accent);
transform: scale(1.04);
}
.check-btn svg {
opacity: 0;
transform: scale(0.6);
transition: all 0.16s ease;
}
.task-card.completed .check-btn svg {
opacity: 1;
transform: scale(1);
}
.task-body {
flex: 1;
min-width: 0;
}
.task-title {
font-size: 14.5px;
font-weight: 500;
color: var(--ink);
line-height: 1.4;
word-break: break-word;
}
.task-card.completed .task-title {
text-decoration: line-through;
color: var(--muted);
}
.task-note {
font-size: 12.5px;
color: var(--muted);
margin-top: 4px;
line-height: 1.45;
}
.task-meta {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
margin-top: 8px;
}
.meta-chip {
font-size: 11.5px;
font-weight: 500;
color: var(--ink-soft);
background: #F2F4F8;
padding: 2px 8px;
border-radius: 6px;
}
.meta-chip.due {
color: var(--accent);
background: var(--accent-soft);
}
.meta-chip.project {
color: var(--muted);
background: transparent;
padding: 2px 0;
}
.empty-state {
text-align: center;
padding: 46px 20px;
background: var(--surface);
border: 1px dashed var(--border);
border-radius: var(--radius);
color: var(--muted);
font-size: 14px;
}
/* Quick-Add Composer */
.composer-wrap {
margin-top: 22px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 14px;
padding: 14px 16px;
box-shadow: var(--shadow-float);
}
.composer-top {
display: flex;
align-items: center;
gap: 10px;
}
.composer-plus {
width: 22px;
height: 22px;
border-radius: 6px;
background: var(--accent-soft);
color: var(--accent);
display: grid;
place-items: center;
font-weight: 700;
font-size: 15px;
flex-shrink: 0;
}
.composer-input {
width: 100%;
border: none;
outline: none;
font-family: inherit;
font-size: 14.5px;
font-weight: 500;
color: var(--ink);
background: transparent;
}
.composer-input::placeholder {
color: #9AA3B2;
}
.composer-note {
width: 100%;
border: none;
outline: none;
font-family: inherit;
font-size: 13px;
color: var(--ink-soft);
background: transparent;
margin-top: 8px;
padding-left: 32px;
}
.composer-footer {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 10px;
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid var(--border);
}
.composer-selects {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.select-pill {
height: 32px;
padding: 0 10px;
border-radius: 8px;
border: 1px solid var(--border);
background: var(--canvas);
color: var(--ink-soft);
font-family: inherit;
font-size: 12.5px;
font-weight: 500;
cursor: pointer;
}
.btn-primary {
height: 34px;
padding: 0 16px;
border: none;
border-radius: 8px;
background: var(--accent);
color: #FFFFFF;
font-family: inherit;
font-size: 13px;
font-weight: 600;
cursor: pointer;
box-shadow: 0 2px 8px rgba(45, 127, 249, 0.28);
transition: transform 0.12s ease, background 0.14s ease;
}
.btn-primary:hover {
background: #1D6EE8;
}
.btn-primary:active {
transform: scale(0.98);
}
/* Mobile Drawer */
.scrim {
display: none;
position: fixed;
inset: 0;
background: rgba(20, 28, 42, 0.28);
backdrop-filter: blur(2px);
z-index: 30;
}
.scrim.open { display: block; }
@media (max-width: 820px) {
.app {
grid-template-columns: 1fr;
}
.mobile-header {
display: flex;
}
.sidebar {
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: min(286px, 84vw);
z-index: 40;
transform: translateX(-100%);
transition: transform 0.22s ease;
box-shadow: 16px 0 36px rgba(20, 28, 42, 0.14);
}
.sidebar.open {
transform: translateX(0);
}
.content-wrap {
padding: 20px 16px 88px;
}
.view-header {
flex-wrap: wrap;
}
.view-title {
font-size: 22px;
}
.nav-btn, .tag-pill, .select-pill, .btn-primary {
min-height: 44px;
}
.check-btn {
width: 26px;
height: 26px;
}
}
</style>
</head>
<body>
<div class="app">
<div class="scrim" id="scrim"></div>
<aside class="sidebar" id="sidebar" aria-label="Task Lists and Projects">
<div class="brand-row">
<div class="brand">
<span class="brand-mark" aria-hidden="true">
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
<path d="M2.5 7.2L5.5 10.2L11.5 3.8" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</span>
<span>Cairn</span>
</div>
</div>
<nav class="nav-group" aria-label="Primary Views">
<button type="button" class="nav-btn active" data-view="today">
<span class="nav-left">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none">
<path d="M9 2.2l1.95 4.02 4.42.62-3.2 3.1.76 4.4L9 12.24l-3.93 2.1.76-4.4-3.2-3.1 4.42-.62L9 2.2z" fill="#F59E0B"/>
</svg>
<span>Today</span>
</span>
<span class="nav-count" id="count-today">0</span>
</button>
<button type="button" class="nav-btn" data-view="upcoming">
<span class="nav-left">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none">
<rect x="2.5" y="3.5" width="13" height="12" rx="2.5" stroke="#EF4444" stroke-width="1.6"/>
<path d="M2.5 7.2h13" stroke="#EF4444" stroke-width="1.6"/>
<path d="M6 2v2.5M12 2v2.5" stroke="#EF4444" stroke-width="1.6" stroke-linecap="round"/>
</svg>
<span>Upcoming</span>
</span>
<span class="nav-count" id="count-upcoming">0</span>
</button>
<button type="button" class="nav-btn" data-view="anytime">
<span class="nav-left">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none">
<rect x="2.5" y="4" width="13" height="10" rx="2" stroke="#0EA5E9" stroke-width="1.6"/>
<path d="M5.5 8h7M5.5 11h4.5" stroke="#0EA5E9" stroke-width="1.6" stroke-linecap="round"/>
</svg>
<span>Anytime</span>
</span>
<span class="nav-count" id="count-anytime">0</span>
</button>
<button type="button" class="nav-btn" data-view="logbook">
<span class="nav-left">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none">
<rect x="2.5" y="2.5" width="13" height="13" rx="3" fill="#10B981" fill-opacity="0.16" stroke="#10B981" stroke-width="1.6"/>
<path d="M6 9.2l2.1 2.1L12.2 7" stroke="#10B981" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<span>Logbook</span>
</span>
<span class="nav-count" id="count-logbook">0</span>
</button>
</nav>
<div class="nav-group">
<div class="nav-label">Projects</div>
<div id="projectList"></div>
</div>
</aside>
<main class="main">
<div class="mobile-header">
<button type="button" class="icon-btn" id="mobileMenuBtn" aria-label="Open Navigation">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round">
<line x1="3" y1="6" x2="17" y2="6"/>
<line x1="3" y1="10" x2="17" y2="10"/>
<line x1="3" y1="14" x2="17" y2="14"/>
</svg>
</button>
<span style="font-weight:700;font-size:15px;" id="mobileTitle">Today</span>
<button type="button" class="icon-btn" id="mobileAddFocus" aria-label="Jump to Quick Add" style="color:var(--accent);">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
<line x1="10" y1="4" x2="10" y2="16"/>
<line x1="4" y1="10" x2="16" y2="10"/>
</svg>
</button>
</div>
<div class="content-wrap">
<header class="view-header">
<div class="view-title-group">
<div class="view-icon-badge" id="viewIcon"></div>
<div>
<h1 class="view-title" id="viewTitle">Today</h1>
<p class="view-subtitle" id="viewSubtitle">Focus on what matters before evening.</p>
</div>
</div>
<div class="progress-card" aria-label="Completion progress">
<svg class="progress-svg" viewBox="0 0 36 36">
<circle class="progress-track" cx="18" cy="18" r="14"/>
<circle class="progress-fill" id="progressRing" cx="18" cy="18" r="14" stroke-dasharray="87.96" stroke-dashoffset="87.96"/>
</svg>
<div class="progress-meta">
<span class="progress-pct" id="progressPct">0%</span>
<span class="progress-lbl" id="progressLbl">0 of 0 done</span>
</div>
</div>
</header>
<div class="filter-bar" id="filterBar" role="group" aria-label="Filter by tag"></div>
<section class="task-list" id="taskList" aria-live="polite"></section>
<form class="composer-wrap" id="composerForm">
<div class="composer-top">
<span class="composer-plus" aria-hidden="true">+</span>
<input type="text" class="composer-input" id="taskTitleInput" placeholder="New To-Do — press Enter to add calmly..." autocomplete="off" required>
</div>
<input type="text" class="composer-note" id="taskNoteInput" placeholder="Optional note or context" autocomplete="off">
<div class="composer-footer">
<div class="composer-selects">
<select class="select-pill" id="taskViewSelect" aria-label="Schedule">
<option value="today">Today</option>
<option value="upcoming">Upcoming</option>
<option value="anytime">Anytime</option>
</select>
<select class="select-pill" id="taskProjectSelect" aria-label="Project">
<option value="Studio Redesign">Studio Redesign</option>
<option value="Spring Sabbatical">Spring Sabbatical</option>
<option value="Home & Garden">Home & Garden</option>
</select>
<select class="select-pill" id="taskTagSelect" aria-label="Tag">
<option value="Deep Work">Deep Work</option>
<option value="Quick 5m">Quick 5m</option>
<option value="Calls">Calls</option>
<option value="Errands">Errands</option>
</select>
</div>
<button type="submit" class="btn-primary">Add To-Do</button>
</div>
</form>
</div>
</main>
</div>
<script>
const TAGS = ['All', 'Deep Work', 'Quick 5m', 'Calls', 'Errands'];
const PROJECTS = ['Studio Redesign', 'Spring Sabbatical', 'Home & Garden'];
const VIEW_META = {
today: {
title: 'Today',
subtitle: 'Clear the quiet essentials before dusk.',
icon: '<svg width="20" height="20" viewBox="0 0 18 18" fill="none"><path d="M9 2.2l1.95 4.02 4.42.62-3.2 3.1.76 4.4L9 12.24l-3.93 2.1.76-4.4-3.2-3.1 4.42-.62L9 2.2z" fill="#F59E0B"/></svg>'
},
upcoming: {
title: 'Upcoming',
subtitle: 'Scheduled commitments over the coming week.',
icon: '<svg width="20" height="20" viewBox="0 0 18 18" fill="none"><rect x="2.5" y="3.5" width="13" height="12" rx="2.5" stroke="#EF4444" stroke-width="1.6"/><path d="M2.5 7.2h13" stroke="#EF4444" stroke-width="1.6"/><path d="M6 2v2.5M12 2v2.5" stroke="#EF4444" stroke-width="1.6" stroke-linecap="round"/></svg>'
},
anytime: {
title: 'Anytime',
subtitle: 'Ready whenever you have an unhurried afternoon.',
icon: '<svg width="20" height="20" viewBox="0 0 18 18" fill="none"><rect x="2.5" y="4" width="13" height="10" rx="2" stroke="#0EA5E9" stroke-width="1.6"/><path d="M5.5 8h7M5.5 11h4.5" stroke="#0EA5E9" stroke-width="1.6" stroke-linecap="round"/></svg>'
},
logbook: {
title: 'Logbook',
subtitle: 'Everything you have already completed.',
icon: '<svg width="20" height="20" viewBox="0 0 18 18" fill="none"><rect x="2.5" y="2.5" width="13" height="13" rx="3" fill="#10B981" fill-opacity="0.16" stroke="#10B981" stroke-width="1.6"/><path d="M6 9.2l2.1 2.1L12.2 7" stroke="#10B981" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></svg>'
}
};
let tasks = [
{ id: 1, title: 'Refine typographic hierarchy for pricing sheet', note: 'Check line-height on mobile cards and narrow tables.', view: 'today', project: 'Studio Redesign', tag: 'Deep Work', due: 'Today', done: false },
{ id: 2, title: 'Confirm train timetable from Kyoto to Kanazawa', note: 'Prefer morning Thunderbird departure.', view: 'today', project: 'Spring Sabbatical', tag: 'Quick 5m', due: 'Today', done: false },
{ id: 3, title: 'Call ceramicist regarding glaze samples', note: 'Ask about matte stoneware firing lead time.', view: 'today', project: 'Studio Redesign', tag: 'Calls', due: 'Today 16:00', done: false },
{ id: 4, title: 'Pick up cedar mulch and copper plant labels', note: 'Nursery on Alder Street closes at 17:30.', view: 'today', project: 'Home & Garden', tag: 'Errands', due: 'Today', done: true },
{ id: 5, title: 'Export final SVG icon set in 24px optical grid', note: 'Verify 1.5px uniform stroke weight.', view: 'upcoming', project: 'Studio Redesign', tag: 'Deep Work', due: 'Thu, Oct 24', done: false },
{ id: 6, title: 'Book guesthouse in Kurashiki for two nights', note: 'Check bicycle rental availability.', view: 'upcoming', project: 'Spring Sabbatical', tag: 'Quick 5m', due: 'Fri, Oct 25', done: false },
{ id: 7, title: 'Prune rosemary hedge before first frost', note: '', view: 'anytime', project: 'Home & Garden', tag: 'Errands', due: '', done: false },
{ id: 8, title: 'Archive Q3 client moodboards and font licenses', note: 'Move zip bundle to cold storage.', view: 'anytime', project: 'Studio Redesign', tag: 'Quick 5m', due: '', done: false },
{ id: 9, title: 'Send revised studio manifesto draft to Clara', note: 'Included print margin notes.', view: 'today', project: 'Studio Redesign', tag: 'Deep Work', due: 'Completed', done: true }
];
let activeView = 'today';
let activeProject = null;
let activeTag = 'All';
let nextId = 10;
const sidebarEl = document.getElementById('sidebar');
const scrimEl = document.getElementById('scrim');
function escapeHtml(s) {
return s.replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
}
function getVisibleTasks() {
return tasks.filter(t => {
if (activeProject) {
if (t.project !== activeProject) return false;
} else if (activeView === 'logbook') {
if (!t.done) return false;
} else {
if (t.view !== activeView) return false;
}
if (activeTag !== 'All' && t.tag !== activeTag) return false;
return true;
});
}
function renderSidebar() {
['today', 'upcoming', 'anytime'].forEach(v => {
const count = tasks.filter(t => t.view === v && !t.done).length;
document.getElementById(`count-${v}`).textContent = count;
});
document.getElementById('count-logbook').textContent = tasks.filter(t => t.done).length;
document.querySelectorAll('.nav-btn[data-view]').forEach(btn => {
btn.classList.toggle('active', !activeProject && btn.dataset.view === activeView);
});
const projContainer = document.getElementById('projectList');
projContainer.innerHTML = '';
PROJECTS.forEach(proj => {
const all = tasks.filter(t => t.project === proj);
const done = all.filter(t => t.done).length;
const ratio = all.length ? done / all.length : 0;
const circ = 43.98;
const offset = circ * (1 - ratio);
const btn = document.createElement('button');
btn.type = 'button';
btn.className = 'nav-btn' + (activeProject === proj ? ' active' : '');
btn.innerHTML = `
<span class="nav-left">
<svg class="project-ring" viewBox="0 0 18 18">
<circle cx="9" cy="9" r="7" fill="none" stroke="#D5DCE7" stroke-width="2"/>
<circle cx="9" cy="9" r="7" fill="none" stroke="#2D7FF9" stroke-width="2"
stroke-dasharray="${circ}" stroke-dashoffset="${offset}"
stroke-linecap="round" transform="rotate(-90 9 9)"/>
</svg>
<span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">${escapeHtml(proj)}</span>
</span>
<span class="nav-count">${all.length - done}</span>
`;
btn.addEventListener('click', () => {
activeProject = proj;
activeTag = 'All';
render();
closeDrawer();
});
projContainer.appendChild(btn);
});
}
function renderHeaderAndProgress() {
const titleEl = document.getElementById('viewTitle');
const subEl = document.getElementById('viewSubtitle');
const iconEl = document.getElementById('viewIcon');
const mobileTitleEl = document.getElementById('mobileTitle');
let scopeTasks;
if (activeProject) {
titleEl.textContent = activeProject;
mobileTitleEl.textContent = activeProject;
subEl.textContent = 'Project checklist across all horizons.';
iconEl.innerHTML = '<svg width="20" height="20" viewBox="0 0 18 18" fill="none"><circle cx="9" cy="9" r="6.5" stroke="#2D7FF9" stroke-width="2"/></svg>';
scopeTasks = tasks.filter(t => t.project === activeProject);
} else {
const meta = VIEW_META[activeView];
titleEl.textContent = meta.title;
mobileTitleEl.textContent = meta.title;
subEl.textContent = meta.subtitle;
iconEl.innerHTML = meta.icon;
scopeTasks = activeView === 'logbook' ? tasks : tasks.filter(t => t.view === activeView);
}
const total = scopeTasks.length;
const done = scopeTasks.filter(t => t.done).length;
const pct = total ? Math.round((done / total) * 100) : 0;
const circ = 87.96;
document.getElementById('progressRing').setAttribute('stroke-dashoffset', String(circ * (1 - pct / 100)));
document.getElementById('progressPct').textContent = `${pct}%`;
document.getElementById('progressLbl').textContent = `${done} of ${total} done`;
}
function renderFilters() {
const bar = document.getElementById('filterBar');
bar.innerHTML = '';
TAGS.forEach(tag => {
const btn = document.createElement('button');
btn.type = 'button';
btn.className = 'tag-pill' + (activeTag === tag ? ' active' : '');
btn.textContent = tag;
btn.addEventListener('click', () => {
activeTag = tag;
render();
});
bar.appendChild(btn);
});
}
function renderTasks() {
const list = document.getElementById('taskList');
const visible = getVisibleTasks();
list.innerHTML = '';
if (!visible.length) {
list.innerHTML = `<div class="empty-state">All quiet here. Add a to-do below or switch tags.</div>`;
return;
}
visible.sort((a, b) => Number(a.done) - Number(b.done));
visible.forEach(task => {
const card = document.createElement('div');
card.className = 'task-card' + (task.done ? ' completed' : '');
card.innerHTML = `
<button type="button" class="check-btn" aria-label="Toggle complete for ${escapeHtml(task.title)}" aria-pressed="${task.done}">
<svg width="13" height="13" viewBox="0 0 14 14" fill="none">
<path d="M2.5 7.3L5.6 10.3L11.5 3.8" stroke="#FFFFFF" stroke-width="2.1" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</button>
<div class="task-body">
<div class="task-title">${escapeHtml(task.title)}</div>
${task.note ? `<div class="task-note">${escapeHtml(task.note)}</div>` : ''}
<div class="task-meta">
${task.due ? `<span class="meta-chip due">${escapeHtml(task.due)}</span>` : ''}
<span class="meta-chip">${escapeHtml(task.tag)}</span>
<span class="meta-chip project">${escapeHtml(task.project)}</span>
</div>
</div>
`;
card.querySelector('.check-btn').addEventListener('click', () => {
task.done = !task.done;
render();
});
list.appendChild(card);
});
}
function render() {
renderSidebar();
renderHeaderAndProgress();
renderFilters();
renderTasks();
}
// Primary view switches
document.querySelectorAll('.nav-btn[data-view]').forEach(btn => {
btn.addEventListener('click', () => {
activeProject = null;
activeView = btn.dataset.view;
activeTag = 'All';
if (activeView !== 'logbook') {
document.getElementById('taskViewSelect').value = activeView;
}
render();
closeDrawer();
});
});
// Quick-Add composer
document.getElementById('composerForm').addEventListener('submit', e => {
e.preventDefault();
const titleInput = document.getElementById('taskTitleInput');
const noteInput = document.getElementById('taskNoteInput');
const title = titleInput.value.trim();
if (!title) return;
const view = document.getElementById('taskViewSelect').value;
const project = document.getElementById('taskProjectSelect').value;
const tag = document.getElementById('taskTagSelect').value;
tasks.unshift({
id: nextId++,
title,
note: noteInput.value.trim(),
view,
project,
tag,
due: view === 'today' ? 'Today' : (view === 'upcoming' ? 'Next Week' : ''),
done: false
});
titleInput.value = '';
noteInput.value = '';
if (!activeProject && activeView === 'logbook') {
activeView = view;
}
render();
});
// Mobile drawer
function closeDrawer() {
sidebarEl.classList.remove('open');
scrimEl.classList.remove('open');
}
document.getElementById('mobileMenuBtn').addEventListener('click', () => {
sidebarEl.classList.add('open');
scrimEl.classList.add('open');
});
scrimEl.addEventListener('click', closeDrawer);
document.getElementById('mobileAddFocus').addEventListener('click', () => {
const inp = document.getElementById('taskTitleInput');
inp.scrollIntoView({ behavior: 'smooth', block: 'center' });
inp.focus();
});
render();
</script>
</body>
</html>