oficina / home Public

Add app icons and filters to Recent with a compact header launcher

claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev c9d53570f2b01651790654f4a7fc32d033ea67f1 parent f1dfd08
3 files changed, +47 −12
  • internal/home/dashboard.go +2 −2
  • internal/home/static/calma.css +26 −3
  • internal/home/templates/dashboard.html +19 −7

CI passed — run details

diff --git a/internal/home/dashboard.go b/internal/home/dashboard.go
index 78cecd8..5ed3897 100644
--- a/internal/home/dashboard.go
+++ b/internal/home/dashboard.go
@@ -15,7 +15,7 @@ import (
type dashboardRow struct {
dashboard.Item
- App, When, DateTime string
+ App, AppID, Icon, When, DateTime string
}
type dashboardPage struct {
Apps []catalogApp
@@ -212,7 +212,7 @@ func (a *App) renderDashboard(w http.ResponseWriter, r *http.Request, team dashb
continue
}
for _, item := range result.Response.Items {
- row := dashboardRow{Item: item, App: result.Source.Name()}
+ row := dashboardRow{Item: item, App: result.Source.Name(), AppID: result.Source.App, Icon: versioned("/static/brand/" + result.Source.App + ".svg")}
if result.Source.kind() == "documents" {
row.When = item.Updated.UTC().Format("2 Jan 2006, 15:04 UTC")
row.DateTime = item.Updated.Format(time.RFC3339)
diff --git a/internal/home/static/calma.css b/internal/home/static/calma.css
index 11f2973..f9fd7b5 100644
--- a/internal/home/static/calma.css
+++ b/internal/home/static/calma.css
@@ -86,9 +86,11 @@ div[home-app] img { filter: saturate(0.6); opacity: 0.8; }
[home-teams] { display: grid; justify-items: start; gap: var(--rst-sp-2); }
/* The selected team's work takes priority over its compact app launcher. */
-[home-apps-compact] { grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)); gap: 8px; margin-bottom: 32px; }
-[home-apps-compact] [home-app] { padding: 12px 8px; gap: 5px; border-radius: 12px; }
-[home-apps-compact] img { margin: 0; }
+[home-dashboard-head] { min-block-size: 0; padding-block: 32px 28px; }
+[home-dashboard-heading] { display: grid; grid-template-columns: minmax(0, 1fr) 264px; align-items: center; gap: 24px; }
+[home-apps-compact] { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
+[home-apps-compact] [home-app] { padding: 8px; gap: 4px; border-radius: 10px; font-size: .75rem; }
+[home-apps-compact] img { margin: 0; width: 24px; height: 24px; }
[home-apps-compact] small { font-size: .75rem; }
[home-dashboard] { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 40px; }
[home-dashboard] h2 { margin: 0 0 16px; }
@@ -103,3 +105,24 @@ div[home-app] img { filter: saturate(0.6); opacity: 0.8; }
[home-team-nav] a { padding: 8px 12px; border-radius: 8px; }
[home-team-nav] [aria-current] { background: var(--rst-surface); font-weight: 650; }
@media (max-width: 700px) { [home-dashboard] { grid-template-columns: minmax(0, 1fr); gap: 32px; } }
+
+/* Native radio controls filter the existing recent list without a request or script. */
+[home-recent-filter] { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 0 0 12px; min-inline-size: 0; }
+[home-recent-filter] label { position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--rst-line); border-radius: 999px; color: var(--rst-text-muted); cursor: pointer; font-size: .875rem; }
+[home-recent-filter] label:has(:checked) { background: var(--rst-surface); color: var(--rst-text); font-weight: 650; border-color: currentColor; }
+[home-recent-filter] label:has(:focus-visible) { outline: 2px solid var(--rst-text); outline-offset: 3px; }
+[home-recent] [home-document-link] { flex-direction: row; align-items: center; gap: 12px; }
+[home-document-link] img { flex: 0 0 32px; }
+[home-document-details] { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
+[home-filter-empty] { display: none; }
+[home-recent-section]:has([value="docs"]:checked) [home-document-app]:not([home-document-app="docs"]),
+[home-recent-section]:has([value="sheets"]:checked) [home-document-app]:not([home-document-app="sheets"]),
+[home-recent-section]:has([value="slides"]:checked) [home-document-app]:not([home-document-app="slides"]) { display: none; }
+[home-recent-section]:has([value="docs"]:checked):not(:has([home-document-app="docs"])) [home-filter-empty],
+[home-recent-section]:has([value="sheets"]:checked):not(:has([home-document-app="sheets"])) [home-filter-empty],
+[home-recent-section]:has([value="slides"]:checked):not(:has([home-document-app="slides"])) [home-filter-empty] { display: block; }
+@media (max-width: 600px) {
+ [home-dashboard-heading] { grid-template-columns: minmax(0, 1fr); gap: 20px; }
+ [home-dashboard-head] { padding-block: 24px; }
+ [home-apps-compact] [home-app] { flex-direction: row; justify-content: center; gap: 6px; min-height: 44px; }
+}
diff --git a/internal/home/templates/dashboard.html b/internal/home/templates/dashboard.html
index 6c8b966..fc8de7e 100644
--- a/internal/home/templates/dashboard.html
+++ b/internal/home/templates/dashboard.html
@@ -1,23 +1,35 @@
{{define "title"}}{{.Data.Team.Name}} · Oficina{{end}}
{{define "content"}}
-<header home-hub-head estilo-sky-host>
+<header home-hub-head home-dashboard-head estilo-sky-host>
{{template "estilo-sky" suiteSky}}
+<div home-dashboard-heading>
+<div>
<h1>{{.Data.Team.Name}}</h1>
<p home-hub-lede>Your recent work and what’s coming up.</p>
{{if gt (len .Data.Teams) 1}}<nav home-team-nav aria-label="Teams">{{range .Data.Teams}}<a href="/?team={{.ID}}" {{if eq .ID $.Data.Team.ID}}aria-current="page"{{end}}>{{.Name}}</a>{{end}}</nav>{{end}}
-</header>
+</div>
<nav aria-label="Apps"><ul home-apps home-apps-compact>
{{range .Data.Apps}}<li>{{if .Href}}<a home-app href="{{.Href}}">{{else}}<div home-app>{{end}}
<img src="{{.Icon}}" alt="" width="28" height="28"><b>{{.Name}}</b>
{{if not .Href}}<small>{{.Status}}</small>{{end}}
{{if .Href}}</a>{{else}}</div>{{end}}</li>{{end}}
</ul></nav>
+</div>
+</header>
<div home-dashboard>
-<section aria-labelledby="recent-heading">
-<h2 id="recent-heading">Recent documents</h2>
-{{if .Data.Documents}}<ul home-recent>{{range .Data.Documents}}
-<li><a href="{{.URL}}"><b><bdi>{{if .Title}}{{.Title}}{{else}}Untitled{{end}}</bdi></b><span>{{.App}} · <time datetime="{{.DateTime}}">{{.When}}</time></span></a></li>
-{{end}}</ul>{{else if .Data.DocumentsComplete}}<p>No recent documents yet. Open an app to get started.</p>{{else}}<p>Your recent documents will appear here when the apps are connected and available.</p>{{end}}
+<section home-recent-section aria-labelledby="recent-heading">
+<h2 id="recent-heading">Recent</h2>
+{{if .Data.Documents}}
+<fieldset home-recent-filter>
+<legend class="rst-sr-only">Filter recent documents by app</legend>
+<label><input class="rst-sr-only" type="radio" name="recent-app" value="all" checked>All</label>
+<label><input class="rst-sr-only" type="radio" name="recent-app" value="docs">Docs</label>
+<label><input class="rst-sr-only" type="radio" name="recent-app" value="sheets">Sheets</label>
+<label><input class="rst-sr-only" type="radio" name="recent-app" value="slides">Slides</label>
+</fieldset>
+<ul home-recent>{{range .Data.Documents}}
+<li home-document-app="{{.AppID}}"><a home-document-link href="{{.URL}}"><img src="{{.Icon}}" alt="" width="32" height="32"><div home-document-details><b><bdi>{{if .Title}}{{.Title}}{{else}}Untitled{{end}}</bdi></b><span>{{.App}} · <time datetime="{{.DateTime}}">{{.When}}</time></span></div></a></li>
+{{end}}</ul><p home-filter-empty>No documents from this app in the recent list.</p>{{else if .Data.DocumentsComplete}}<p>No recent documents yet. Open an app to get started.</p>{{else}}<p>Your recent documents will appear here when the apps are connected and available.</p>{{end}}
<p home-dashboard-note>The 20 most recently updated documents across your connected apps. Open an app for its full list.</p>
</section>
<section aria-labelledby="agenda-heading">