oficina / base Public

Put every app, Store, People and Settings too, in one grid on Home

Base's own pages sat in a dock out of line with the other apps. Now
the glass Apps panel holds one grid of alike items, on wide screens and
phones: the Oficina apps, the installed apps, then Store, People and
Settings, all the same size on the same columns. The desktop dock row
and its hairline go, and so does the phone's fixed dock; the grid
scrolls with Home, four columns inside the panel on a phone. The Ask
popover and the phone sheet are unchanged.

TestHomeApps and TestMobile check every item shares the first row's
columns and size, and that nothing is fixed to the screen; the
contrast, 44px and overflow checks stay.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 18fc2bbb42038101738500ec7f27d669e3319598 parent b99fae5
7 files changed, +93 −99
  • internal/browsertest/layout_test.go +43 −35
  • internal/browsertest/light_test.go +3 −3
  • internal/browsertest/mobile_test.go +3 −3
  • internal/look/static/app.css +12 −22
  • internal/web/home.go +3 −2
  • internal/web/templates/home.html +6 −8
  • internal/webtest/home_test.go +23 −26
diff --git a/internal/browsertest/layout_test.go b/internal/browsertest/layout_test.go
index 062cfec..28fb7b4 100644
--- a/internal/browsertest/layout_test.go
+++ b/internal/browsertest/layout_test.go
@@ -60,7 +60,7 @@ func installAll(t *testing.T, b *baseApp) {
// gridNames is every app Home's grid should hold, in order.
func gridNames(apps []config.OficinaApp) string {
- b, _ := json.Marshal(append(names(apps), "Scratchpad", "Welcome"))
+ b, _ := json.Marshal(append(names(apps), "Scratchpad", "Welcome", "Store", "People", "Settings"))
return string(b)
}
@@ -72,10 +72,26 @@ func names(apps []config.OficinaApp) []string {
return out
}
+// sameColumnsJS checks a grid of apps: every item the same size, with
+// the same size icon, each on one of the first row's columns.
+const sameColumnsJS = `function sameColumns(grid, icon, problems) {
+ const first = grid[0].getBoundingClientRect(), cols = [];
+ for (const a of grid) { const r = a.getBoundingClientRect(); if (Math.abs(r.top - first.top) < 1) cols.push(Math.round(r.left)); }
+ for (const a of grid) {
+ const r = a.getBoundingClientRect(), i = a.querySelector(".icon").getBoundingClientRect(), name = a.textContent.trim();
+ if (Math.abs(r.width - first.width) > 0.5 || Math.abs(r.height - first.height) > 0.5) problems.push(name + " is " + r.width + "x" + r.height + ", not " + first.width + "x" + first.height);
+ if (Math.abs(i.width - icon) > 2 || Math.abs(i.height - icon) > 2) problems.push(name + "'s icon is " + i.width + "x" + i.height);
+ if (!cols.some(c => Math.abs(c - r.left) <= 1)) problems.push(name + " at " + r.left + " is off the columns " + cols.join(","));
+ if (r.width < 44 || r.height < 44) problems.push(name + " is " + r.width + "x" + r.height);
+ }
+ return cols;
+}`
+
// appsPanelJS checks Home's apps panel on a wide screen: glass, at most
-// 960px and under the steps; every app in order in a wrapping grid of 64px
-// icons, inside the panel; then a hairline and the dock of Base's own pages.
+// 960px and under the steps; every app, Base's own pages last, in one
+// wrapping grid of alike items with 64px icons, inside the panel.
const appsPanelJS = `((want) => {
+ ` + sameColumnsJS + `
const problems = [], vw = document.documentElement.clientWidth;
const panel = document.querySelector("nav.apps");
if (!panel || !panel.checkVisibility()) return "no apps panel";
@@ -85,61 +101,53 @@ const appsPanelJS = `((want) => {
if (p.width > 960.5) problems.push("panel is " + p.width + " wide");
if (p.top < document.querySelector(".steps").getBoundingClientRect().bottom) problems.push("panel is not under the steps");
if (p.left < 0 || p.right > vw) problems.push("panel at " + p.left + "-" + p.right + " of " + vw);
+ if (document.querySelector(".dock")) problems.push("there is still a dock");
const grid = [...panel.querySelectorAll(".app-grid a.app")];
const got = grid.map(a => a.textContent.trim());
if (JSON.stringify(got) !== JSON.stringify(want)) problems.push("grid " + JSON.stringify(got));
- const dock = [...panel.querySelectorAll(".dock a.app")];
- if (dock.map(a => a.getAttribute("href")).join(" ") !== "/store /people /settings") problems.push("dock " + dock.map(a => a.getAttribute("href")));
- for (const a of grid.concat(dock)) {
- const r = a.getBoundingClientRect(), i = a.querySelector(".icon").getBoundingClientRect();
- if (r.width < 44 || r.height < 44) problems.push(a.textContent.trim() + " is " + r.width + "x" + r.height);
- if (Math.abs(i.width - 64) > 2 || Math.abs(i.height - 64) > 2) problems.push(a.textContent.trim() + "'s icon is " + i.width + "x" + i.height);
+ sameColumns(grid, 64, problems);
+ for (const a of grid) {
+ const r = a.getBoundingClientRect();
if (r.left < p.left || r.right > p.right || r.top < p.top || r.bottom > p.bottom) problems.push(a.textContent.trim() + " is outside the panel");
const img = a.querySelector("img");
if (img && (!img.complete || img.naturalWidth === 0)) problems.push(a.textContent.trim() + "'s icon did not load");
}
for (const a of grid.slice(0, 8)) if (a.target !== "_blank" || a.rel !== "noopener") problems.push(a.textContent.trim() + " target/rel");
- const d = panel.querySelector(".dock"), ds = getComputedStyle(d);
- if (parseFloat(ds.borderTopWidth) !== 1 || ds.borderTopStyle !== "solid") problems.push("no hairline over the dock: " + ds.borderTop);
- if (grid.length && d.getBoundingClientRect().top < grid[grid.length - 1].getBoundingClientRect().bottom) problems.push("the dock is not under the grid");
+ if (grid.slice(-3).map(a => a.getAttribute("href")).join(" ") !== "/store /people /settings") problems.push("Base's own pages are not last");
if (document.documentElement.scrollWidth > vw) problems.push("page is " + document.documentElement.scrollWidth + " wide");
return problems.join("; ");
})`
-// springboardJS checks Home on a phone: four columns of 60px icons, and a
-// glass dock fixed to the foot of the screen that stays put while the grid
-// scrolls, never covering an app.
+// springboardJS checks Home on a phone: the same glass panel, four columns
+// of alike items with 60px icons, Base's own pages among them; nothing
+// fixed to the screen, so the grid scrolls with Home.
const springboardJS = `((want) => {
- const problems = [], vw = document.documentElement.clientWidth, vh = innerHeight;
+ ` + sameColumnsJS + `
+ const problems = [], vw = document.documentElement.clientWidth;
+ const panel = document.querySelector("nav.apps"), p = panel.getBoundingClientRect();
+ if (getComputedStyle(panel).backdropFilter === "none") problems.push("the panel is not glass");
const grid = [...document.querySelectorAll(".app-grid a.app")];
const got = grid.map(a => a.textContent.trim());
if (JSON.stringify(got) !== JSON.stringify(want)) problems.push("grid " + JSON.stringify(got));
- const tops = grid.map(a => Math.round(a.getBoundingClientRect().top));
- if (new Set(tops.slice(0, 4)).size !== 1 || tops[4] <= tops[0]) problems.push("not four columns: " + tops.join(","));
+ const cols = sameColumns(grid, 60, problems);
+ if (cols.length !== 4) problems.push(cols.length + " columns, want 4");
for (const a of grid) {
- const r = a.getBoundingClientRect(), i = a.querySelector(".icon").getBoundingClientRect();
- if (Math.abs(i.width - 60) > 2 || Math.abs(i.height - 60) > 2) problems.push(a.textContent.trim() + "'s icon is " + i.width + "x" + i.height);
- if (r.width < 44 || r.height < 44) problems.push(a.textContent.trim() + " is " + r.width + "x" + r.height);
- if (r.left < 0 || r.right > vw) problems.push(a.textContent.trim() + " runs off the side");
+ const r = a.getBoundingClientRect();
+ if (r.left < p.left || r.right > p.right) problems.push(a.textContent.trim() + " is outside the panel");
}
- const dock = document.querySelector(".dock"), ds = getComputedStyle(dock);
- if (ds.position !== "fixed" || ds.backdropFilter === "none") problems.push("dock " + ds.position + ", " + ds.backdropFilter);
- const before = dock.getBoundingClientRect();
- if (before.bottom > vh || before.bottom < vh - 40 || before.left < 0 || before.right > vw) problems.push("dock at " + [before.left, before.top, before.right, before.bottom].join(","));
- const links = [...dock.querySelectorAll("a.app")];
- if (links.map(a => a.getAttribute("href")).join(" ") !== "/store /people /settings") problems.push("dock holds " + links.map(a => a.getAttribute("href")));
- for (const a of links) { const r = a.getBoundingClientRect(); if (r.width < 44 || r.height < 44) problems.push(a.textContent.trim() + " is " + r.width + "x" + r.height); }
+ if (document.querySelector(".dock")) problems.push("there is still a dock");
+ const fixed = [...document.querySelectorAll("main *")].filter(e => getComputedStyle(e).position === "fixed" && e.checkVisibility() && !e.closest("dialog"));
+ if (fixed.length) problems.push("fixed: " + fixed.map(e => e.className).join(", "));
window.scrollTo(0, document.documentElement.scrollHeight);
- const after = dock.getBoundingClientRect(), last = grid[grid.length - 1].getBoundingClientRect();
- if (Math.abs(after.top - before.top) > 0.5) problems.push("the dock moved when Home scrolled");
- if (last.bottom > after.top) problems.push("the last app (bottom " + last.bottom + ") is under the dock (top " + after.top + ")");
+ const last = grid[grid.length - 1].getBoundingClientRect();
+ if (last.bottom > innerHeight) problems.push("the last app is off the foot of the screen at " + last.bottom);
window.scrollTo(0, 0);
if (document.documentElement.scrollWidth > vw) problems.push("page is " + document.documentElement.scrollWidth + " wide");
return problems.join("; ");
})`
// On a wide screen Home is the greeting, the steps and one glass panel
-// of every app, with Base's own pages in a dock at its foot. Nothing runs
+// of every app, Base's own pages last among them. Nothing runs
// off the screen at any width, and the keyboard reaches every app in order.
func TestHomeApps(t *testing.T) {
apps := teamApps(t)
@@ -153,7 +161,7 @@ func TestHomeApps(t *testing.T) {
t.Errorf("%s at %dx800: %s", scheme, w, got)
}
if w == 1280 {
- checkContrast(t, rig, "Home, "+scheme, ".lede", ".app-grid .label", ".dock .label", "a.me")
+ checkContrast(t, rig, "Home, "+scheme, ".lede", ".app-grid .label", "a.me")
if got := harness.Evaluate[string](rig, `(() => { const r = document.querySelector("a.me").getBoundingClientRect(), bar = document.querySelector(".topbar").getBoundingClientRect();
return r.width >= 44 && r.height >= 44 && r.top >= bar.top - 0.5 && r.bottom <= bar.bottom + 0.5 ? "" : r.width + "x" + r.height + " at " + r.top + "-" + r.bottom; })()`); got != "" {
t.Errorf("%s: the avatar (Settings) target is %s, want 44px inside the top bar", scheme, got)
@@ -162,7 +170,7 @@ func TestHomeApps(t *testing.T) {
}
}
}
- // The keyboard: the top bar, then every app, then the dock.
+ // The keyboard: the top bar, then every app, Base's own pages last.
drive(t, rig, chromedp.EmulateViewport(1280, 800), chromedp.Navigate(rig.Origin+"/"), chromedp.WaitVisible(chromedp.CSS("nav.apps")))
var seen []string
for range 3 + len(apps) + 2 + 3 {
diff --git a/internal/browsertest/light_test.go b/internal/browsertest/light_test.go
index 4eb837c..6840438 100644
--- a/internal/browsertest/light_test.go
+++ b/internal/browsertest/light_test.go
@@ -267,12 +267,12 @@ func TestLightMode(t *testing.T) {
// Light Home: the greeting, the lede, the steps, the Ask field and the
// rail's labels.
- checkContrast(t, rig, "Home, light", ".hello", ".lede", ".team", ".steps li", "a.ask", ".app-grid .label", ".dock .label")
+ checkContrast(t, rig, "Home, light", ".hello", ".lede", ".team", ".steps li", "a.ask", ".app-grid .label")
lightShot(t, rig, "home-desktop")
for _, tint := range []string{"teal", "violet", "mist", "amber", "rose"} {
iconContrast(t, rig, "Home, light", "nav.apps .tile.t-"+tint+" svg")
}
- for _, sel := range []string{"a.ask", "a.me", ".app-grid a.app", ".dock a.app"} {
+ for _, sel := range []string{"a.ask", "a.me", ".app-grid a.app", `.app-grid a.app[href="/store"]`} {
focusRing(t, rig, "Home, light", sel)
}
@@ -298,7 +298,7 @@ func TestLightMode(t *testing.T) {
// A phone.
drive(t, rig, chromedp.EmulateViewport(390, 844, chromedp.EmulateMobile, chromedp.EmulateScale(3)))
home()
- checkContrast(t, rig, "Home on a phone, light", ".lede", ".app-grid .label", ".dock .label")
+ checkContrast(t, rig, "Home on a phone, light", ".lede", ".app-grid .label")
lightShot(t, rig, "home-phone")
layoutShot(t, rig, "phone-home-light")
noOverflow(t, rig, "Home on a phone, light")
diff --git a/internal/browsertest/mobile_test.go b/internal/browsertest/mobile_test.go
index 60be70e..fb3402e 100644
--- a/internal/browsertest/mobile_test.go
+++ b/internal/browsertest/mobile_test.go
@@ -103,12 +103,12 @@ func TestMobile(t *testing.T) {
}
mobileShot(t, rig, "1-home")
- // Home on a phone is a springboard: four columns of apps and a glass
- // dock of Store, People and Settings fixed to the foot of the screen.
+ // Home on a phone is a springboard: every app, Store, People and
+ // Settings among them, in four columns inside the glass panel.
if got := harness.Evaluate[string](rig, springboardJS+`(`+gridNames(apps)+`)`); got != "" {
t.Errorf("the springboard: %s", got)
}
- checkContrast(t, rig, "Home on a phone, dark", ".lede", ".app-grid .label", ".dock .label")
+ checkContrast(t, rig, "Home on a phone, dark", ".lede", ".app-grid .label")
viewportShot(t, rig, "home-phone")
layoutShot(t, rig, "phone-home-dark")
diff --git a/internal/look/static/app.css b/internal/look/static/app.css
index 19cb9ac..19bac21 100644
--- a/internal/look/static/app.css
+++ b/internal/look/static/app.css
@@ -112,7 +112,6 @@
--theirs-edge: rgba(238,242,248,.16);
--card: rgba(139,92,246,.16);
--card-edge: rgba(139,92,246,.45);
- --halo: rgba(10,12,30,.75);
}
:root[data-theme="light"] {
color-scheme: light; --sky-stop: 55%; --glass-lift: -22px;
@@ -141,7 +140,7 @@
--sheet-1: rgba(255,255,255,.82); --sheet-2: rgba(255,255,255,.72); --sheet-base: rgba(244,245,252,.6);
--scrim: rgba(30,36,64,.18); --mine: rgba(15,168,156,.14); --mine-edge: rgba(15,168,156,.38);
--theirs: rgba(255,255,255,.88); --theirs-edge: rgba(30,36,64,.1); --card: rgba(139,92,246,.1);
- --card-edge: rgba(124,77,232,.35); --halo: rgba(255,255,255,.7);
+ --card-edge: rgba(124,77,232,.35);
}
:root[data-theme="dark"] { color-scheme: dark; }
@supports (color: light-dark(white, black)) {
@@ -220,7 +219,6 @@
--theirs-edge: light-dark(rgba(30,36,64,.1), rgba(238,242,248,.16));
--card: light-dark(rgba(139,92,246,.1), rgba(139,92,246,.16));
--card-edge: light-dark(rgba(124,77,232,.35), rgba(139,92,246,.45));
- --halo: light-dark(rgba(255,255,255,.7), rgba(10,12,30,.75));
}
/* The few values that are not colours follow the device too. */
@media (prefers-color-scheme: light) {
@@ -316,12 +314,13 @@ button.alt[aria-busy="true"] { cursor: progress; }
.steps .done { color: var(--haze); }
/* Home's apps: one glass panel under the greeting and steps, every app
- in a grid that wraps (the Oficina apps first, then the installed Store
- apps), and Base's own pages in a dock at its foot, past a hairline. On a
- phone the same markup is a springboard (see the phone rules). */
+ in one grid of alike items that wraps (the Oficina apps, the installed
+ Store apps, then Base's own Store, People and Settings). On a phone the
+ same panel holds four columns (see the phone rules). */
.apps { width: 100%; max-width: 960px; margin-top: 28px; padding: 20px 20px 14px; border-radius: 22px; }
-.app-grid, .dock { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px 8px; justify-items: center; }
-.dock { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule-strong); }
+.app-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px 8px; justify-items: center; }
+/* Each cell fills its column, so every app is the same width whatever its label. */
+.app-grid > li { width: 100%; min-width: 0; display: flex; justify-content: center; }
.app { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 96px; padding: 6px 4px 4px; border-radius: 16px;
font-size: 13px; font-weight: 500; text-align: center; transition: background .2s; }
a.app:hover { background: var(--hover); }
@@ -486,7 +485,7 @@ main { min-height: 100dvh; }
the top, the conversation scrolling between, and room for the notch and
the home indicator. */
@media (max-width: 600px) {
- .home { padding: 12px 12px calc(132px + env(safe-area-inset-bottom)); }
+ .home { padding: 12px 12px calc(20px + env(safe-area-inset-bottom)); }
.topbar { gap: 10px; padding: 6px 6px 6px 12px; }
.team { display: none; }
.ask { min-width: 0; min-height: 44px; max-width: none; padding: 0 14px; }
@@ -494,27 +493,18 @@ main { min-height: 100dvh; }
.ask-icon { display: grid; }
.ask, a.ask { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me, .topbar a.me { flex: none; width: 44px; height: 44px; margin: 0; padding: 0; font-size: 14px; }
- /* A springboard: a compact greeting, four columns of apps on the
- atmosphere, and a glass dock fixed to the foot of the screen. */
+ /* A springboard: a compact greeting, then four columns of apps in the
+ glass panel, at iOS-like spacing. It scrolls with Home. */
.hello { margin-top: 26px; font-size: 30px; }
.lede { margin: 8px 0 14px; font-size: 15px; }
.steps { gap: 6px; }
.steps li { padding: 6px 10px; font-size: 13px; gap: 8px; }
- .apps { margin-top: 26px; padding: 0; max-width: none; border: 0; border-radius: 0; background: none; box-shadow: none;
- backdrop-filter: none; -webkit-backdrop-filter: none; }
- .app-grid { grid-template-columns: repeat(4, 1fr); gap: 18px 0; }
+ .apps { margin-top: 22px; padding: 16px 6px 12px; max-width: none; border-radius: 26px; }
+ .app-grid { grid-template-columns: repeat(4, 1fr); gap: 16px 0; }
.app { width: 100%; max-width: 86px; padding: 4px 2px 2px; gap: 6px; font-size: 12px; }
.app .icon { width: 60px; height: 60px; }
.app .tile { border-radius: 15px; }
.app .tile svg { width: 26px; height: 26px; }
- /* Labels on the atmosphere, as on a springboard, keep a soft halo so they
- read over any colour of fog. */
- .app-grid .label { text-shadow: 0 0 3px var(--halo), 0 1px 6px var(--halo); }
- .dock { position: fixed; z-index: 2; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
- margin: 0; padding: 10px 8px 8px; border-radius: 30px; grid-template-columns: repeat(3, 1fr);
- background: linear-gradient(var(--glass-1), var(--glass-2)), var(--glass-base); border: 1px solid var(--glass-edge);
- backdrop-filter: blur(22px) saturate(130%); -webkit-backdrop-filter: blur(22px) saturate(130%);
- box-shadow: inset 0 1px 0 var(--glass-shine), 0 18px 40px var(--glass-lift) var(--glass-shadow); }
/* Opening the chat, Home steps back behind the sheet. */
main.home { transform-origin: 50% 30%; transition: transform .4s cubic-bezier(.2,.8,.2,1), filter .4s; }
body:has(dialog.ask-panel[open]) main.home { transform: scale(.94); filter: blur(3px) brightness(.8); }
diff --git a/internal/web/home.go b/internal/web/home.go
index 9f79f3e..d2fffee 100644
--- a/internal/web/home.go
+++ b/internal/web/home.go
@@ -33,8 +33,9 @@ type homePage struct {
Initials string
Lede string
Steps []step
- // Apps is the grid: the team's Oficina apps (BASE_OFICINA_APPS) in
- // their order, then the installed Store apps. Dock is Base's own pages.
+ // Apps are the team's Oficina apps (BASE_OFICINA_APPS) in their order,
+ // then the installed Store apps; Dock is Base's own pages. Home draws
+ // them all, in that order, in one grid.
Apps, Dock []tile
// Ask is the chat panel, nil with the chat off.
Ask *askView
diff --git a/internal/web/templates/home.html b/internal/web/templates/home.html
index 44b11ac..9ce7f37 100644
--- a/internal/web/templates/home.html
+++ b/internal/web/templates/home.html
@@ -12,14 +12,12 @@
<ul class="steps">
{{range .Steps}}<li class="glass{{if .Done}} done{{end}}"><span class="mark">{{if .Done}}✓{{end}}</span>{{.Label}}</li>
{{end}}</ul>
-{{/* Every app in one glass panel: on a wide screen a wrapping grid with
- Base's own pages in a dock at its foot; on a phone a springboard, the
- dock fixed to the bottom of the screen. */}}<nav class="apps glass" aria-label="Apps">
-{{with .Apps}}<ul class="app-grid">
-{{range .}}{{template "app" .}}
-{{end}}</ul>
-{{end}}<ul class="dock">
-{{range .Dock}}{{template "app" .}}
+{{/* Every app in one glass panel, one grid of alike items: the Oficina
+ apps, the installed apps, then Base's own pages. A wrapping grid on a
+ wide screen, four columns on a phone. */}}<nav class="apps glass" aria-label="Apps">
+<ul class="app-grid">
+{{range .Apps}}{{template "app" .}}
+{{end}}{{range .Dock}}{{template "app" .}}
{{end}}</ul>
</nav>
{{with .Ask}}{{template "ask-panel" .}}
diff --git a/internal/webtest/home_test.go b/internal/webtest/home_test.go
index 92e89ae..80823e8 100644
--- a/internal/webtest/home_test.go
+++ b/internal/webtest/home_test.go
@@ -128,7 +128,7 @@ func TestHomeTileUsesRecordedHost(t *testing.T) {
}
var (
- appsRE = regexp.MustCompile(`(?s)<nav class="apps glass" aria-label="Apps">\s*(?:<ul class="app-grid">(.*?)</ul>\s*)?<ul class="dock">(.*?)</ul>\s*</nav>`)
+ appsRE = regexp.MustCompile(`(?s)<nav class="apps glass" aria-label="Apps">\s*<ul class="app-grid">(.*?)</ul>\s*</nav>`)
itemRE = regexp.MustCompile(`<li><a class="app" href="([^"]*)"( target="_blank" rel="noopener")?><span class="icon[^"]*">(.*?)</span><span class="label">([^<]*)</span></a></li>`)
appIconRE = regexp.MustCompile(`^<img src="(/static/oficina/[a-z]+\.[0-9a-f]+\.svg)" alt="">$`)
oficinaApps = []config.OficinaApp{
@@ -143,28 +143,25 @@ type homeItem struct {
NewTab bool
}
-// homeApps is Home's apps panel: the grid of apps, then the dock of Base's
-// own pages.
-func homeApps(t *testing.T, body string) (grid, dock []homeItem) {
+// homeApps is Home's apps panel: one grid of every app.
+func homeApps(t *testing.T, body string) []homeItem {
t.Helper()
m := appsRE.FindStringSubmatch(body)
if m == nil {
t.Fatalf("no apps panel:\n%s", body)
}
- items := func(html string) []homeItem {
- var out []homeItem
- for _, i := range itemRE.FindAllStringSubmatch(html, -1) {
- out = append(out, homeItem{Href: i[1], NewTab: i[2] != "", Icon: i[3], Name: i[4]})
- }
- return out
+ var out []homeItem
+ for _, i := range itemRE.FindAllStringSubmatch(m[1], -1) {
+ out = append(out, homeItem{Href: i[1], NewTab: i[2] != "", Icon: i[3], Name: i[4]})
}
- return items(m[1]), items(m[2])
+ return out
}
-// Home's apps panel holds every app in one grid: the team's Oficina apps in
-// the setting's order (each opening in a new tab, with Estilo's icon served
-// from Base), then the installed Store apps (by app id, as the Store keeps them). Under it, the dock: Store,
-// People and Settings. The same markup is the phone's springboard.
+// Home's apps panel holds every app in one grid, all alike: the team's
+// Oficina apps in the setting's order (each opening in a new tab, with
+// Estilo's icon served from Base), then the installed Store apps (by app
+// id, as the Store keeps them), then Base's own Store, People and
+// Settings. There is no dock. The same markup serves a phone.
func TestHomeAppsPanel(t *testing.T) {
a := newAppConfigured(t, func(*sql.DB, config.Config) web.Installer { return noInstaller{} }, time.UTC,
func(c *config.Config) { c.OficinaApps = oficinaApps })
@@ -172,12 +169,12 @@ func TestHomeAppsPanel(t *testing.T) {
a.setInstall("welcome", "installed", "")
a.setInstall("scratchpad", "installed", "")
body := a.get("/").Body
- grid, dock := homeApps(t, body)
+ grid := homeApps(t, body)
var names []string
for _, i := range grid {
names = append(names, i.Name)
}
- if want := "Fichas Calendar Equipo Scratchpad Welcome"; strings.Join(names, " ") != want {
+ if want := "Fichas Calendar Equipo Scratchpad Welcome Store People Settings"; strings.Join(names, " ") != want {
t.Fatalf("grid %v, want %s", names, want)
}
for i, want := range oficinaApps {
@@ -194,16 +191,17 @@ func TestHomeAppsPanel(t *testing.T) {
t.Errorf("%s: %d %q", icon[1], r.Code, r.Header.Get("Content-Type"))
}
}
- for _, g := range grid[len(oficinaApps):] {
+ for _, g := range grid[len(oficinaApps):5] {
if g.NewTab || !strings.HasPrefix(g.Href, "https://acme-") || !strings.HasPrefix(g.Icon, "<svg") {
t.Errorf("installed app %s: href %q, new tab %v, icon %.20q", g.Name, g.Href, g.NewTab, g.Icon)
}
}
- if len(dock) != 3 || dock[0].Href != "/store" || dock[1].Href != "/people" || dock[2].Href != "/settings" ||
- dock[0].Name != "Store" || dock[1].Name != "People" || dock[2].Name != "Settings" {
- t.Errorf("dock %+v", dock)
+ for i, href := range []string{"/store", "/people", "/settings"} {
+ if g := grid[5+i]; g.Href != href || g.NewTab || !strings.HasPrefix(g.Icon, "<svg") {
+ t.Errorf("Base's own %s: %+v", href, g)
+ }
}
- for _, gone := range []string{`class="rail`, `rail-more`, `action="/rail"`, "Keep expanded", "Collapse", `class="oficina"`} {
+ for _, gone := range []string{`class="dock"`, `class="rail`, `rail-more`, `action="/rail"`, "Keep expanded", "Collapse", `class="oficina"`} {
if strings.Contains(body, gone) {
t.Errorf("Home still has %s", gone)
}
@@ -213,13 +211,12 @@ func TestHomeAppsPanel(t *testing.T) {
}
}
-// With no Oficina apps and nothing installed, the panel is just the dock.
+// With no Oficina apps and nothing installed, the grid is Base's own pages.
func TestHomeAppsPanelEmpty(t *testing.T) {
a := newApp(t)
a.signedInOwner()
- grid, dock := homeApps(t, a.get("/").Body)
- if len(grid) != 0 || len(dock) != 3 {
- t.Fatalf("grid %v, dock %v", grid, dock)
+ if grid := homeApps(t, a.get("/").Body); len(grid) != 3 || grid[0].Href != "/store" {
+ t.Fatalf("grid %v", grid)
}
}