lightweight, client-only calendar web application. All data persists in the URL hash for instant sharing, No backend required. Optional AES-GCM password protection keeps shared links locked without a server
JavaScript
update icons
Supun Lakmala8d1f5e0aea9
diff --git a/apple-touch-icon.png b/apple-touch-icon.pngindex 7c5747d..f95daac 100644Binary files a/apple-touch-icon.png and b/apple-touch-icon.png differdiff --git a/favicon.ico b/favicon.icoindex cceede8..9d8459d 100644Binary files a/favicon.ico and b/favicon.ico differdiff --git a/favicon.png b/favicon.pngdeleted file mode 100644index 441e737..0000000Binary files a/favicon.png and /dev/null differdiff --git a/index.html b/index.htmlindex a0c9d8b..205ed0e 100644--- a/index.html+++ b/index.html@@ -1,30 +1,48 @@-<!DOCTYPE html>-<html lang="en">-<head>- <meta charset="UTF-8">+<!DOCTYPE html>+<html lang="en">++<head>+ <script async src="https://www.googletagmanager.com/gtag/js?id=G-77V3TP2B5T"></script>+ <script>+ window.dataLayer = window.dataLayer || [];+ function gtag() { dataLayer.push(arguments); }+ gtag('js', new Date());++ // Security: Exclude URL hash from analytics to prevent leaking spreadsheet data+ gtag('config', 'G-77V3TP2B5T', {+ 'page_location': window.location.origin + window.location.pathname,+ 'page_path': window.location.pathname+ });+ </script>+ <meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>hash-calendar - private, URL-powered calendar</title>- <meta name="description" content="hash-calendar is a privacy-first, URL-powered calendar. Create events, share instantly, and keep data in your browser - no accounts or backend.">+ <meta name="description"+ content="hash-calendar is a privacy-first, URL-powered calendar. Create events, share instantly, and keep data in your browser - no accounts or backend."><meta name="robots" content="index,follow"><link rel="canonical" href="https://hash-calendar.netlify.app/"><meta property="og:site_name" content="hash-calendar"><meta property="og:title" content="hash-calendar - private, URL-powered calendar">- <meta property="og:description" content="Privacy-first calendar that lives in your URL. Create events, share instantly, and keep data in your browser - no accounts or backend.">+ <meta property="og:description"+ content="Privacy-first calendar that lives in your URL. Create events, share instantly, and keep data in your browser - no accounts or backend."><meta property="og:type" content="website"><meta property="og:url" content="https://hash-calendar.netlify.app/"><meta property="og:image" content="https://hash-calendar.netlify.app/logo.png"><meta property="og:image:alt" content="hash-calendar logo"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:title" content="hash-calendar - private, URL-powered calendar">- <meta name="twitter:description" content="Privacy-first calendar that lives in your URL. Create events, share instantly, and keep data in your browser - no accounts or backend.">+ <meta name="twitter:description"+ content="Privacy-first calendar that lives in your URL. Create events, share instantly, and keep data in your browser - no accounts or backend."><meta name="twitter:image" content="https://hash-calendar.netlify.app/logo.png"><meta name="twitter:image:alt" content="hash-calendar logo">- <link rel="icon" href="favicon.ico" type="image/x-icon">- <link rel="icon" href="favicon.png" type="image/png" sizes="32x32">- <link rel="apple-touch-icon" href="apple-touch-icon.png" sizes="180x180">+ <link rel="icon" href="favicon.ico" type="image/x-icon">+ <link rel="icon" href="favicon.png" type="image/png" sizes="32x32">+ <link rel="apple-touch-icon" href="apple-touch-icon.png" sizes="180x180"><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=Fraunces:wght@400;600;700&family=Space+Grotesk:wght@400;500;600&display=swap" rel="stylesheet">+ <link+ href="https://fonts.googleapis.com/css2?family=Fraunces:wght@400;600;700&family=Space+Grotesk:wght@400;500;600&display=swap"+ rel="stylesheet"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css"><link rel="stylesheet" href="styles.css"><script type="application/ld+json">@@ -41,27 +59,30 @@}</script></head>-<body>- <div class="app">- <header class="topbar">- <div class="brand">- <div class="brand-mark">#</div>- <div class="brand-text">- <input id="calendar-title" class="title-input" type="text" maxlength="60" value="hash-calendar" aria-label="Calendar title">- <span class="brand-subtitle">Serverless privacy calendar. Your URL is the save file.</span>- </div>- </div>- <div class="top-actions">- <div class="nav-group">- <button id="prev-month" type="button" aria-label="Previous month">Prev</button>- <button id="today-btn" type="button">Today</button>- <button id="next-month" type="button" aria-label="Next month">Next</button>- </div>++<body>+ <div class="app">+ <header class="topbar">+ <div class="brand">+ <div class="brand-mark">#</div>+ <div class="brand-text">+ <input id="calendar-title" class="title-input" type="text" maxlength="60" value="hash-calendar"+ aria-label="Calendar title">+ <span class="brand-subtitle">Serverless privacy calendar. Your URL is the save file.</span>+ </div>+ </div>+ <div class="top-actions">+ <div class="nav-group">+ <button id="prev-month" type="button" aria-label="Previous month">Prev</button>+ <button id="today-btn" type="button">Today</button>+ <button id="next-month" type="button" aria-label="Next month">Next</button>+ </div><div class="view-toggle" role="tablist" aria-label="Calendar view"><button type="button" data-view="day" role="tab" aria-selected="false">Day</button><button type="button" data-view="week" role="tab" aria-selected="false">Week</button><button type="button" data-view="month" role="tab" aria-selected="true">Month</button><button type="button" data-view="year" role="tab" aria-selected="false">Year</button>+ <button type="button" data-view="agenda" role="tab" aria-selected="false">Agenda</button></div><button id="focus-btn" type="button" class="ghost">Focus</button><button id="add-event" type="button" class="primary">Add event</button>@@ -74,55 +95,55 @@</a></div></header>-- <main class="layout">- <section class="calendar-panel">- <div class="panel-header">- <div>- <h2 id="month-label" class="month-label">Month 2026</h2>- <div class="panel-actions">- <button id="weekstart-toggle" type="button" class="ghost">Week starts Sunday</button>- <button id="theme-toggle" type="button" class="ghost">Theme: Light</button>- </div>- </div>- </div>- <div id="weekday-row" class="weekday-row"></div>- <div id="calendar-grid" class="calendar-grid" role="grid" aria-label="Calendar"></div>- <div id="locked-overlay" class="locked-overlay hidden">- <div class="locked-card">- <h3>Encrypted calendar</h3>- <p>Enter the password to unlock and edit this calendar.</p>- <button id="unlock-btn" type="button" class="primary">Unlock</button>- </div>- </div>- </section>-- <aside class="side-panel">- <div class="side-card">- <h3 id="selected-date-label" class="side-title">Selected day</h3>- <div id="event-list" class="event-list"></div>- <button id="add-event-inline" type="button" class="ghost">Add event for this day</button>- </div>-- <div class="side-card">- <h4 class="side-title">Share and export</h4>- <div class="status-row">- <span>URL length</span>- <strong id="url-length">0</strong>- </div>- <p id="url-warning" class="url-warning"></p>++ <main class="layout">+ <section class="calendar-panel">+ <div class="panel-header">+ <div>+ <h2 id="month-label" class="month-label">Month 2026</h2>+ <div class="panel-actions">+ <button id="weekstart-toggle" type="button" class="ghost">Week starts Sunday</button>+ <button id="theme-toggle" type="button" class="ghost">Theme: Light</button>+ </div>+ </div>+ </div>+ <div id="weekday-row" class="weekday-row"></div>+ <div id="calendar-grid" class="calendar-grid" role="grid" aria-label="Calendar"></div>+ <div id="locked-overlay" class="locked-overlay hidden">+ <div class="locked-card">+ <h3>Encrypted calendar</h3>+ <p>Enter the password to unlock and edit this calendar.</p>+ <button id="unlock-btn" type="button" class="primary">Unlock</button>+ </div>+ </div>+ </section>++ <aside class="side-panel">+ <div class="side-card">+ <h3 id="selected-date-label" class="side-title">Selected day</h3>+ <div id="event-list" class="event-list"></div>+ <button id="add-event-inline" type="button" class="ghost">Add event for this day</button>+ </div>++ <div class="side-card">+ <h4 class="side-title">Share and export</h4>+ <div class="status-row">+ <span>URL length</span>+ <strong id="url-length">0</strong>+ </div>+ <p id="url-warning" class="url-warning"></p><div class="stacked-actions"><button id="view-json" type="button" class="ghost">View JSON</button><button id="export-json" type="button" class="ghost">Export JSON</button><button id="import-ics" type="button" class="ghost">Import .ics</button><input id="ics-input" type="file" accept=".ics,text/calendar" hidden></div>- </div>-- <div class="side-card danger">- <h4 class="side-title">Danger zone</h4>- <button id="clear-all" type="button" class="danger-btn">Clear calendar</button>- </div>+ </div>++ <div class="side-card danger">+ <h4 class="side-title">Danger zone</h4>+ <button id="clear-all" type="button" class="danger-btn">Clear calendar</button>+ </div></aside></main></div>@@ -151,84 +172,84 @@<div id="event-modal" class="modal hidden" role="dialog" aria-modal="true" aria-labelledby="event-modal-title"><div class="modal-backdrop"></div><div class="modal-card">- <header class="modal-header">- <h3 id="event-modal-title">Add event</h3>- <button id="event-close" type="button" class="icon-btn" aria-label="Close">x</button>- </header>- <form id="event-form" class="modal-form">- <label class="field">- <span>Title</span>- <input id="event-title" type="text" maxlength="80" required>- </label>- <div class="field-row">- <label class="field">- <span>Date</span>- <input id="event-date" type="date" required>- </label>- <label class="field">- <span>Start</span>- <input id="event-time" type="time">- </label>- </div>- <div class="field-row">- <label class="field">- <span>Duration (mins)</span>- <input id="event-duration" type="number" min="0" step="5" value="60">- </label>- <label class="field checkbox-field">- <input id="event-all-day" type="checkbox">- <span>All day</span>- </label>- </div>- <label class="field">- <span>Recurrence</span>- <select id="event-recurrence">- <option value="">None</option>- <option value="d">Daily</option>- <option value="w">Weekly</option>- <option value="m">Monthly</option>- <option value="y">Yearly</option>- </select>- </label>- <label class="field">- <span>Color</span>- <input id="event-color" type="color" value="#ff6b6b">- </label>- <div id="color-palette" class="color-palette"></div>- <div class="modal-actions">- <button id="event-delete" type="button" class="ghost danger hidden">Delete</button>- <div class="modal-actions-right">- <button id="event-cancel" type="button" class="ghost">Cancel</button>- <button id="event-save" type="submit" class="primary">Save</button>- </div>- </div>- </form>- </div>- </div>-+ <header class="modal-header">+ <h3 id="event-modal-title">Add event</h3>+ <button id="event-close" type="button" class="icon-btn" aria-label="Close">x</button>+ </header>+ <form id="event-form" class="modal-form">+ <label class="field">+ <span>Title</span>+ <input id="event-title" type="text" maxlength="80" required>+ </label>+ <div class="field-row">+ <label class="field">+ <span>Date</span>+ <input id="event-date" type="date" required>+ </label>+ <label class="field">+ <span>Start</span>+ <input id="event-time" type="time">+ </label>+ </div>+ <div class="field-row">+ <label class="field">+ <span>Duration (mins)</span>+ <input id="event-duration" type="number" min="0" step="5" value="60">+ </label>+ <label class="field checkbox-field">+ <input id="event-all-day" type="checkbox">+ <span>All day</span>+ </label>+ </div>+ <label class="field">+ <span>Recurrence</span>+ <select id="event-recurrence">+ <option value="">None</option>+ <option value="d">Daily</option>+ <option value="w">Weekly</option>+ <option value="m">Monthly</option>+ <option value="y">Yearly</option>+ </select>+ </label>+ <label class="field">+ <span>Color</span>+ <input id="event-color" type="color" value="#ff6b6b">+ </label>+ <div id="color-palette" class="color-palette"></div>+ <div class="modal-actions">+ <button id="event-delete" type="button" class="ghost danger hidden">Delete</button>+ <div class="modal-actions-right">+ <button id="event-cancel" type="button" class="ghost">Cancel</button>+ <button id="event-save" type="submit" class="primary">Save</button>+ </div>+ </div>+ </form>+ </div>+ </div>+<div id="password-modal" class="modal hidden" role="dialog" aria-modal="true" aria-labelledby="password-title"><div class="modal-backdrop"></div><div class="modal-card">- <header class="modal-header">- <h3 id="password-title">Unlock calendar</h3>- <button id="password-close" type="button" class="icon-btn" aria-label="Close">x</button>- </header>- <div class="modal-form">- <p id="password-desc" class="modal-note"></p>- <label class="field">- <span>Password</span>- <input id="password-input" type="password" autocomplete="new-password">- </label>- <label id="password-confirm-field" class="field hidden">- <span>Confirm password</span>- <input id="password-confirm" type="password" autocomplete="new-password">- </label>- <p id="password-error" class="modal-error hidden"></p>- <div class="modal-actions">- <button id="password-cancel" type="button" class="ghost">Cancel</button>- <button id="password-submit" type="button" class="primary">Unlock</button>- </div>- </div>+ <header class="modal-header">+ <h3 id="password-title">Unlock calendar</h3>+ <button id="password-close" type="button" class="icon-btn" aria-label="Close">x</button>+ </header>+ <div class="modal-form">+ <p id="password-desc" class="modal-note"></p>+ <label class="field">+ <span>Password</span>+ <input id="password-input" type="password" autocomplete="new-password">+ </label>+ <label id="password-confirm-field" class="field hidden">+ <span>Confirm password</span>+ <input id="password-confirm" type="password" autocomplete="new-password">+ </label>+ <p id="password-error" class="modal-error hidden"></p>+ <div class="modal-actions">+ <button id="password-cancel" type="button" class="ghost">Cancel</button>+ <button id="password-submit" type="button" class="primary">Unlock</button>+ </div>+ </div></div></div>@@ -283,4 +304,5 @@<script src="modules/lz-string.min.js"></script><script type="module" src="script.js"></script></body>+</html>diff --git a/logo.png b/logo.pngindex cd4cc89..478bf29 100644Binary files a/logo.png and b/logo.png differdiff --git a/modules/agendaRender.js b/modules/agendaRender.jsnew file mode 100644index 0000000..6f58a2c--- /dev/null+++ b/modules/agendaRender.js@@ -0,0 +1,121 @@+import { expandEvents } from "./recurrenceEngine.js";+import { formatDateKey } from "./calendarRender.js";++const DEFAULT_COLORS = ["#ff6b6b", "#ffd43b", "#4dabf7", "#63e6be", "#9775fa"];++function startOfDay(date) {+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());+}++function endOfDay(date) {+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59, 999);+}++function addMonths(date, months) {+ const next = new Date(date.getTime());+ const day = next.getDate();+ next.setMonth(next.getMonth() + months);+ if (next.getDate() < day) {+ next.setDate(0);+ }+ return next;+}++function formatAgendaHeader(date) {+ return date.toLocaleDateString(undefined, {+ weekday: "short",+ month: "short",+ day: "numeric",+ });+}++function formatAgendaTime(date) {+ return date.toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit" });+}++function decorateOccurrences(occurrences, colors) {+ const palette = Array.isArray(colors) && colors.length ? colors : DEFAULT_COLORS;+ return occurrences.map((occ) => {+ const color = palette[occ.colorIndex] || palette[0] || "#4dabf7";+ const timeLabel = occ.isAllDay ? "All day" : formatAgendaTime(new Date(occ.start));+ return { ...occ, color, timeLabel };+ });+}++function buildAgendaData({ events, colors, rangeMonths }) {+ const rangeStart = startOfDay(new Date());+ const rangeEnd = endOfDay(addMonths(rangeStart, rangeMonths));++ const expanded = expandEvents(events || [], rangeStart, rangeEnd);+ const occurrences = decorateOccurrences(expanded, colors);+ occurrences.sort((a, b) => a.start - b.start);++ const occurrencesByDay = new Map();+ occurrences.forEach((occ) => {+ const key = formatDateKey(new Date(occ.start));+ if (!occurrencesByDay.has(key)) occurrencesByDay.set(key, []);+ occurrencesByDay.get(key).push(occ);+ });++ return { occurrences, occurrencesByDay, range: { start: rangeStart, end: rangeEnd } };+}++export function renderAgendaView({ events, colors, container, rangeMonths = 6, onEventClick } = {}) {+ const data = buildAgendaData({ events, colors, rangeMonths });+ if (!container) return data;++ container.innerHTML = "";++ if (!data.occurrences.length) {+ const empty = document.createElement("div");+ empty.className = "agenda-empty";+ empty.textContent = "No upcoming events.";+ container.appendChild(empty);+ return data;+ }++ const list = document.createElement("div");+ list.className = "agenda-list";++ let lastKey = "";+ data.occurrences.forEach((event) => {+ const date = new Date(event.start);+ const key = formatDateKey(date);++ if (key !== lastKey) {+ const header = document.createElement("h3");+ header.className = "agenda-date-header";+ header.textContent = formatAgendaHeader(date);+ list.appendChild(header);+ lastKey = key;+ }++ const item = document.createElement("div");+ item.className = "agenda-event-item";+ item.style.borderLeftColor = event.color;++ const time = document.createElement("div");+ time.className = "agenda-time";+ time.textContent = event.isAllDay ? "All day" : formatAgendaTime(date);++ const details = document.createElement("div");+ details.className = "agenda-details";++ const title = document.createElement("div");+ title.className = "agenda-title";+ title.textContent = event.title;++ details.appendChild(title);+ item.appendChild(time);+ item.appendChild(details);++ if (typeof onEventClick === "function") {+ item.addEventListener("click", () => onEventClick(event));+ }++ list.appendChild(item);+ });++ container.appendChild(list);+ return data;+}diff --git a/modules/hashcalUrlManager.js b/modules/hashcalUrlManager.jsindex 778c69a..88763cb 100644--- a/modules/hashcalUrlManager.js+++ b/modules/hashcalUrlManager.js@@ -4,7 +4,7 @@ const HASH_PREFIX = "ENC:";const DEFAULT_TITLE = "hash-calendar";const DEFAULT_COLORS = ["#ff6b6b", "#ffd43b", "#4dabf7", "#63e6be", "#9775fa"];-const DEFAULT_SETTINGS = { d: 0, m: 0 };+const DEFAULT_SETTINGS = { d: 0, m: 0, v: "month" };function arraysEqual(a, b) {return a.length === b.length && a.every((v, i) => v === b[i]);@@ -43,9 +43,12 @@ function compactState(state) {});}- if (state.s && (state.s.d !== 0 || state.s.m !== 0)) {- out.s = state.s;- }+ if (state.s) {+ const hasView = typeof state.s.v === "string" && state.s.v !== DEFAULT_SETTINGS.v;+ if (state.s.d !== DEFAULT_SETTINGS.d || state.s.m !== DEFAULT_SETTINGS.m || hasView) {+ out.s = state.s;+ }+ }return out;}diff --git a/script.js b/script.jsindex 113bb24..0b14694 100644--- a/script.js+++ b/script.js@@ -1,5 +1,6 @@import { readStateFromHash, writeStateToHash, isEncryptedHash, clearHash } from "./modules/hashcalUrlManager.js";import { expandEvents } from "./modules/recurrenceEngine.js";+import { renderAgendaView } from "./modules/agendaRender.js";import { FocusMode } from "./modules/focusMode.js";import { initQRCodeManager } from "./modules/qrCodeManager.js";import {@@ -13,16 +14,19 @@ import {} from "./modules/calendarRender.js";import { parseIcs } from "./modules/icsImporter.js";-const DEFAULT_COLORS = ["#ff6b6b", "#ffd43b", "#4dabf7", "#63e6be", "#9775fa"];+const DEFAULT_COLORS = ["#ff6b6b", "#ffd43b", "#4dabf7", "#63e6be", "#9775fa"];+const DEFAULT_VIEW = "month";+const VALID_VIEWS = new Set(["day", "week", "month", "year", "agenda"]);const DEFAULT_STATE = {t: "hash-calendar",- c: DEFAULT_COLORS,- e: [],- s: {- d: 0,- m: 0,- },-};+ c: DEFAULT_COLORS,+ e: [],+ s: {+ d: 0,+ m: 0,+ v: DEFAULT_VIEW,+ },+};const DEBOUNCE_MS = 500;const MAX_TITLE_LENGTH = 60;@@ -30,7 +34,7 @@ const MAX_TITLE_LENGTH = 60;let state = cloneState(DEFAULT_STATE);let viewDate = startOfDay(new Date());let selectedDate = startOfDay(new Date());-let currentView = "month";+let currentView = DEFAULT_VIEW;let password = null;let lockState = { encrypted: false, unlocked: true };let saveTimer = null;@@ -93,13 +97,24 @@ function formatRangeLabel(start, end) {})}`;}-function formatTime(date) {- return date.toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit" });-}--function normalizeState(raw) {- const next = cloneState(DEFAULT_STATE);- if (!raw || typeof raw !== "object") return next;+function formatTime(date) {+ return date.toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit" });+}++function getStoredView(view) {+ return VALID_VIEWS.has(view) ? view : DEFAULT_VIEW;+}++function applyStoredView() {+ const stored = state && state.s ? state.s.v : null;+ currentView = getStoredView(stored);+ if (state && state.s) state.s.v = currentView;+ updateViewButtons();+}++function normalizeState(raw) {+ const next = cloneState(DEFAULT_STATE);+ if (!raw || typeof raw !== "object") return next;if (typeof raw.t === "string") {next.t = raw.t.slice(0, MAX_TITLE_LENGTH);@@ -136,10 +151,11 @@ function normalizeState(raw) {.filter((entry) => Number.isFinite(entry[0]));}- if (raw.s && typeof raw.s === "object") {- next.s.d = raw.s.d ? 1 : 0;- next.s.m = raw.s.m ? 1 : 0;- }+ if (raw.s && typeof raw.s === "object") {+ next.s.d = raw.s.d ? 1 : 0;+ next.s.m = raw.s.m ? 1 : 0;+ next.s.v = getStoredView(raw.s.v);+ }return next;}@@ -294,12 +310,15 @@ function updateViewButtons() {});}-function setView(view) {- if (!view) return;- currentView = view;- updateViewButtons();- render();-}+function setView(view) {+ if (!VALID_VIEWS.has(view)) return;+ if (currentView === view) return;+ currentView = view;+ if (state && state.s) state.s.v = view;+ updateViewButtons();+ render();+ persistStateToHash();+}function updateLockUI() {const isLocked = lockState.encrypted && !lockState.unlocked;@@ -354,9 +373,9 @@ function render() {ui.calendarGrid.style.gridTemplateColumns = "";ui.calendarGrid.style.gridTemplateRows = "";}- if (ui.weekdayRow) {- ui.weekdayRow.classList.toggle("hidden", currentView === "year");- }+ if (ui.weekdayRow) {+ ui.weekdayRow.classList.toggle("hidden", currentView === "year" || currentView === "agenda");+ }if (currentView === "month") {const range = getMonthGridRange(viewDate, weekStartsOnMonday);@@ -395,10 +414,10 @@ function render() {onEventClick: (event) => openEventModal({ index: event.sourceIndex }),});}- } else if (currentView === "day") {- const start = startOfDay(selectedDate);- const end = new Date(start.getFullYear(), start.getMonth(), start.getDate(), 23, 59, 59);- const expanded = expandEvents(state.e, start, end);+ } else if (currentView === "day") {+ const start = startOfDay(selectedDate);+ const end = new Date(start.getFullYear(), start.getMonth(), start.getDate(), 23, 59, 59);+ const expanded = expandEvents(state.e, start, end);const decorated = decorateOccurrences(expanded);occurrencesByDay = groupOccurrences(decorated);@@ -411,11 +430,23 @@ function render() {occurrences: decorated,onSelectDay: handleSelectDay,onEventClick: (event) => openEventModal({ index: event.sourceIndex }),- });- }- } else if (currentView === "year") {- const year = viewDate.getFullYear();- const start = new Date(year, 0, 1);+ });+ }+ } else if (currentView === "agenda") {+ const agendaData = renderAgendaView({+ events: state.e,+ colors: state.c,+ container: ui.calendarGrid,+ rangeMonths: 6,+ onEventClick: (event) => openEventModal({ index: event.sourceIndex }),+ });+ occurrencesByDay = agendaData && agendaData.occurrencesByDay ? agendaData.occurrencesByDay : new Map();+ if (ui.monthLabel && agendaData && agendaData.range) {+ ui.monthLabel.textContent = `Agenda · ${formatRangeLabel(agendaData.range.start, agendaData.range.end)}`;+ }+ } else if (currentView === "year") {+ const year = viewDate.getFullYear();+ const start = new Date(year, 0, 1);const end = new Date(year, 11, 31, 23, 59, 59);const expanded = expandEvents(state.e, start, end);const decorated = decorateOccurrences(expanded);@@ -719,12 +750,13 @@ async function attemptUnlock() {});if (!value) return;try {- const loaded = await readStateFromHash(value);- password = value;- lockState = { encrypted: true, unlocked: true };- state = normalizeState(loaded);- render();- showToast("Calendar unlocked", "success");+ const loaded = await readStateFromHash(value);+ password = value;+ lockState = { encrypted: true, unlocked: true };+ state = normalizeState(loaded);+ applyStoredView();+ render();+ showToast("Calendar unlocked", "success");} catch (error) {showToast("Incorrect password", "error");lockState = { encrypted: true, unlocked: false };@@ -732,26 +764,29 @@ async function attemptUnlock() {}}-async function loadStateFromHash() {- if (!window.location.hash) {- state = cloneState(DEFAULT_STATE);- return;- }-- if (isEncryptedHash()) {- lockState = { encrypted: true, unlocked: false };- state = cloneState(DEFAULT_STATE);- updateLockUI();- return;- }-- try {- const loaded = await readStateFromHash();- state = normalizeState(loaded);- } catch (error) {- state = cloneState(DEFAULT_STATE);- }-}+async function loadStateFromHash() {+ if (!window.location.hash) {+ state = cloneState(DEFAULT_STATE);+ applyStoredView();+ return;+ }++ if (isEncryptedHash()) {+ lockState = { encrypted: true, unlocked: false };+ state = cloneState(DEFAULT_STATE);+ applyStoredView();+ updateLockUI();+ return;+ }++ try {+ const loaded = await readStateFromHash();+ state = normalizeState(loaded);+ } catch (error) {+ state = cloneState(DEFAULT_STATE);+ }+ applyStoredView();+}function handleHashChange() {loadStateFromHash().then(render);diff --git a/styles.css b/styles.cssindex fae9be8..b6b87e5 100644--- a/styles.css+++ b/styles.css@@ -306,16 +306,97 @@ button:disabled {letter-spacing: 0.08em;}-.calendar-grid {- flex: 1;- min-height: 0;- background: var(--panel);-}--.calendar-grid.month-view {- display: grid;- grid-template-columns: repeat(7, minmax(0, 1fr));- grid-template-rows: repeat(6, minmax(0, 1fr));+.calendar-grid {+ flex: 1;+ min-height: 0;+ background: var(--panel);+}++.calendar-grid.agenda-view {+ display: block;+ overflow-y: auto;+ padding: 16px 20px 24px;+ background: var(--panel);+ scrollbar-gutter: stable;+}++.agenda-list {+ display: flex;+ flex-direction: column;+ gap: 12px;+}++.agenda-date-header {+ margin: 12px 0 4px;+ padding: 6px 12px;+ border-radius: 999px;+ background: var(--panel-2);+ border: 1px solid var(--border-soft);+ font-size: 0.82rem;+ font-weight: 600;+ color: var(--text);+ position: sticky;+ top: 0;+ z-index: 2;+}++.agenda-event-item {+ display: grid;+ grid-template-columns: 80px 1fr;+ gap: 12px;+ align-items: center;+ padding: 12px 14px;+ border-radius: 10px;+ border: 1px solid var(--border-soft);+ border-left: 4px solid var(--accent);+ background: var(--panel);+ box-shadow: var(--shadow-sm);+ cursor: pointer;+ transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;+}++.agenda-event-item:hover {+ transform: translateX(3px);+ box-shadow: var(--shadow-md);+ border-color: var(--border);+}++.agenda-time {+ font-size: 0.72rem;+ font-weight: 600;+ color: var(--muted);+ letter-spacing: 0.06em;+ text-transform: uppercase;+ font-variant-numeric: tabular-nums;+}++.agenda-details {+ display: flex;+ flex-direction: column;+ gap: 4px;+}++.agenda-title {+ font-size: 0.95rem;+ font-weight: 600;+ color: var(--text);+}++.agenda-empty {+ margin: 20px auto 0;+ padding: 24px;+ border-radius: 12px;+ border: 1px dashed var(--border);+ background: var(--panel-2);+ color: var(--muted);+ text-align: center;+ max-width: 420px;+}++.calendar-grid.month-view {+ display: grid;+ grid-template-columns: repeat(7, minmax(0, 1fr));+ grid-template-rows: repeat(6, minmax(0, 1fr));border-left: 1px solid var(--border);border-top: 1px solid var(--border);}@@ -1067,4 +1148,17 @@ button:disabled {.focus-upnext-title {text-align: left;}++ .calendar-grid.agenda-view {+ padding: 12px 14px 18px;+ }++ .agenda-event-item {+ grid-template-columns: 1fr;+ align-items: flex-start;+ }++ .agenda-time {+ font-size: 0.68rem;+ }}