Calls' app switcher lists the suite
The bar's switcher now shows Docs, Sheets, Slides, Calendar, Memoria and Calls as tiles, Calls marked current, above All apps, from estilo's chrome.SuiteApps (estilo d53b8e9); brand icons are served at /static/estilo/brand/. Landed on local make ci (go1.26.5): the hub runner's go1.26.10 fails the credits test as it does on main, on Paul's ruling to merge on local checks. Reviewed by GPT-6-Astra via Codex (#27). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Squashed from feat/switcher-tiles into main.
5 files changed,
+56
−13
go.mod+1 −1go.sum+2 −2internal/calls/app.go+4 −0internal/calls/chrome.go+4 −2internal/calls/home_consumer_test.go+45 −8
CI failed — run details
diff --git a/go.mod b/go.mod| index d260432..f74cada 100644 |
| --- a/go.mod |
| +++ b/go.mod |
| @@ -3,7 +3,7 @@ module amadan.net/oficina/calls |
| go 1.26.0 |
| require ( |
| - amadan.net/oficina/estilo.git v0.0.0-20261001093750-530cb932e768 |
| + amadan.net/oficina/estilo.git v0.0.0-20261024225350-d53b8e9533a1 |
| 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 ed9096b..29d8244 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-20261024225350-d53b8e9533a1 h1:Xaidrm9rzFyne6PujFYXiY7nGRy+/KzH7kGBM2+D5LQ= |
| +amadan.net/oficina/estilo.git v0.0.0-20261024225350-d53b8e9533a1/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/calls/app.go b/internal/calls/app.go| index 76ac871..e3938f0 100644 |
| --- a/internal/calls/app.go |
| +++ b/internal/calls/app.go |
| @@ -1,6 +1,7 @@ |
| package calls |
| import ( |
| + "amadan.net/oficina/estilo.git/brand" |
| "amadan.net/oficina/estilo.git/chrome" |
| "amadan.net/oficina/estilo.git/sky" |
| "amadan.net/oficina/estilo.git/theme" |
| @@ -597,6 +598,9 @@ func build(ctx context.Context, d *db.DB, cfg Config) (*http.ServeMux, *app, err |
| mux.Handle("GET "+sky.Prefix, sky.Handler()) |
| // Onest, Calma's typeface, served by estilo under its versioned prefix. |
| mux.Handle("GET "+theme.FontPrefix, theme.FontHandler()) |
| + // The app switcher's tile icons: estilo's suite brand marks, public |
| + // and sessionless like the sky. |
| + mux.Handle("GET "+brand.Prefix, brand.Handler()) |
| mux.Handle("/", r) |
| return mux, a, nil |
| } |
diff --git a/internal/calls/chrome.go b/internal/calls/chrome.go| index 5f1169f..36358e1 100644 |
| --- a/internal/calls/chrome.go |
| +++ b/internal/calls/chrome.go |
| @@ -227,8 +227,9 @@ func (a *app) offersHomeLink(v viewer) 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), as Docs, Sheets and Slides do. |
| +// configured: the suite's six apps as tiles, each at its own host under |
| +// the directory's (estilo's chrome.SuiteApps), with Calls marked current, |
| +// then "All apps". |
| func (a *app) switcher() *chrome.Switcher { |
| if a.cfg.home == nil || a.cfg.home.Directory == "" { |
| return nil |
| @@ -236,6 +237,7 @@ func (a *app) switcher() *chrome.Switcher { |
| return &chrome.Switcher{ |
| Label: "Oficina apps", |
| CurrentLabel: "(this app)", |
| + Apps: chrome.SuiteApps(a.cfg.home.Directory, "calls"), |
| AllApps: estilomenu.Item{Href: a.cfg.home.Directory + "/", Label: "All apps"}, |
| } |
| } |
diff --git a/internal/calls/home_consumer_test.go b/internal/calls/home_consumer_test.go| index 02575a9..5baf14e 100644 |
| --- a/internal/calls/home_consumer_test.go |
| +++ b/internal/calls/home_consumer_test.go |
| @@ -71,23 +71,60 @@ func TestHomeSigninWhenSignedInReturnsToPage(t *testing.T) { |
| } |
| } |
| -// "All apps" goes to the hub directory, from HOME_DIRECTORY_ORIGIN, in the |
| -// account corner, and is absent when no directory is configured. |
| -func TestAllAppsLinksToDirectory(t *testing.T) { |
| - link := `href="` + homeTestDirectory + `/"` |
| +// The switcher appears only with a hub directory (HOME_DIRECTORY_ORIGIN) |
| +// configured. It shows the suite's six apps as tiles at their hosts under |
| +// the directory's, with Calls marked current, and "All apps" to the |
| +// directory below a divider. The tiles' icons are served without a session. |
| +func TestTheSwitcherShowsTheSuite(t *testing.T) { |
| f := newHomeConsumerFixture(t, homeTestDirectory) |
| f.local(t) |
| + want := []string{"docs", "sheets", "slides", "calendar", "memoria", "calls"} |
| + names := []string{"Docs", "Sheets", "Slides", "Calendar", "Memoria", "Calls"} |
| for _, path := range []string{"/", "/settings"} { |
| w := f.do("GET", path, "") |
| - if body := w.Body.String(); w.Code != http.StatusOK || !strings.Contains(body, link) || !strings.Contains(body, ">All apps<") { |
| - t.Fatalf("GET %s (%d): no All apps link to %s/", path, w.Code, homeTestDirectory) |
| + body := w.Body.String() |
| + start := strings.Index(body, `<details estilo-switcher name="estilo-menus">`) |
| + if w.Code != http.StatusOK || start < 0 { |
| + t.Fatalf("GET %s (%d): no switcher", path, w.Code) |
| } |
| + 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="`+homeTestDirectory+`/"><span estilo-menu-label>All apps</span></a>`) { |
| + t.Errorf("GET %s: the switcher does not offer All apps below the tiles: %s", path, panel) |
| + } |
| + var tiles []string |
| + for _, tile := range strings.Split(grid, "<a estilo-switcher-app ")[1:] { |
| + tiles = append(tiles, tile[:strings.Index(tile, "</a>")]) |
| + } |
| + if len(tiles) != len(want) { |
| + t.Fatalf("GET %s: %d tiles, want %d: %s", path, len(tiles), len(want), grid) |
| + } |
| + for i, slug := range want { |
| + head := `href="https://` + slug + `.directory.example.test/"` |
| + if slug == "calls" { |
| + 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("GET %s: tile %d = %s, want it to start %s", path, i, tiles[i], head) |
| + } |
| + } |
| + if strings.Count(grid, "aria-current") != 1 || !strings.Contains(tiles[5], "<span estilo-visually-hidden> (this app)</span>") { |
| + t.Errorf("GET %s: Calls is not the one current tile: %s", path, grid) |
| + } |
| + } |
| + |
| + icon := httptest.NewRecorder() |
| + f.handler.ServeHTTP(icon, httptest.NewRequest("GET", homeTestOrigin+"/static/estilo/brand/calls.svg", nil)) |
| + if icon.Code != http.StatusOK { |
| + t.Errorf("a tile's icon, without a session, is %d", icon.Code) |
| } |
| bare := newHomeConsumerFixture(t, "") |
| bare.local(t) |
| - if body := bare.do("GET", "/", "").Body.String(); strings.Contains(body, "All apps") { |
| - t.Fatal("All apps shown with no directory configured") |
| + if body := bare.do("GET", "/", "").Body.String(); strings.Contains(body, "estilo-switcher") || strings.Contains(body, "All apps") { |
| + t.Fatal("a switcher with no directory configured") |
| } |
| } |