diff --git a/home/home.go b/home/home.go index 00c0be09..1a98281f 100644 --- a/home/home.go +++ b/home/home.go @@ -287,14 +287,24 @@ func Handler(w http.ResponseWriter, r *http.Request) { var b strings.Builder - // Date header + admin actions + // Date header: date + inline weather summary + admin actions now := time.Now() _, viewerAcc := auth.TrySession(r) - inviteLink := "" + inviteHTML := "" if viewerAcc != nil && viewerAcc.Admin && auth.InviteOnly() { - inviteLink = ` + Invite user` + inviteHTML = `+ Invite` } - b.WriteString(fmt.Sprintf(`

%s%s

`, now.Format("Monday, 2 January 2006"), inviteLink)) + b.WriteString(fmt.Sprintf(`
%s%s
`, now.Format("Monday, 2 January 2006"), inviteHTML)) + // Inline script reads cached weather summary from localStorage + // and renders "10°C ☁️" next to the date. No fetch — reads what + // the weather card already cached. + b.WriteString(``) // Status card content (will be prepended to left column). // Built by user.RenderStatusStream so the fragment endpoint and the diff --git a/internal/app/html/mu.css b/internal/app/html/mu.css index 6ee9c982..405fb3f8 100644 --- a/internal/app/html/mu.css +++ b/internal/app/html/mu.css @@ -611,6 +611,21 @@ body.page-home #page-title ~ #customize-link { #home-date { color: #888; margin: 0 0 16px; + display: flex; + align-items: center; + gap: 8px; + flex-wrap: wrap; +} +#home-date-text { + white-space: nowrap; +} +#home-date-weather { + font-size: 13px; + color: #999; +} +#home-date-actions { + margin-left: auto; + font-size: 13px; } #home-status-form { @@ -2371,7 +2386,7 @@ a.highlight { display: contents; } #home-date { - text-align: center; + justify-content: center; } /* Compact cards on mobile */ diff --git a/weather/weather.go b/weather/weather.go index 5b63c3df..247526fb 100644 --- a/weather/weather.go +++ b/weather/weather.go @@ -74,6 +74,7 @@ fetch('/weather?lat='+lat+'&lon='+lon,{headers:{'Accept':'application/json'}}) var f=d.forecast; if(!f||!f.Current){return} var c=f.Current; +try{localStorage.setItem('mu_weather_now',JSON.stringify({temp:Math.round(c.TempC),desc:c.Description||''}))}catch(e){} var h='
'; h+=''+Math.round(c.TempC)+'°C'; h+=''+c.Description+'';