Files
Django_TasksApp/main/stress/templates/stress/journal.html
T
2026-10-19 16:51:53 +02:00

51 lines
5.4 KiB
HTML

{% extends 'planner/base.html' %}{% load static %}
{% block title %}Stress journal · Tasknest{% endblock %}
{% block content %}
<link rel="stylesheet" href="{% static 'stress/stress.css' %}?v=1">
<div class="stress-page">
<header class="stress-header">
<p class="eyebrow">Private check-ins</p>
<h1>Stress journal</h1>
<p>Capture how you feel when it happens. A before-sleep check-in is kept distinct from how you feel after waking.</p>
</header>
<div class="stress-layout">
<div class="stress-main">
<section class="stress-panel" aria-labelledby="stress-log-title">
<h2 id="stress-log-title">Log stress</h2>
<p class="stress-muted">More than one check-in per day is welcome. Notes, stressors, and symptoms are optional.</p>
<form method="post">{% include 'stress/_form.html' with submit_label='Save check-in' %}</form>
</section>
<section class="stress-panel" aria-labelledby="stress-history-title">
<div class="stress-section-head"><div><h2 id="stress-history-title">History</h2><p class="stress-muted">Your latest check-ins, newest first.</p></div></div>
<form class="stress-filter" method="get" aria-label="Filter stress history">
<label>Search notes or tags <input type="search" name="q" value="{{ query }}"></label>
<label>Timing <select name="timing"><option value="">All times</option><option value="before_sleep"{% if timing == 'before_sleep' %} selected{% endif %}>Before sleep</option><option value="after_waking"{% if timing == 'after_waking' %} selected{% endif %}>After waking</option><option value="anytime"{% if timing == 'anytime' %} selected{% endif %}>Anytime</option></select></label>
{% if selected_day %}<input type="hidden" name="date" value="{{ selected_day|date:'Y-m-d' }}">{% endif %}
<button class="button button--secondary" type="submit">Filter</button>
{% if query or timing or selected_day %}<a href="{% url 'stress:journal' %}">Clear filters</a>{% endif %}
</form>
{% if selected_day %}<p>Showing {{ selected_day|date:'j F Y' }}.</p>{% endif %}
<ol class="stress-entries">
{% for entry in entries %}
<li class="stress-entry">
<div class="stress-entry__top"><strong class="stress-score">{{ entry.score }}<small>/10</small></strong><div><strong>{{ entry.get_timing_display }}</strong><time datetime="{{ entry.recorded_at|date:'c' }}">{{ entry.recorded_at|date:'j M Y, H:i' }}</time></div><a href="{% url 'stress:edit' entry.pk %}">Edit</a></div>
{% if entry.note %}<p>{{ entry.note|linebreaksbr }}</p>{% endif %}
{% if entry.tags %}<p class="stress-chips" aria-label="Stressors">{% for tag in entry.tags %}<span>{{ tag }}</span>{% endfor %}</p>{% endif %}
{% if entry.symptoms %}<p class="stress-muted">Symptoms: {{ entry.symptoms|join:', ' }}</p>{% endif %}
</li>
{% empty %}<li class="stress-empty">No check-ins match this view.</li>{% endfor %}
</ol>
</section>
</div>
<aside class="stress-side" aria-label="Stress patterns">
<section class="stress-panel"><h2>Patterns</h2><p class="stress-muted">Descriptive averages only. Stress can change after a difficult dream; these numbers do not show cause and effect.</p>
<div class="stress-stats"><div><strong>Past 7 days</strong><p>{{ week.count }} check-in{{ week.count|pluralize }}</p><p>Before sleep: {% if week.before_average is not None %}{{ week.before_average }}/10{% else %}—{% endif %}</p><p>After waking: {% if week.after_average is not None %}{{ week.after_average }}/10{% else %}—{% endif %}</p></div><div><strong>Past 30 days</strong><p>{{ month.count }} check-in{{ month.count|pluralize }}</p><p>Before sleep: {% if month.before_average is not None %}{{ month.before_average }}/10{% else %}—{% endif %}</p><p>After waking: {% if month.after_average is not None %}{{ month.after_average }}/10{% else %}—{% endif %}</p></div></div>
<h3>Dreams and nearby stress</h3><p class="stress-muted">Dreams use their wake-up date. “Before sleep” is from the previous calendar day; “after waking” is from the wake-up day. These are nearby reports, not evidence of cause.</p>
{% if dream_comparisons %}<div class="stress-comparison-list">{% for row in dream_comparisons %}<p><a href="{% url 'dreams:detail' row.dream.pk %}">{{ row.dream.wake_up_date|date:'j M' }} · {{ row.dream.title }}</a>{% if row.dream.is_nightmare %} · Nightmare{% endif %}{% if row.dream.vividness is not None %} · Vividness {{ row.dream.vividness }}/10{% endif %}<br><small>Before sleep: {% if row.before_score is not None %}{{ row.before_score }}/10{% else %}—{% endif %} · After waking: {% if row.after_score is not None %}{{ row.after_score }}/10{% else %}—{% endif %}</small></p>{% endfor %}</div>{% else %}<p class="stress-muted">No dreams logged in the past 30 days.</p>{% endif %}
</section>
<section class="stress-panel"><h2>Past 30 days</h2><p class="stress-muted">Choose a day to see its check-ins.</p><div class="stress-calendar">{% for day in calendar %}<a href="?date={{ day.date|date:'Y-m-d' }}#stress-history-title" aria-label="{{ day.date|date:'j F Y' }}: {{ day.count }} check-in{{ day.count|pluralize }}" class="{% if day.count %}has-entry{% endif %}{% if selected_day == day.date %} is-selected{% endif %}"><span>{{ day.date|date:'j' }}</span>{% if day.count %}<small>{{ day.count }}</small>{% endif %}</a>{% endfor %}</div></section>
</aside>
</div>
</div>
{% endblock %}