oficina / memoria Public

Memoria's app switcher lists the suite

The bar's switcher now shows Docs, Sheets, Slides, Calendar, Memoria and
Calls as tiles, Memoria marked current, above All apps, from estilo's
chrome.SuiteApps (estilo d53b8e9). Reviewed by GPT-6-Astra via Codex (#28).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from feat/switcher-tiles into main.
Paul Campbell pushed by claude agent, operated by paul@keymail.dev fe18ea2f4eecd35e50199f0173dcf735e4cedde6 parent 81f7fe9
8 files changed, +114 −16
  • go.mod +1 −1
  • go.sum +2 −2
  • internal/memoria/app.go +5 −0
  • internal/memoria/chrome.go +5 −3
  • internal/memoria/chrome_test.go +41 −7
  • internal/memoria/static/chrome.css +39 −0
  • internal/memoriatest/routes_test.go +7 −3
  • internal/memoriatest/vendored_test.go +14 −0

CI passed — run details

diff --git a/go.mod b/go.mod
index ac69207..63390e4 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.26
toolchain go1.26.5
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/oficina/suite v0.0.0-20260905215529-60b01a8a0d6d
diff --git a/go.sum b/go.sum
index 55f5156..361663e 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/memoria/app.go b/internal/memoria/app.go
index 370732f..d1d2543 100644
--- a/internal/memoria/app.go
+++ b/internal/memoria/app.go
@@ -7,6 +7,7 @@ import (
"net/url"
"strings"
+ "amadan.net/oficina/estilo.git/brand"
"amadan.net/oficina/estilo.git/chrome"
"amadan.net/oficina/estilo.git/sky"
"amadan.net/oficina/estilo.git/theme"
@@ -192,6 +193,10 @@ func App(d *db.DB, origin string, sealer *seal.Sealer, logger *slog.Logger) (*ht
// literal for the same reason; TestSkyRouteIsEstilosPrefix keeps it
// equal to sky.Prefix.
mux.Handle("GET /static/estilo/sky/v1/", sky.Handler())
+ // The app switcher's tile icons (estilo brand), public and
+ // sessionless like the sky. A literal for the same reason;
+ // TestBrandRouteIsEstilosPrefix keeps it equal to brand.Prefix.
+ mux.Handle("GET /static/estilo/brand/", brand.Handler())
mux.Handle("/", r)
return mux, a, nil
}
diff --git a/internal/memoria/chrome.go b/internal/memoria/chrome.go
index cdfaef2..089821e 100644
--- a/internal/memoria/chrome.go
+++ b/internal/memoria/chrome.go
@@ -252,9 +252,10 @@ 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):
-// 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 Memoria marked
+// current, then "All apps". The tile icons are served by brand.Handler,
+// mounted in app.go.
func (a *app) switcher() *chrome.Switcher {
if a.home == nil || a.directory == "" {
return nil
@@ -262,6 +263,7 @@ func (a *app) switcher() *chrome.Switcher {
return &chrome.Switcher{
Label: "Oficina apps",
CurrentLabel: "(this app)",
+ Apps: chrome.SuiteApps(a.directory, "memoria"),
AllApps: estilomenu.Item{Href: a.directory + "/", Label: "All apps"},
}
}
diff --git a/internal/memoria/chrome_test.go b/internal/memoria/chrome_test.go
index 92bb12a..a66f801 100644
--- a/internal/memoria/chrome_test.go
+++ b/internal/memoria/chrome_test.go
@@ -20,17 +20,51 @@ import (
assertioncrypto "amadan.net/rastrillo/rastrillo/crypto"
)
-// §6: the switcher is "All apps" alone (Paul's §13 answer 2), to the hub
-// directory, and only when Home names one. No directory, no switcher.
-func TestTheSwitcherIsAllAppsOnly(t *testing.T) {
+// §6: the switcher appears only when Home names a hub directory. It shows
+// the suite's six apps as tiles, each at its own host under the
+// directory's, with Memoria the one current tile, and "All apps" to the
+// directory below a divider. No directory, no switcher. The tiles' icons
+// are served to a request carrying no cookies at all.
+func TestTheSwitcherShowsTheSuite(t *testing.T) {
f := newHomeRouterFixtureDir(t, "https://directory.example.test")
+ icon := httptest.NewRecorder()
+ f.handler.ServeHTTP(icon, httptest.NewRequest("GET", homeTestOrigin+"/static/estilo/brand/calls.svg", nil))
+ if icon.Code != http.StatusOK || !strings.Contains(icon.Body.String(), "<svg") {
+ t.Errorf("a tile's icon, asked for with no cookies, is %d", icon.Code)
+ }
f.local(t)
b := f.do("GET", "/", "").Body.String()
- if !strings.Contains(b, "<details estilo-switcher") || !strings.Contains(b, `href="https://directory.example.test/"`) || !strings.Contains(b, ">All apps<") {
- t.Errorf("the bar has no All apps switcher to the directory:\n%s", b)
+ start := strings.Index(b, "<details estilo-switcher")
+ if start < 0 {
+ t.Fatalf("the bar has no switcher:\n%s", b)
+ }
+ panel := b[start:]
+ panel = panel[:strings.Index(panel, "</details>")]
+ grid, allApps, ok := strings.Cut(panel, "<hr>")
+ if !ok || !strings.Contains(allApps, `href="https://directory.example.test/"`) || !strings.Contains(allApps, ">All apps<") {
+ t.Errorf("the switcher does not offer All apps to the directory below the tiles:\n%s", panel)
+ }
+ var tiles []string
+ for _, tile := range strings.Split(grid, "<a estilo-switcher-app ")[1:] {
+ tiles = append(tiles, tile[:strings.Index(tile, "</a>")])
+ }
+ slugs := []string{"docs", "sheets", "slides", "calendar", "memoria", "calls"}
+ names := []string{"Docs", "Sheets", "Slides", "Calendar", "Memoria", "Calls"}
+ if len(tiles) != len(slugs) {
+ t.Fatalf("%d tiles, want %d:\n%s", len(tiles), len(slugs), grid)
+ }
+ for i, slug := range slugs {
+ head := `href="https://` + slug + `.directory.example.test/"`
+ if slug == "memoria" {
+ 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.Contains(b, "estilo-switcher-app") {
- t.Error("the switcher shows app tiles; R2 shows All apps alone")
+ if strings.Count(grid, "aria-current") != 1 || !strings.Contains(tiles[4], "<span estilo-visually-hidden> (this app)</span>") {
+ t.Errorf("Memoria is not the one current tile:\n%s", grid)
}
g := newHomeRouterFixture(t)
g.local(t)
diff --git a/internal/memoria/static/chrome.css b/internal/memoria/static/chrome.css
index 74bd3d7..d16395d 100644
--- a/internal/memoria/static/chrome.css
+++ b/internal/memoria/static/chrome.css
@@ -184,6 +184,15 @@
[estilo-switcher-app]:focus-visible { background: var(--rst-accent-soft); }
[estilo-switcher-app][aria-current] { background: var(--rst-accent-soft); font-weight: 600; }
[estilo-switcher-app] img { border-radius: 21%; }
+/* Three 5.5rem tiles hung from the trigger overflow a phone's inline start
+ (at 320px, and sooner when the corner is the wider "Sign in" link), so
+ below 30rem the panel spans the bar instead, as menubar panels do, and
+ the three columns share its width. */
+@media (max-width: 30rem) {
+ [estilo-switcher] { position: static; }
+ [estilo-switcher-panel] { inset-inline: 0.5rem; inline-size: auto; min-inline-size: 0; max-inline-size: none; }
+ [estilo-switcher-grid] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
+}
/* The account menu. The account is always the last thing at the inline
end of the bar: the "same corner" rule. */
@@ -208,6 +217,36 @@
[estilo-menu-identity-name] + [estilo-menu-identity-address] { font-size: var(--rst-fs-xs); }
[estilo-bar-signin] { flex: none; }
+/* The account at a sidebar rail's foot (Account.Rail), for an app whose
+ chrome is a rail rather than the bar. The trigger is a row the rail's
+ width: the avatar, then who is signed in, cut short with an ellipsis.
+ It stays in the page flow, so its highlight stays square. The panel is
+ the foot's own width, edge to edge with the trigger: hung from the
+ inline end of a foot narrower than the bar's 15rem panel it ran off
+ the window's start edge, and from the inline start it ran past the
+ rail, whose overflow-y: auto clips it (Fichas' first screenshot). */
+[estilo-account~="rail"] > [estilo-bar-trigger] {
+ justify-content: flex-start;
+ gap: var(--rst-sp-2);
+ inline-size: 100%;
+ block-size: auto;
+ min-block-size: 2.5rem;
+ color: var(--rst-text);
+}
+[estilo-account-who] { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+[estilo-account~="rail"] > [estilo-account-panel] { inset-inline: 0; inline-size: auto; min-inline-size: 0; max-inline-size: none; }
+/* A drop-up where the rail is the viewport's height (rastrillo's shell
+ breakpoint): below the foot there is only the window's edge. Below
+ 800px the rail is a disclosure at the top of the page, with the page
+ under it and too little above, so the panel opens downward there. */
+@media (min-width: 800px) {
+ [estilo-account~="rail"] > [estilo-account-panel] {
+ inset-block-start: auto;
+ inset-block-end: calc(100% + 4px);
+ max-block-size: max(calc(100dvh - 5rem), 8rem);
+ }
+}
+
/* Visually hidden, still announced. */
[estilo-visually-hidden] { position: absolute; clip-path: inset(50%); inline-size: 1px; block-size: 1px; overflow: hidden; white-space: nowrap; }
diff --git a/internal/memoriatest/routes_test.go b/internal/memoriatest/routes_test.go
index 1501722..580af25 100644
--- a/internal/memoriatest/routes_test.go
+++ b/internal/memoriatest/routes_test.go
@@ -67,9 +67,13 @@ func TestNoUndeclaredRoutes(t *testing.T) {
// the same bargain as the font. TestSkyRouteIsEstilosPrefix
// keeps the literal equal to sky.Prefix.
"GET /static/estilo/sky/v1/": true,
- "/": true,
- "/auth/": true,
- "POST /signout": true,
+ // The app switcher's tile icons: public artwork again.
+ // TestBrandRouteIsEstilosPrefix keeps the literal equal to
+ // brand.Prefix.
+ "GET /static/estilo/brand/": true,
+ "/": true,
+ "/auth/": true,
+ "POST /signout": true,
}
// Router method -> index of the pattern argument. Handle, HandleFunc,
// Mount and Route bind every method, so they read as ANY.
diff --git a/internal/memoriatest/vendored_test.go b/internal/memoriatest/vendored_test.go
index aef4e7b..1fc4c65 100644
--- a/internal/memoriatest/vendored_test.go
+++ b/internal/memoriatest/vendored_test.go
@@ -2,6 +2,7 @@ package memoriatest
import (
"amadan.net/oficina/estilo.git/base"
+ "amadan.net/oficina/estilo.git/brand"
"amadan.net/oficina/estilo.git/busy"
"amadan.net/oficina/estilo.git/chrome"
estilomenu "amadan.net/oficina/estilo.git/menu"
@@ -105,6 +106,19 @@ func TestSkyRouteIsEstilosPrefix(t *testing.T) {
}
}
+// app.go mounts the switcher's tile icons at a literal pattern, for the
+// same reason as the sky. This keeps it equal to estilo's brand.Prefix,
+// which chrome.SuiteApps builds every tile's icon path from.
+func TestBrandRouteIsEstilosPrefix(t *testing.T) {
+ src, err := os.ReadFile(filepath.Join("..", "memoria", "app.go"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !bytes.Contains(src, []byte(`"GET `+brand.Prefix+`"`)) {
+ t.Errorf("app.go does not mount the brand icons at %s", brand.Prefix)
+ }
+}
+
// The sign-in door (estilo chrome's estilo-signin and friends) is styled
// by chrome.css and sky.css, vendored into static/ so they are served
// fingerprinted like every other stylesheet. Pinned to the estilo this