Highlight today on the Lunch screen
This commit is contained in:
1 parent
d600332af4
commit
2c3867b1c8
2 files changed
+12
-3
No files matched your search
@@ -8,6 +8,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|||||||
### Added
|
### Added
|
||||||
|
|
||||||
- A published scan's photo can still be viewed from its scan page, under "Scanned photo", until it's deleted after `IMAGE_RETENTION_DAYS`.
|
- A published scan's photo can still be viewed from its scan page, under "Scanned photo", until it's deleted after `IMAGE_RETENTION_DAYS`.
|
||||||
|
- Today stands out on the Lunch screen: a filled day number like the month view, a "Today" label and a tinted card.
|
||||||
|
|
||||||
## [0.0.3] - 2026-11-06
|
## [0.0.3] - 2026-11-06
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
import Utensils from '@lucide/svelte/icons/utensils';
|
import Utensils from '@lucide/svelte/icons/utensils';
|
||||||
import { api, type LunchDay } from '../lib/api';
|
import { api, type LunchDay } from '../lib/api';
|
||||||
import { app, toast } from '../lib/state.svelte';
|
import { app, toast } from '../lib/state.svelte';
|
||||||
import { monthLabel, parse, shiftMonth, thisMonth } from '../lib/dates';
|
import { iso, monthLabel, parse, shiftMonth, thisMonth } from '../lib/dates';
|
||||||
import { foodEmoji } from '../lib/foodEmoji';
|
import { foodEmoji } from '../lib/foodEmoji';
|
||||||
import PageHeader from '../lib/ui/PageHeader.svelte';
|
import PageHeader from '../lib/ui/PageHeader.svelte';
|
||||||
import EmptyState from '../lib/ui/EmptyState.svelte';
|
import EmptyState from '../lib/ui/EmptyState.svelte';
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
const open = $derived(days?.filter((d) => !d.greyed) ?? []); // days that can be picked
|
const open = $derived(days?.filter((d) => !d.greyed) ?? []); // days that can be picked
|
||||||
const allPicked = $derived(open.length > 0 && open.every((d) => d.picked));
|
const allPicked = $derived(open.length > 0 && open.every((d) => d.picked));
|
||||||
let bulkBusy = $state(false);
|
let bulkBusy = $state(false);
|
||||||
|
const today = iso(new Date());
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
if (childId === null) return;
|
if (childId === null) return;
|
||||||
@@ -127,13 +128,15 @@
|
|||||||
<ul class="days">
|
<ul class="days">
|
||||||
{#each days as d (d.date)}
|
{#each days as d (d.date)}
|
||||||
{@const date = parse(d.date)}
|
{@const date = parse(d.date)}
|
||||||
<li class="day card" class:closed={d.greyed} class:picked={d.picked}>
|
{@const isToday = d.date === today}
|
||||||
|
<li class="day card" class:closed={d.greyed} class:picked={d.picked} class:today={isToday} aria-current={isToday ? 'date' : undefined}>
|
||||||
<div class="day-head">
|
<div class="day-head">
|
||||||
<span class="date-tile" aria-hidden="true">
|
<span class="date-tile" aria-hidden="true">
|
||||||
<span class="dow">{date.toLocaleDateString(undefined, { weekday: 'short' })}</span>
|
<span class="dow">{date.toLocaleDateString(undefined, { weekday: 'short' })}</span>
|
||||||
<span class="dnum tabular">{date.getDate()}</span>
|
<span class="dnum tabular">{date.getDate()}</span>
|
||||||
|
{#if isToday}<span class="today-tag">Today</span>{/if}
|
||||||
</span>
|
</span>
|
||||||
<span class="visually-hidden">{date.toLocaleDateString(undefined, { weekday: 'long', month: 'long', day: 'numeric' })}</span>
|
<span class="visually-hidden">{isToday ? 'Today, ' : ''}{date.toLocaleDateString(undefined, { weekday: 'long', month: 'long', day: 'numeric' })}</span>
|
||||||
<span class="head-end">
|
<span class="head-end">
|
||||||
{#if d.warning}<span class="badge warn"><TriangleAlert size={12} aria-hidden="true" />{d.warning}</span>{/if}
|
{#if d.warning}<span class="badge warn"><TriangleAlert size={12} aria-hidden="true" />{d.warning}</span>{/if}
|
||||||
<!-- Decoration only: the foods are listed below, so screen readers skip this. -->
|
<!-- Decoration only: the foods are listed below, so screen readers skip this. -->
|
||||||
@@ -177,6 +180,11 @@
|
|||||||
.day { display: flex; flex-direction: column; gap: var(--s3); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
|
.day { display: flex; flex-direction: column; gap: var(--s3); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
|
||||||
.day.picked { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow-1); }
|
.day.picked { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow-1); }
|
||||||
.day.closed { background: var(--day-closed); box-shadow: none; }
|
.day.closed { background: var(--day-closed); box-shadow: none; }
|
||||||
|
/* Today: the same filled day number as the month view, plus a label so it isn't color alone. */
|
||||||
|
.day.today:not(.closed) { background: color-mix(in srgb, var(--primary-soft) 60%, var(--surface)); }
|
||||||
|
.today .dnum { background: var(--primary); color: var(--on-primary); border-radius: var(--r-full); padding: 0 var(--s2); min-width: 2ch; text-align: center; }
|
||||||
|
.today .date-tile { align-items: center; }
|
||||||
|
.today-tag { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--primary-text); }
|
||||||
.day-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
|
.day-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
|
||||||
.date-tile { display: flex; align-items: baseline; gap: 6px; }
|
.date-tile { display: flex; align-items: baseline; gap: 6px; }
|
||||||
.head-end { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
|
.head-end { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
|
||||||
|
|||||||
Reference in new issue
Block a user