added demo account data seeding

This commit is contained in:
Joren de Graaf
2026-09-30 18:01:34 +02:00
parent 6baa19f11b
commit d891aa65cc
19 changed files with 493 additions and 69 deletions
+2 -2
View File
@@ -19,8 +19,8 @@
<nav class="primary-nav" aria-label="Primary navigation">
{% if user.is_authenticated %}
<a href="{% url 'planner:task-list' %}">My tasks</a>
<a href="{% url 'planner:daily-planner' %}">Daily planner</a>
<a href="{% url 'planner:user-settings' %}">Settings</a>
<a id="daily-planner-nav" class="{% if onboarding_tour.target == 'daily-planner' %}onboarding-highlight{% endif %}" href="{% url 'planner:daily-planner' %}">Daily planner</a>
<a id="settings-nav" class="{% if onboarding_tour.target == 'settings' %}onboarding-highlight{% endif %}" href="{% url 'planner:user-settings' %}">Settings</a>
<form method="post" action="{% url 'planner:logout' %}" class="nav-logout">{% csrf_token %}<button type="submit">Log out</button></form>
{% else %}
<a href="{% url 'planner:login' %}">Log in</a>
@@ -1,69 +1,18 @@
<article class="fasting-widget" id="fasting-widget" aria-labelledby="fasting-heading">
<article class="fasting-widget{% if onboarding_tour.target == 'fasting' %} onboarding-highlight{% endif %}" id="fasting-widget" aria-labelledby="fasting-heading">
{% if not fasting_settings %}
<p class="eyebrow">Optional routine</p>
<h2 id="fasting-heading">Intermittent fasting</h2>
<p class="fasting-widget__copy">Set a daily fasting window when it fits your routine.</p>
<a class="button button--secondary button--compact" href="{% url 'planner:fasting-configure' %}" hx-get="{% url 'planner:fasting-configure' %}" hx-target="#fasting-widget" hx-swap="outerHTML">Set up fasting</a>
<p class="eyebrow">Optional routine</p><h2 id="fasting-heading">Intermittent fasting</h2><p class="fasting-widget__copy">Set a daily fasting window when it fits your routine.</p><a class="button button--secondary button--compact" href="{% url 'planner:fasting-configure' %}" hx-get="{% url 'planner:fasting-configure' %}" hx-target="#fasting-widget" hx-swap="outerHTML">Set up fasting</a>
{% elif fasting_settings.enabled %}
<div class="fasting-widget__topline">
<p class="eyebrow">Intermittent fasting</p>
<span class="fasting-state fasting-state--{{ fasting_phase.name }}">{% if fasting_phase.is_fasting %}Fasting{% else %}Eating{% endif %}</span>
</div>
<div class="fasting-widget__topline"><p class="eyebrow">Intermittent fasting</p><span class="fasting-state fasting-state--{{ fasting_phase.name }}">{% if fasting_phase.is_fasting %}Fasting{% else %}Eating{% endif %}</span></div>
<h2 id="fasting-heading">{% if fasting_phase.is_fasting %}Fasting now{% else %}Eating window open{% endif %}</h2>
<div
class="fasting-timer fasting-timer--{{ fasting_phase.name }}"
data-fasting-timer
data-cycle-start="{{ fasting_phase.cycle_start|date:'c' }}"
data-cycle-end="{{ fasting_phase.cycle_end|date:'c' }}"
data-phase="{{ fasting_phase.name }}"
data-refresh-url="{% url 'planner:fasting-widget' %}"
role="timer"
aria-live="off"
aria-label="{% if fasting_phase.is_fasting %}Fasting{% else %}Eating window{% endif %} progress"
>
<svg class="fasting-timer__ring" viewBox="0 0 120 120" aria-hidden="true">
<circle class="fasting-timer__track" cx="60" cy="60" r="53" pathLength="100"></circle>
<circle class="fasting-timer__progress" cx="60" cy="60" r="53" pathLength="100" data-fasting-progress></circle>
</svg>
<div class="fasting-timer__content">
<strong data-fasting-elapsed>00:00:00</strong>
<span>{% if fasting_phase.is_fasting %}Fasting elapsed{% else %}Eating elapsed{% endif %}</span>
</div>
</div>
<p class="fasting-widget__copy fasting-widget__cycle-copy">
{% if fasting_phase.is_fasting %}
Fasting until <time datetime="{{ fasting_phase.cycle_end|date:'c' }}">{{ fasting_phase.cycle_end|time:"H:i" }}</time>
{% else %}
Next fast at <time datetime="{{ fasting_phase.cycle_end|date:'c' }}">{{ fasting_phase.cycle_end|time:"H:i" }}</time>
{% endif %}
</p>
<dl class="fasting-widget__schedule">
<div><dt>Fasting</dt><dd>{{ fasting_settings.fasting_start_time|time:"H:i" }} daily</dd></div>
<div><dt>Schedule</dt><dd>{{ fasting_settings.fasting_duration_minutes }} min</dd></div>
<div class="fasting-timer fasting-timer--{{ fasting_phase.name }}" data-fasting-timer data-cycle-start="{{ fasting_phase.cycle_start|date:'c' }}" data-cycle-end="{{ fasting_phase.cycle_end|date:'c' }}" data-phase="{{ fasting_phase.name }}" data-refresh-url="{% url 'planner:fasting-widget' %}" role="timer" aria-live="off" aria-label="{% if fasting_phase.is_fasting %}Fasting{% else %}Eating window{% endif %} progress"><svg class="fasting-timer__ring" viewBox="0 0 120 120" aria-hidden="true"><circle class="fasting-timer__track" cx="60" cy="60" r="53" pathLength="100"></circle><circle class="fasting-timer__progress" cx="60" cy="60" r="53" pathLength="100" data-fasting-progress></circle></svg><div class="fasting-timer__content"><strong data-fasting-elapsed>00:00:00</strong><span>{% if fasting_phase.is_fasting %}Fasting elapsed{% else %}Eating elapsed{% endif %}</span></div></div>
<dl class="fasting-widget__windows">
<div><dt>{{ current_window_label }}</dt><dd><time datetime="{{ current_window_start|date:'c' }}">{{ current_window_start|date:"D j M, H:i" }}</time><span aria-hidden="true"> → </span><time datetime="{{ current_window_end|date:'c' }}">{{ current_window_end|date:"D j M, H:i" }}</time></dd></div>
<div><dt>{{ next_window_label }}</dt><dd><time datetime="{{ next_window_start|date:'c' }}">{{ next_window_start|date:"D j M, H:i" }}</time><span aria-hidden="true"> → </span><time datetime="{{ next_window_end|date:'c' }}">{{ next_window_end|date:"D j M, H:i" }}</time></dd></div>
</dl>
<div class="fasting-widget__actions">
<form method="post" action="{% url 'planner:fasting-toggle' %}" hx-post="{% url 'planner:fasting-toggle' %}" hx-target="#fasting-widget" hx-swap="outerHTML">
{% csrf_token %}
<button class="button button--secondary button--compact" type="submit">Pause tracking</button>
</form>
<a class="text-link" href="{% url 'planner:fasting-configure' %}" hx-get="{% url 'planner:fasting-configure' %}" hx-target="#fasting-widget" hx-swap="outerHTML">Adjust</a>
</div>
{% if fasting_history %}
<section class="fasting-history" aria-labelledby="fasting-history-heading">
<h3 id="fasting-history-heading">Recent completed fasts</h3>
<ul>{% for period in fasting_history %}<li><time datetime="{{ period.scheduled_start|date:'c' }}">{{ period.scheduled_start|date:"j M" }}</time><span>{{ period.scheduled_start|time:"H:i" }}–{{ period.scheduled_end|time:"H:i" }}</span></li>{% endfor %}</ul>
</section>
{% endif %}
<dl class="fasting-widget__schedule"><div><dt>Daily fast</dt><dd>{{ fasting_duration_display }}</dd></div><div><dt>Eating window</dt><dd>{{ eating_duration_display }}</dd></div></dl>
<div class="fasting-widget__actions"><form method="post" action="{% url 'planner:fasting-toggle' %}" hx-post="{% url 'planner:fasting-toggle' %}" hx-target="#fasting-widget" hx-swap="outerHTML">{% csrf_token %}<button class="button button--secondary button--compact" type="submit">Pause tracking</button></form><a class="text-link" href="{% url 'planner:fasting-configure' %}" hx-get="{% url 'planner:fasting-configure' %}" hx-target="#fasting-widget" hx-swap="outerHTML">Adjust</a></div>
{% if fasting_history %}<section class="fasting-history" aria-labelledby="fasting-history-heading"><h3 id="fasting-history-heading">Recent completed fasts</h3><ul>{% for period in fasting_history %}<li><time datetime="{{ period.scheduled_start|date:'c' }}">{{ period.scheduled_start|date:"j M" }}</time><span>{{ period.scheduled_start|time:"H:i" }}–{{ period.scheduled_end|time:"H:i" }}</span></li>{% endfor %}</ul></section>{% endif %}
{% else %}
<p class="eyebrow">Intermittent fasting</p>
<h2 id="fasting-heading">Tracking paused</h2>
<p class="fasting-widget__copy">Your history is saved. Resume when you are ready to follow your normal schedule again.</p>
<div class="fasting-widget__actions">
<form method="post" action="{% url 'planner:fasting-toggle' %}" hx-post="{% url 'planner:fasting-toggle' %}" hx-target="#fasting-widget" hx-swap="outerHTML">
{% csrf_token %}
<button class="button button--compact" type="submit">Resume tracking</button>
</form>
<a class="text-link" href="{% url 'planner:fasting-configure' %}" hx-get="{% url 'planner:fasting-configure' %}" hx-target="#fasting-widget" hx-swap="outerHTML">Adjust schedule</a>
</div>
<p class="eyebrow">Intermittent fasting</p><h2 id="fasting-heading">Tracking paused</h2><p class="fasting-widget__copy">Your history is saved. Resume when you are ready to follow your normal schedule again.</p><div class="fasting-widget__actions"><form method="post" action="{% url 'planner:fasting-toggle' %}" hx-post="{% url 'planner:fasting-toggle' %}" hx-target="#fasting-widget" hx-swap="outerHTML">{% csrf_token %}<button class="button button--compact" type="submit">Resume tracking</button></form><a class="text-link" href="{% url 'planner:fasting-configure' %}" hx-get="{% url 'planner:fasting-configure' %}" hx-target="#fasting-widget" hx-swap="outerHTML">Adjust schedule</a></div>
{% endif %}
</article>
@@ -1,4 +1,4 @@
<section class="checkin-panel" id="neck-headache-checkin" aria-labelledby="checkin-heading">
<section class="checkin-panel{% if onboarding_tour.target == 'wellbeing' %} onboarding-highlight{% endif %}" id="neck-headache-checkin" aria-labelledby="checkin-heading">
<header class="checkin-panel__header">
<div>
<p class="eyebrow">Daily wellbeing</p>
@@ -0,0 +1,9 @@
<section class="onboarding-tour" aria-labelledby="onboarding-title" aria-live="polite">
<p class="eyebrow">Getting started · {{ onboarding_tour.number }} of {{ onboarding_tour.total }}</p>
<h2 id="onboarding-title">{{ onboarding_tour.title }}</h2>
<p>{{ onboarding_tour.copy }}</p>
<div class="onboarding-tour__actions">
<form method="post" action="{% url 'planner:onboarding-advance' %}">{% csrf_token %}<input type="hidden" name="action" value="next"><button class="button button--compact" type="submit">{% if onboarding_tour.is_last %}Finish tour{% else %}Next{% endif %}</button></form>
<form method="post" action="{% url 'planner:onboarding-advance' %}">{% csrf_token %}<input type="hidden" name="action" value="skip"><button class="text-link" type="submit">Turn help off</button></form>
</div>
</section>
@@ -1,4 +1,4 @@
<section class="workout-panel" id="workout-section" aria-labelledby="workouts-heading">
<section class="workout-panel{% if onboarding_tour.target == 'workouts' %} onboarding-highlight{% endif %}" id="workout-section" aria-labelledby="workouts-heading">
<header class="workout-panel__header">
<div><p class="eyebrow">Daily movement</p><h2 id="workouts-heading">Daily Workout</h2><p>Today, {{ workout_date|date:"l, j F" }}</p></div>
<div class="workout-panel__summary">{% if workout_calories_total is not None %}<strong>{{ workout_calories_total }} kcal</strong><span>Total burned today</span>{% else %}<strong>—</strong><span>No calorie data yet</span>{% endif %}</div>
@@ -11,9 +11,11 @@
</div>
</section>
{% if onboarding_tour %}{% include 'planner/partials/onboarding_tour.html' %}{% endif %}
<div class="home-layout">
<div class="home-main">
<section class="task-panel" aria-label="Task list">
<section class="task-panel{% if onboarding_tour.target == 'tasks' %} onboarding-highlight{% endif %}" aria-label="Task list">
<form class="task-filters" method="get" hx-get="{% url 'planner:task-list' %}" hx-target="#task-list" hx-push-url="true" hx-trigger="change" hx-indicator="#loading-indicator">
<div>
<label for="status-filter">Show</label>
@@ -4,6 +4,7 @@
<section class="settings-page">
<p class="eyebrow">Personal preferences</p><h1>Settings</h1>
<section class="settings-card"><h2>Time zone</h2><p>Dates and displayed times, including fasting, use this time zone. Europe/Amsterdam is the default.</p><form method="post">{% csrf_token %}<input type="hidden" name="section" value="time-zone">{% for field in time_zone_form %}<div class="form-field">{{ field.label_tag }}{{ field }}{% if field.help_text %}<small>{{ field.help_text }}</small>{% endif %}{{ field.errors }}</div>{% endfor %}<button class="button" type="submit">Save time zone</button></form></section>
<section class="settings-card"><h2>First-run help</h2><p>{% if onboarding_enabled %}The guided tour is ready to continue on your dashboard.{% else %}Help is off. You can run the tour again whenever you want.{% endif %}</p><form method="post">{% csrf_token %}<input type="hidden" name="section" value="onboarding"><button class="button" type="submit" name="action" value="restart">Run feature tour</button><button class="text-link" type="submit" name="action" value="disable">Turn help off</button></form></section>
<section class="settings-card"><h2>Location &amp; weather</h2><p>Location is optional and private. It is used only to retrieve your forecast.</p><form method="post" data-geolocation-form>{% csrf_token %}<input type="hidden" name="section" value="location">{% for field in profile_form %}<div class="form-field">{{ field.label_tag }}{{ field }}{% if field.help_text %}<small>{{ field.help_text }}</small>{% endif %}{{ field.errors }}</div>{% endfor %}<button class="button button--secondary" type="button" data-use-location>Use my current location</button><span data-location-status role="status"></span><button class="button" type="submit">Save location</button></form></section>
<section class="settings-card"><h2>Sick Day Mode</h2><p>Temporarily defer routine work while you recover.</p><form method="post">{% csrf_token %}<input type="hidden" name="section" value="sick-day">{% for field in sick_form %}<div class="form-field">{{ field.label_tag }}{{ field }}{% if field.help_text %}<small>{{ field.help_text }}</small>{% endif %}{{ field.errors }}</div>{% endfor %}<button class="button" type="submit">Save Sick Day settings</button></form></section>
<section class="settings-card"><h2>Fasting</h2><form method="post">{% csrf_token %}<input type="hidden" name="section" value="fasting">{% for field in fasting_form %}<div class="form-field">{{ field.label_tag }}{{ field }}{% if field.help_text %}<small>{{ field.help_text }}</small>{% endif %}{{ field.errors }}</div>{% endfor %}<button class="button" type="submit">Save fasting settings</button></form></section>