fe improvements

This commit is contained in:
2026-02-04 08:06:17 -03:00
parent c97ef63756
commit 99826be6aa
3 changed files with 131 additions and 102 deletions

View File

@@ -86,6 +86,7 @@
display: flex;
align-items: flex-start;
justify-content: flex-end;
box-sizing: border-box;
}
.days-grid {
@@ -114,6 +115,7 @@
font-weight: bold;
font-size: 11pt;
color: #e0e0e0;
box-sizing: border-box;
}
.day-grid {
@@ -137,17 +139,25 @@
color: white;
overflow: hidden;
cursor: pointer;
transition: all 0.2s;
transition: all 0.15s ease-out;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
border: 1px solid rgba(0, 0, 0, 0.3);
}
.task-block:hover {
z-index: 100;
transform: scale(1.05);
z-index: 100 !important;
overflow: visible;
min-height: fit-content;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
}
.task-block:hover .task-label,
.task-block:hover .task-time {
background: inherit;
white-space: nowrap;
display: inline-block;
}
.task-label {
font-weight: bold;
margin-bottom: 2px;
@@ -157,28 +167,6 @@
font-size: 8pt;
opacity: 0.9;
}
.block-tooltip {
display: none;
position: absolute;
background: #2a2a2a;
color: #e0e0e0;
padding: 8px 12px;
border-radius: 4px;
font-size: 10pt;
z-index: 1000;
white-space: nowrap;
pointer-events: none;
left: 100%;
top: 0;
margin-left: 10px;
border: 1px solid #444;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.task-block:hover .block-tooltip {
display: block;
}
</style>
{% endblock head %} {% block content %}
@@ -194,25 +182,45 @@
<a href="/">Today</a>
<a href="/calendar/daily">Calendar</a>
<a
href="/switches/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}"
href="/switches/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}{% if tz_name %}?tz={{ tz_name }}{% endif %}"
>Switches</a
>
<a href="/totals">All Time</a>
<select
id="tz-selector"
style="
margin-left: auto;
background: #2a2a2a;
color: #e0e0e0;
border: 1px solid #444;
padding: 5px 10px;
border-radius: 3px;
font-family: monospace;
font-size: 12pt;
"
onchange="window.location.href = window.location.pathname + '?grid={{ grid }}&tz=' + this.value"
>
{% for tz_value, tz_label in timezones %}
<option value="{{ tz_value }}" {% if tz_name == tz_value or (not tz_name and loop.first) %}selected{% endif %}>
{{ tz_label }}
</option>
{% endfor %}
</select>
</div>
<div class="nav-tabs">
<a
href="/calendar/daily/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid={{ grid }}"
href="/calendar/daily/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid={{ grid }}{% if tz_name %}&tz={{ tz_name }}{% endif %}"
class="{% if scope == 'daily' %}active{% endif %}"
>Daily</a
>
<a
href="/calendar/weekly/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid={{ grid }}"
href="/calendar/weekly/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid={{ grid }}{% if tz_name %}&tz={{ tz_name }}{% endif %}"
class="{% if scope == 'weekly' %}active{% endif %}"
>Weekly</a
>
<a
href="/calendar/monthly/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid={{ grid }}"
href="/calendar/monthly/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid={{ grid }}{% if tz_name %}&tz={{ tz_name }}{% endif %}"
class="{% if scope == 'monthly' %}active{% endif %}"
>Monthly</a
>
@@ -221,19 +229,19 @@
>
<span style="color: #999; font-size: 11pt">Grid:</span>
<a
href="/calendar/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid=1"
href="/calendar/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid=1{% if tz_name %}&tz={{ tz_name }}{% endif %}"
class="{% if grid == 1 %}active{% endif %}"
style="font-size: 11pt"
>1h</a
>
<a
href="/calendar/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid=3"
href="/calendar/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid=3{% if tz_name %}&tz={{ tz_name }}{% endif %}"
class="{% if grid == 3 %}active{% endif %}"
style="font-size: 11pt"
>3h</a
>
<a
href="/calendar/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid=6"
href="/calendar/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid=6{% if tz_name %}&tz={{ tz_name }}{% endif %}"
class="{% if grid == 6 %}active{% endif %}"
style="font-size: 11pt"
>6h</a
@@ -243,7 +251,7 @@
<div class="date-nav">
<a
href="/calendar/{{ scope }}/{{ prev_date.year }}/{{ prev_date.month }}/{{ prev_date.day }}?grid={{ grid }}"
href="/calendar/{{ scope }}/{{ prev_date.year }}/{{ prev_date.month }}/{{ prev_date.day }}?grid={{ grid }}{% if tz_name %}&tz={{ tz_name }}{% endif %}"
></a
>
{% if scope == 'daily' %}
@@ -254,7 +262,7 @@
<span class="date-info">{{ base_date.strftime('%B %Y') }}</span>
{% endif %}
<a
href="/calendar/{{ scope }}/{{ next_date.year }}/{{ next_date.month }}/{{ next_date.day }}?grid={{ grid }}"
href="/calendar/{{ scope }}/{{ next_date.year }}/{{ next_date.month }}/{{ next_date.day }}?grid={{ grid }}{% if tz_name %}&tz={{ tz_name }}{% endif %}"
></a
>
</div>
@@ -284,41 +292,31 @@
></div>
{% endfor %} {% set day_blocks = [] %} {% for block in blocks %}
{% if block.start.date() == day.date() %} {% set _ =
day_blocks.append(block) %} {% endif %} {% endfor %} {# Group
blocks by hour for stacking #} {% set hour_groups = {} %} {% for
block in day_blocks %} {% set hour_key = block.hour %} {% if
hour_key not in hour_groups %} {% set _ =
hour_groups.update({hour_key: []}) %} {% endif %} {% set _ =
hour_groups[hour_key].append(block) %} {% endfor %} {# Render
blocks stacked within each hour #} {% for hour_key, hour_blocks
in hour_groups.items() %} {% for block in hour_blocks %} {% set
idx = loop.index0 %} {% set base_top_px = block.hour * 60 %} {%
set duration_hours = block.duration / 3600.0 %} {% set height_px
= duration_hours * 60 %} {% if height_px < 2 %}{% set height_px
= 2 %}{% endif %} {% set task_hash = block.task_path|hash if
block.task_path else 0 %} {% set base_color_hue = task_hash %
360 %} {% set active_color = 'hsl(%d, 60%%,
45%%)'|format(base_color_hue) %} {# Cascade effect: shift right
and down for overlapping blocks #} {# Each block shifts 8% right
and 4px down #} {% set offset_pct = idx * 8 %} {% set width_pct
= 100 - (idx * 8) - 2 %} {% set vertical_offset_px = idx * 4 %}
{% set top_px = base_top_px + vertical_offset_px %}
day_blocks.append(block) %} {% endif %} {% endfor %} {% set
hour_groups = {} %} {% for block in day_blocks %} {% set
hour_key = block.hour %} {% if hour_key not in hour_groups %} {%
set _ = hour_groups.update({hour_key: []}) %} {% endif %} {% set
_ = hour_groups[hour_key].append(block) %} {% endfor %} {% for
hour_key, hour_blocks in hour_groups.items() %} {% for block in
hour_blocks %} {% set idx = loop.index0 %} {% set base_top_px =
block.hour * 60 %} {% set duration_hours = block.duration /
3600.0 %} {% set height_px = duration_hours * 60 %} {% if
height_px < 2 %}{% set height_px = 2 %}{% endif %} {% set
task_hash = block.task_path|hash if block.task_path else 0 %} {%
set base_color_hue = task_hash % 360 %} {% set active_color =
'hsl(%d, 60%%, 45%%)'|format(base_color_hue) %} {% set
offset_pct = idx * 8 %} {% set width_pct = 100 - (idx * 8) - 2
%} {% set vertical_offset_px = idx * 4 %} {% set top_px =
base_top_px + vertical_offset_px %}
<div
class="task-block"
style="top: {{ top_px }}px; height: {{ height_px }}px;
left: {{ offset_pct }}%; width: {{ width_pct }}%;
background: {{ active_color }}; opacity: 0.9;"
style="top: {{ top_px }}px; height: {{ height_px }}px; left: {{ offset_pct }}%; width: {{ width_pct }}%; background: {{ active_color }}; opacity: 0.9; z-index: {{ idx + 1 }};"
>
<div class="task-label">{{ block.task_path }}</div>
<div class="task-time">
{{ (block.duration // 60)|int }}m
</div>
<div class="block-tooltip">
<strong>{{ block.task_path }}</strong><br />
Hour: {{ '%02d:00'|format(block.hour) }}<br />
Duration: {{ (block.duration // 60)|int }} minutes
</div>
</div>
{% endfor %} {% endfor %}
</div>

View File

@@ -148,24 +148,29 @@
"
>
<a href="/">Today</a>
<a href="/calendar/daily">Calendar</a>
<a href="/calendar/daily{% if tz_name %}?tz={{ tz_name }}{% endif %}"
>Calendar</a
>
<a href="/switches/daily">Switches</a>
<a href="/totals">All Time</a>
<select id="tz-selector" style="margin-left: auto; background: #2a2a2a; color: #e0e0e0; border: 1px solid #444; padding: 5px 10px; border-radius: 3px; font-family: monospace; font-size: 12pt;" onchange="window.location.href = window.location.pathname + '?tz=' + this.value">
{% for tz_value, tz_label in timezones %}<option value="{{ tz_value }}" {% if tz_name == tz_value or (not tz_name and loop.first) %}selected{% endif %}>{{ tz_label }}</option>{% endfor %}
</select>
</div>
<div class="nav-tabs">
<a
href="/switches/daily/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}"
href="/switches/daily/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}{% if tz_name %}?tz={{ tz_name }}{% endif %}"
class="{% if scope == 'daily' %}active{% endif %}"
>Daily</a
>
<a
href="/switches/weekly/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}"
href="/switches/weekly/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}{% if tz_name %}?tz={{ tz_name }}{% endif %}"
class="{% if scope == 'weekly' %}active{% endif %}"
>Weekly</a
>
<a
href="/switches/monthly/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}"
href="/switches/monthly/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}{% if tz_name %}?tz={{ tz_name }}{% endif %}"
class="{% if scope == 'monthly' %}active{% endif %}"
>Monthly</a
>
@@ -173,7 +178,7 @@
<div class="date-nav">
<a
href="/switches/{{ scope }}/{{ prev_date.year }}/{{ prev_date.month }}/{{ prev_date.day }}"
href="/switches/{{ scope }}/{{ prev_date.year }}/{{ prev_date.month }}/{{ prev_date.day }}{% if tz_name %}?tz={{ tz_name }}{% endif %}"
></a
>
{% if scope == 'daily' %}
@@ -184,7 +189,7 @@
<span class="date-info">{{ base_date.strftime('%B %Y') }}</span>
{% endif %}
<a
href="/switches/{{ scope }}/{{ next_date.year }}/{{ next_date.month }}/{{ next_date.day }}"
href="/switches/{{ scope }}/{{ next_date.year }}/{{ next_date.month }}/{{ next_date.day }}{% if tz_name %}?tz={{ tz_name }}{% endif %}"
></a
>
</div>