Fit more on the home screen: five columns, shorter rows, smaller icons
The home grid gets one more column than the drawer (5 on a phone, 6 on wider screens), 76px rows with 16px gaps and 44px icons. Widgets still snap to whole rows; widget_rows and the resize test follow the new row size. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NYASJ6JNxhYwNNJK7ypK2V
This commit is contained in:
4 files changed
+20
-14
No files matched your search
+3
-3
@@ -111,11 +111,11 @@ const BASE = process.env.BASE || "http://localhost:8000";
|
||||
await p.mouse.move(hd.x + hd.width / 2, hd.y + hd.height / 2);
|
||||
await p.mouse.down();
|
||||
const ws = await p.locator(".widget-slot").boundingBox();
|
||||
await p.mouse.move(ws.x + tile.width * 2.1, ws.y + 230, { steps: 8 }); await settle();
|
||||
await p.mouse.move(ws.x + tile.width * 2.1, ws.y + 175, { steps: 8 }); await settle();
|
||||
await p.mouse.up(); await settle();
|
||||
const [w1, h1] = await size();
|
||||
assert.ok(w1 < w0 && Math.abs(w1 - (2 * tile.width + 8)) < 3, `two columns wide: ${w1} (tile ${tile.width})`);
|
||||
assert.equal(h1, Math.round(2 * tile.height + 20), "snapped to two whole rows of tiles");
|
||||
assert.equal(h1, 2 * 76 + 16, "snapped to two whole rows of tiles");
|
||||
assert.ok(await p.$(".widget-slot.resizing"), "letting go of a handle keeps the handles");
|
||||
await p.click(".resize-bar >> text=Done"); await settle();
|
||||
assert.ok(!(await p.$(".resize-handle")));
|
||||
@@ -132,7 +132,7 @@ const BASE = process.env.BASE || "http://localhost:8000";
|
||||
await p.mouse.move(first.x + first.width / 2, first.y + first.height / 2, { steps: 8 }); await settle();
|
||||
await p.mouse.up(); await settle();
|
||||
assert.equal((await order())[0], "W", "dragged to the front");
|
||||
// the apps flow into the cells beside it: a 2x2 widget leaves room for all four
|
||||
// the apps flow into the cells beside it: a 2x2 widget in 5 columns leaves room for all four
|
||||
const beside = await p.$eval(".widget-slot", (w) => {
|
||||
const r = w.getBoundingClientRect();
|
||||
return [...document.querySelectorAll(".slots .tile")].filter((t) => {
|
||||
|
||||
+2
-2
@@ -624,7 +624,7 @@ def view_resize_bar() -> None:
|
||||
|
||||
def widget_rows(h: i32) -> i32:
|
||||
"""Rows of app tiles nearest to a widget height in CSS px, at least one."""
|
||||
k: i32 = (h + 20 + 54) // 108
|
||||
k: i32 = (h + 16 + 46) // 92
|
||||
if k < 1:
|
||||
k = 1
|
||||
return k
|
||||
@@ -639,7 +639,7 @@ def view_home_slot(i: i32) -> None:
|
||||
cls_if("lifted", i == lifted)
|
||||
cls_if("resizing", i == resizing)
|
||||
attr_num("data-slot", i)
|
||||
# Its height spans whole rows of app tiles (88px rows, 20px gaps; style.css).
|
||||
# Its height spans whole rows of app tiles (76px rows, 16px gaps; style.css).
|
||||
s_set(scratch, "grid-row:span ")
|
||||
s_add_num(scratch, widget_rows(hh[i]))
|
||||
if hw[i] > 0:
|
||||
|
||||
Binary file not shown.
+15
-9
@@ -36,11 +36,14 @@ body { margin: 0; min-height: 100vh; color: #fff; -webkit-tap-highlight-color: t
|
||||
.windows-glyph::after { inset: .3rem 0 0 .3rem; background: rgb(255 255 255 / .15); }
|
||||
.slots, .apps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem .5rem;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
||||
/* Home rows are all one height, so a widget spans whole rows of app tiles, and apps
|
||||
fill the cells beside a widget rather than leaving holes (dense packing). Keep
|
||||
--cell and the gap in sync with widget_rows in app.py. */
|
||||
.slots { grid-auto-rows: 5.5rem; grid-auto-flow: row dense; }
|
||||
@media (min-width: 480px) { .slots, .apps { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
|
||||
/* The home grid is denser than the drawer: an extra column, smaller tiles. Its rows are
|
||||
all one height, so a widget spans whole rows of app tiles, and apps fill the cells
|
||||
beside a widget rather than leaving holes (dense packing). Keep the row height and
|
||||
row gap in sync with widget_rows in app.py. */
|
||||
.slots { grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: 4.75rem; row-gap: 1rem;
|
||||
grid-auto-flow: row dense; }
|
||||
@media (min-width: 480px) { .apps { grid-template-columns: repeat(5, minmax(0, 1fr)); }
|
||||
.slots { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
|
||||
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: .4rem;
|
||||
padding: .35rem .15rem; border-radius: calc(var(--radius) + 4px); cursor: pointer; }
|
||||
.tile:active { background: rgb(255 255 255 / .12); }
|
||||
@@ -49,6 +52,9 @@ body { margin: 0; min-height: 100vh; color: #fff; -webkit-tap-highlight-color: t
|
||||
.icon.missing { border-radius: 999px; background: rgb(255 255 255 / .18); object-position: -999px 0; }
|
||||
.name { max-width: 100%; font-size: .75rem; line-height: 1.2; text-align: center;
|
||||
text-shadow: var(--shadow-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.slots .tile { gap: .3rem; padding: .25rem .1rem; }
|
||||
.slots .icon { width: 2.75rem; height: 2.75rem; }
|
||||
.slots .name { font-size: .7rem; }
|
||||
|
||||
/* A widget takes whole rows. On a phone the native widget view covers the slot;
|
||||
the label only shows while the slot is not live (or in a desktop browser). */
|
||||
@@ -70,10 +76,10 @@ body { margin: 0; min-height: 100vh; color: #fff; -webkit-tap-highlight-color: t
|
||||
box-shadow: 0 1px 6px rgb(0 0 0 / .45); }
|
||||
.resize-handle[data-edge="r"] { top: 0; bottom: 0; right: -16px; width: 16px; cursor: ew-resize; }
|
||||
.resize-handle[data-edge="r"]::after { top: 50%; left: 6px; width: 6px; height: 2.5rem; transform: translateY(-50%); }
|
||||
.resize-handle[data-edge="b"] { left: 0; right: 0; bottom: -1.25rem; height: 1.25rem; cursor: ns-resize; }
|
||||
.resize-handle[data-edge="b"]::after { left: 50%; top: 7px; width: 2.5rem; height: 6px; transform: translateX(-50%); }
|
||||
.resize-handle[data-edge="rb"] { right: -16px; bottom: -1.25rem; width: 2.75rem; height: 1.25rem; }
|
||||
.resize-handle[data-edge="rb"]::after { right: 4px; top: 3px; width: 14px; height: 14px; border-radius: 4px; }
|
||||
.resize-handle[data-edge="b"] { left: 0; right: 0; bottom: -1rem; height: 1rem; cursor: ns-resize; }
|
||||
.resize-handle[data-edge="b"]::after { left: 50%; top: 5px; width: 2.5rem; height: 6px; transform: translateX(-50%); }
|
||||
.resize-handle[data-edge="rb"] { right: -16px; bottom: -1rem; width: 2.75rem; height: 1rem; }
|
||||
.resize-handle[data-edge="rb"]::after { right: 4px; top: 1px; width: 14px; height: 14px; border-radius: 4px; }
|
||||
.resize-bar { position: fixed; left: 50%; bottom: calc(var(--bottom) + 1rem); z-index: 15; transform: translateX(-50%);
|
||||
display: flex; align-items: center; gap: .5rem; padding: .4rem .4rem .4rem 1rem; border-radius: 999px;
|
||||
background: rgb(0 0 0 / .8); color: #fff; font-size: .875rem; white-space: nowrap;
|
||||
|
||||
Reference in new issue
Block a user