oficina / sheets Public

The app switcher lists the suite's apps, not "All apps" alone

Paul asked for the "All apps" dropdown to be a list of apps rather than
a dropdown holding a single item. The switcher now carries estilo's
chrome.SuiteApps tiles (Docs, Sheets, Slides, Calendar, Memoria, Calls,
each at its own host under the hub directory's), with Sheets marked
current, then "All apps" below a divider. It still appears only when
Home names a hub directory.

The icons are served by brand.Handler, which Sheets already mounts
publicly; the test now also fetches a tile icon with no cookies.

estilo is pinned to its feat/switcher-tiles branch commit 0e40034 until
that branch merges; it must be re-pinned to the estilo main commit then.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev e95ed8ccacfb4de529b26781edd3ec888500fe1f parent 6d700d6
4 files changed, +47 −14
  • go.mod +1 −1
  • go.sum +2 −2
  • internal/sheets/chrome.go +4 −3
  • internal/sheets/chrome_test.go +40 −8

CI passed — run details

diff --git a/go.mod b/go.mod
index 26dc9bd..0e66e2c 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module amadan.net/oficina/sheets
go 1.25.0
require (
- amadan.net/oficina/estilo.git v0.0.0-20261001093750-530cb932e768
+ amadan.net/oficina/estilo.git v0.0.0-20261024214622-0e4003429d57
amadan.net/oficina/home/connect v0.0.0-20261001093757-2bec942ddd0c
amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489
amadan.net/rastrillo/rastrillo v0.27.1-0.20261006204347-fb806a287060
diff --git a/go.sum b/go.sum
index ddcf78e..fc08185 100644
--- a/go.sum
+++ b/go.sum
@@ -1,5 +1,5 @@
-amadan.net/oficina/estilo.git v0.0.0-20261001093750-530cb932e768 h1:bVscoa9fH5LdLDjlyecZhrX7JzWPT0blb57MH0FIm2U=
-amadan.net/oficina/estilo.git v0.0.0-20261001093750-530cb932e768/go.mod h1:4u0jNBtIdMLOsJyrScfqoEuYDJF7BBM3qM9YWbzt6aw=
+amadan.net/oficina/estilo.git v0.0.0-20261024214622-0e4003429d57 h1:5z3h+F5H9gpa4gLWxJKFaLFwNiNsI7zDKoRx9VPnwvI=
+amadan.net/oficina/estilo.git v0.0.0-20261024214622-0e4003429d57/go.mod h1:4u0jNBtIdMLOsJyrScfqoEuYDJF7BBM3qM9YWbzt6aw=
amadan.net/oficina/home/connect v0.0.0-20261001093757-2bec942ddd0c h1:3yxO2D8BxDLMGfFV2o6Sp9Z91yLnjDCIuRKHVWORa8A=
amadan.net/oficina/home/connect v0.0.0-20261001093757-2bec942ddd0c/go.mod h1:YroavXe43Wietec+po8mtSk4a9Bir2h31Q3iAf4MWxI=
amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489 h1:RPKtyry/71i06o8L+gjAaUyexbmG56kO1YPs601URAM=
diff --git a/internal/sheets/chrome.go b/internal/sheets/chrome.go
index 3bdd9a2..7018e94 100644
--- a/internal/sheets/chrome.go
+++ b/internal/sheets/chrome.go
@@ -223,9 +223,9 @@ func (a *App) offersHomeLink(r *http.Request) bool {
}
// switcher is the app switcher, or nil when no hub directory is
-// configured. It shows "All apps" alone and no tiles (Paul's §13 answer
-// 2): a tile today still costs an assertion exchange through the
-// directory session.
+// configured: the suite's six apps as tiles, each at its own host under
+// the directory's (estilo's chrome.SuiteApps), with Sheets marked
+// current, then "All apps".
func (a *App) switcher() *chrome.Switcher {
if a.directory == "" {
return nil
@@ -233,6 +233,7 @@ func (a *App) switcher() *chrome.Switcher {
return &chrome.Switcher{
Label: "Oficina apps",
CurrentLabel: "(this app)",
+ Apps: chrome.SuiteApps(a.directory, "sheets"),
AllApps: estilomenu.Item{Href: a.directory + "/", Label: "All apps"},
}
}
diff --git a/internal/sheets/chrome_test.go b/internal/sheets/chrome_test.go
index 720aac6..0d43943 100644
--- a/internal/sheets/chrome_test.go
+++ b/internal/sheets/chrome_test.go
@@ -151,9 +151,10 @@ func TestTheSignedOutCorner(t *testing.T) {
}
}
-// §6: the switcher shows only when Home names a hub directory, and then
-// holds "All apps" alone (Paul's §13 answer 2) — no tiles yet.
-func TestTheSwitcherIsAllAppsOnly(t *testing.T) {
+// §6: the switcher shows only when Home names a hub directory. It holds
+// the suite's six apps as tiles at their hosts under the directory's,
+// with Sheets marked current, and "All apps" below a divider.
+func TestTheSwitcherShowsTheSuite(t *testing.T) {
app, cookies := signIn(t)
if body := page(t, app, cookies, "/sheets").Body.String(); strings.Contains(body, "estilo-switcher") {
t.Error("a standalone instance shows a switcher; there is no directory to switch through")
@@ -161,13 +162,44 @@ func TestTheSwitcherIsAllAppsOnly(t *testing.T) {
f := newHomeFixtureWith(t, "https://oficina.example.com")
f.local(t, signedInAddress)
body := f.request(t, "GET", "/sheets", nil, false).Body.String()
- for _, want := range []string{`<details estilo-switcher name="estilo-menus">`, `aria-label="Oficina apps"`, `<a estilo-menu-item href="https://oficina.example.com/"><span estilo-menu-label>All apps</span></a>`} {
- if !strings.Contains(body, want) {
- t.Errorf("the switcher lacks %s", want)
+ if !strings.Contains(body, `aria-label="Oficina apps"`) {
+ t.Error("the switcher is not labelled Oficina apps")
+ }
+ start := strings.Index(body, `<details estilo-switcher name="estilo-menus">`)
+ if start < 0 {
+ t.Fatal("no switcher", body)
+ }
+ panel := body[start:]
+ panel = panel[:strings.Index(panel, "</details>")]
+ grid, allApps, ok := strings.Cut(panel, "<hr>")
+ if !ok || !strings.Contains(allApps, `<a estilo-menu-item href="https://oficina.example.com/"><span estilo-menu-label>All apps</span></a>`) {
+ t.Error("the switcher does not offer All apps below the tiles", panel)
+ }
+ var tiles []string
+ for _, tile := range strings.Split(grid, "<a estilo-switcher-app ")[1:] {
+ tiles = append(tiles, tile[:strings.Index(tile, "</a>")])
+ }
+ want := []string{"docs", "sheets", "slides", "calendar", "memoria", "calls"}
+ names := []string{"Docs", "Sheets", "Slides", "Calendar", "Memoria", "Calls"}
+ if len(tiles) != len(want) {
+ t.Fatalf("%d tiles, want %d: %s", len(tiles), len(want), grid)
+ }
+ for i, slug := range want {
+ head := `href="https://` + slug + `.oficina.example.com/"`
+ if slug == "sheets" {
+ head += ` aria-current="true"`
}
+ head += `><img src="/static/estilo/brand/` + slug + `.svg" alt="" width="32" height="32"><span>` + names[i]
+ if !strings.HasPrefix(tiles[i], head) {
+ t.Errorf("tile %d = %s, want it to start %s", i, tiles[i], head)
+ }
+ }
+ if strings.Count(grid, "aria-current") != 1 || !strings.Contains(tiles[1], "<span estilo-visually-hidden> (this app)</span>") {
+ t.Error("Sheets is not the one current tile", grid)
}
- if strings.Contains(body, "estilo-switcher-app") {
- t.Error("the switcher renders app tiles before Home's /apps/<slug> hop is ready")
+ // Every tile's icon is served here, publicly: no cookies at all.
+ if rec := do(t, app, httptest.NewRequest(http.MethodGet, "/static/estilo/brand/calls.svg", nil)); rec.Code != http.StatusOK {
+ t.Errorf("a tile's icon is %d", rec.Code)
}
}