WIP: weather integration

This commit is contained in:
Joren de Graaf
2026-08-11 21:11:31 +02:00
parent f63134d00f
commit 6a20cb80ca
30 changed files with 1054 additions and 31 deletions
+14 -1
View File
@@ -23,7 +23,20 @@
<div>{{ form_row(form.estimatedDurationMinutes) }}</div>
<div>{{ form_row(form.priority) }}</div>
<div>{{ form_row(form.category) }}</div>
<div class="task-composer__checks">{{ form_row(form.isRecurring) }}</div>
<div>{{ form_row(form.scheduledFor) }}</div>
<div>{{ form_row(form.isOutdoor) }}</div>
<div>{{ form_row(form.weatherProfile) }}</div>
<div>{{ form_row(form.isOutdoor) }}</div>
<div>{{ form_row(form.weatherProfile) }}</div>
<div class="task-composer__repeat">
{{ form_widget(form.isRecurring, {attr: {class: 'task-composer__repeat-input'}}) }}
{{ form_label(form.isRecurring) }}
{{ form_errors(form.isRecurring) }}
<div class="task-composer__repeat-fields">
<div>{{ form_row(form.recurrenceInterval) }}</div>
<div>{{ form_row(form.recurrenceUnit) }}</div>
</div>
</div>
</div>
<details class="task-composer__notes">
<summary>Add a note</summary>
@@ -1,2 +1,2 @@
{{ include('task/_task_composer.html.twig', {form: form}) }}
{{ include('task/_task_list.html.twig', {tasks: tasks, out_of_band: true}) }}
{{ include('task/_task_list.html.twig', {tasks: tasks, selected_date: selected_date|default(null), out_of_band: true}) }}
+8
View File
@@ -1,5 +1,6 @@
<li class="task-list__item{{ not task.isActive ? ' task-list__item--completed' : '' }}">
<form class="task-list__completion-form">
<input type="hidden" name="date" value="{{ selected_date|default('now')|date('Y-m-d') }}">
<input type="hidden" name="_token" value="{{ csrf_token('completion' ~ task.id) }}">
<input
id="task-completion-{{ task.id }}"
@@ -20,6 +21,9 @@
<span class="visually-hidden">Mark {{ task.title }} as {{ task.isActive ? 'completed' : 'active' }}</span>
</label>
<a class="task-list__title" href="{{ path('app_task_edit', {'id': task.id}) }}">{{ task.title }}</a>
{% if task.isRecurring %}
<span class="task-list__recurrence">Every {{ task.recurrenceInterval }} {{ task.recurrenceUnit }}{{ task.recurrenceInterval != 1 ? 's' : '' }}</span>
{% endif %}
</form>
<form
class="task-list__remove-form"
@@ -33,4 +37,8 @@
<span class="material-symbols-outlined" aria-hidden="true">delete</span>
</button>
</form>
<a class="task-list__title" href="{{ path('app_task_edit', {'id': task.id}) }}">
<span class="material-symbols-outlined" aria-hidden="true">edit</span>
</a>
</li>
+1 -1
View File
@@ -1,6 +1,6 @@
<ul id="task-list" class="task-list" aria-label="Tasks"{% if out_of_band|default(false) %} hx-swap-oob="outerHTML"{% endif %}>
{% for task in tasks %}
{{ include('task/_task_item.html.twig', {task: task}) }}
{{ include('task/_task_item.html.twig', {task: task, selected_date: selected_date|default(null)}) }}
{% else %}
<li class="task-list__empty">No tasks yet.</li>
{% endfor %}
@@ -9,10 +9,11 @@
<section class="social-battery" aria-labelledby="social-battery-title">
<div>
<h2 id="social-battery-title">Social battery</h2>
<p>Choose today’s energy. We’ll put tasks that fit your {{ battery_budget }}-minute budget first.</p>
<p>Choose your energy. We’ll put tasks that fit your {{ battery_budget }}-minute budget first.</p>
</div>
<form class="social-battery__levels">
<input type="hidden" name="_token" value="{{ csrf_token('social_battery') }}">
<input type="hidden" name="date" value="{{ selected_date|default('now')|date('Y-m-d') }}">
{% for level, option in battery_levels %}
<input
id="social-battery-{{ level }}"
@@ -0,0 +1,7 @@
<section class="weather-forecast" aria-label="Today’s weather forecast">
<span class="material-symbols-outlined" aria-hidden="true">{{ forecast.weatherCode in [0, 1] ? 'sunny' : (forecast.weatherCode in [2, 3] ? 'cloud' : 'rainy') }}</span>
<div>
<strong>{{ forecast.temperatureMax|round }}°C</strong>
<span>{{ forecast.weatherCode in [0, 1] ? 'Clear' : (forecast.weatherCode in [2, 3] ? 'Cloudy' : 'Rain possible') }}</span>
</div>
</section>
+22 -1
View File
@@ -6,14 +6,35 @@
<div class="container">
<div class="task-list-header">
<h1>Tasks</h1>
<nav class="day-picker" aria-label="Choose task day">
<a href="{{ path('app_task_index', {date: selected_date|date_modify('-1 day')|date('Y-m-d')}) }}" aria-label="Previous day">‹</a>
<div>
<strong>{{ selected_date|date('l, j F') }}</strong>
{% if selected_date|date('Y-m-d') != 'now'|date('Y-m-d') %}
<a href="{{ path('app_task_index') }}">Today</a>
{% endif %}
</div>
<a href="{{ path('app_task_index', {date: selected_date|date_modify('+1 day')|date('Y-m-d')}) }}" aria-label="Next day">›</a>
</nav>
</div>
<button class="weather-location" type="button" data-weather-location data-location-url="{{ path('app_task_location') }}" data-location-token="{{ csrf_token('weather_location') }}">
<span class="material-symbols-outlined" aria-hidden="true">my_location</span>
{{ has_saved_location ? 'Update weather location' : 'Use my location for weather' }}
</button>
{% if weather_forecast %}
{{ include('task/_weather_forecast.html.twig', {forecast: weather_forecast}) }}
{{ include('task/_task_composer.html.twig', {form: form}) }}
{% endif %}
{{ include('task/_task_recommendations.html.twig', {
tasks: tasks,
battery_level: battery_level,
battery_budget: battery_budget
battery_budget: battery_budget,
selected_date: selected_date
}) }}
</div>