Skip to content

Commit f17d6d9

Browse files
author
i2cjak
authored
Merge pull request #513 from BackplaneWorks/backplane/sidebar-projects-whole
The sidebar never pages its projects or live threads
2 parents d99ec3f + 6632535 commit f17d6d9

4 files changed

Lines changed: 28 additions & 13 deletions

File tree

‎scripts/sidebar-draft-inputs.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
"src/core/usage_graph.bend": "c4a30aff87e9a9ff0d9bea0ef11d0ab0655f816c4aeb904f667031a63b7745e5",
139139
"src/core/usage_page.bend": "05f675351e885ee368dd9db73b9e3739d04c9225a1f1c0d8ced43b53d98615f7",
140140
"src/core/utf8.bend": "0202c5087fd255df10413080cda57f2a4a00aa9b90b5b425a00a729f9563627b",
141-
"src/core/view-page.bend": "d513098bef4d09553578002a29b6058e51d9249b009096b175f6c4ff67ea4d78",
141+
"src/core/view-page.bend": "443174e2117ff541add79d873a7eaad90225eb0557247188e273e0dd00a2be73",
142142
"src/core/voice.bend": "d1efb9a32ce7cda16b1db170f1b9fa5059777fc97f3a4f8d080d1e37072e0213",
143143
"src/core/vt.bend": "931708652e96ec2db30f3a5a69dc4c90a98e15fc6e5fbbd8e441475626198581",
144144
"src/core/wake.bend": "074b0501f0db23a207e835beea1de5a5c11dc770287beef06c4d20be0da93a67",
@@ -165,7 +165,7 @@
165165
"src/web/space.bend": "b86a265e41a900498bc33c37c0404c4d6678554efe3d9054f329beb2cf35ee63",
166166
"src/web/usage-graph.bend": "fa06f7d2bf855a396a5f7a7b4725dfaa990145fbbcefe7ad21ae8f9a698a2679",
167167
"src/web/usage-page.bend": "706e3f17a4a3e5f159656d47aeb76a940d4825421f5c33228f9aef692ec926e3",
168-
"src/web/view.bend": "8e9746f74a63de7f6bff43112fdae498e12a3d94b97986e5251ae051c2bd4b94"
168+
"src/web/view.bend": "c33782fe857d1d5bae1481c92986faae919f5ced881b05b9433b10cbe7d1ac55"
169169
},
170170
"review": {
171171
"source": "5f19ea0b9dbcff736e51ced0cb79e19bfef5bba6",
@@ -358,5 +358,5 @@
358358
"integrationReview": "Preserved main tool-drawer, todo and workspace changes. Liveness reads canonical settings only; settings remain in full sidebar inputs. No scratch/draft filtering, image key or authority changes. Full sidebar-output freshness passes after integration."
359359
}
360360
},
361-
"reviewNote": "Tool-call drawers on top of the to-do move: fold.bend (runs shut by default, live label, RHead live flag), msgs.bend (fold.running), view.bend (drawer head, run marks on timeline rows) and screen.bend (fold row live, run marks) touch only thread timeline entries; the sidebar draft is unaffected (sidebar_draft_image_test 24 ok)"
361+
"reviewNote": "Tool-call drawers on top of the to-do move: fold.bend (runs shut by default, live label, RHead live flag), msgs.bend (fold.running), view.bend (drawer head, run marks on timeline rows) and screen.bend (fold row live, run marks) touch only thread timeline entries; the sidebar draft is unaffected (sidebar_draft_image_test 24 ok) Then: sidebar lists never page projects or live threads (view-page.bend Page.whole, view.bend live/active kinds); pager presence only, no draft reader or sidebar-image key changes."
362362
}

‎src/core/view-page.bend‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,14 @@ def Page.limit(+kind: String, +budget: String) -> Nat:
4747
+small = M.Switch.num(String.take(budget, 2n), 0n)
4848
Bool.pick(Nat, Bool.and(Nat.is_gt(small, 0n), Nat.is_lt(small, normal)), small, normal)
4949

50+
# The sidebar's projects and live threads are never windowed: a byte budget
51+
# that shrank once must not hide a running project or thread. Only shelves
52+
# (settled, archived, snoozed) and panels page.
53+
def Page.whole(+kind: String) -> Bool:
54+
Bool.or(String.eq(kind, "projects"), String.eq(kind, "live"))
55+
5056
def Page.of(+st: M.State, +kind: String, +ids: List<&2, String>, +selected: String) -> Page:
51-
Page.on(String.eq(M.Setting.get(st, "local.view.lazy", ""), "1"), ids, kind,
57+
Page.on(Bool.and(String.eq(M.Setting.get(st, "local.view.lazy", ""), "1"), Bool.not(Page.whole(kind))), ids, kind,
5258
M.Setting.get(st, "local.view.pages", "{}"), Page.limit(kind, M.Setting.get(st, "local.view.budget", "")), selected)
5359

5460
def Page.info.value(pair: Map<&2, String> & String) -> String:
@@ -62,6 +68,10 @@ def Page.info(+info: Map<&2, String>, +kind: String, +ids: List<&2, String>, +se
6268
Page.on(String.eq(Page.info.get(info, "local.view.lazy"), "1"), ids, kind,
6369
Page.info.get(info, "local.view.pages"), Page.limit(kind, Page.info.get(info, "local.view.budget")), selected)
6470

71+
def Page.scope_of(+p: Page) -> String:
72+
match p:
73+
case Page{scope, _, _, _, _}: scope
74+
6575
def Page.ids(+p: Page) -> List<&2, String>:
6676
match p:
6777
case Page{_, _, _, _, ids}: ids

‎src/web/view.bend‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def View.tree.rows.raw(+lc: I.Loc, rs: List<&2, ST.TRow>, +ix: U.SIx, +st: M.Sta
285285
View.tree.create(Bool.and(expanded, U.ThreadTree.can_create(st, id)), id, indent), View.tree.rows.raw(lc, rest, ix, st, sel, now, movable, live)])
286286

287287
def View.tree.rows(+lc: I.Loc, +rs: List<&2, ST.TRow>, +ix: U.SIx, +st: M.State, +sel: String, +now: Nat, +movable: Bool, +live: Bool) -> List<&2, D.Node>:
288-
+p = VP.Page.of(st, "threads", ST.Tree.row_ids(rs), sel)
288+
+p = VP.Page.of(st, Bool.pick(String, live, "live", "threads"), ST.Tree.row_ids(rs), sel)
289289
List.append(&2, D.Node, View.tree.rows.raw(lc, LW.Lists.tree(rs, VP.Page.ids(p)), ix, st, sel, now, movable, live), LW.Lists.pager(p))
290290

291291
def View.rows_in(+lc: I.Loc, ts: List<&2, M.Thread>, +ix: U.SIx, +st: M.State, +sel: String, +now: Nat, +movable: Bool, +snoozed: Bool) -> List<&2, D.Node>:
@@ -462,29 +462,29 @@ def View.atree.rows.raw(rs: List<&2, ST.TRow>, +lc: I.Loc, anchors: List<&2, U.A
462462
View.atree.row(VP.Page.has(ids, M.Thread.id(t)), lc, t, depth, expanded, children, at, ix, st, sel,
463463
View.atree.rows.raw(rest, lc, View.atree.next(step), at, ix, st, sel, ids))
464464

465-
def View.atree.rows(+rs: List<&2, ST.TRow>, +lc: I.Loc, anchors: List<&2, U.ARow>, anchor: U.ARow, +ix: U.SIx, +st: M.State, +sel: String) -> List<&2, D.Node>:
466-
+p = VP.Page.of(st, "active", ST.Tree.row_ids(rs), sel)
465+
def View.atree.rows(+rs: List<&2, ST.TRow>, +lc: I.Loc, anchors: List<&2, U.ARow>, anchor: U.ARow, +ix: U.SIx, +st: M.State, +sel: String, +kind: String) -> List<&2, D.Node>:
466+
+p = VP.Page.of(st, kind, ST.Tree.row_ids(rs), sel)
467467
List.append(&2, D.Node, View.atree.rows.raw(rs, lc, anchors, anchor, ix, st, sel, VP.Page.ids(p)), LW.Lists.pager(p))
468468

469-
def View.arows(+lc: I.Loc, rs: List<&2, U.ARow>, +ix: U.SIx, +st: M.State, +sel: String, +q: String) -> List<&2, D.Node>:
469+
def View.arows(+lc: I.Loc, rs: List<&2, U.ARow>, +ix: U.SIx, +st: M.State, +sel: String, +q: String, +kind: String) -> List<&2, D.Node>:
470470
match rs:
471471
case Nil{}: Nil{}
472472
case +r <> +rest:
473-
View.atree.rows(ST.Tree.rows_search(st, U.Active.root_threads(r <> rest), sel, q), lc, r <> rest, r, ix, st, sel)
473+
View.atree.rows(ST.Tree.rows_search(st, U.Active.root_threads(r <> rest), sel, q), lc, r <> rest, r, ix, st, sel, kind)
474474

475475
def View.afaded.open(+lc: I.Loc, on: Bool, rs: List<&2, U.ARow>, +ix: U.SIx, +st: M.State, +sel: String, +q: String) -> List<&2, D.Node>:
476476
match on:
477477
case True{}:
478-
View.arows(lc, rs, ix, st, sel, q)
478+
View.arows(lc, rs, ix, st, sel, q, "active")
479479
case False{}:
480-
View.arows(lc, U.Active.sel(rs, sel), ix, st, sel, q)
480+
View.arows(lc, U.Active.sel(rs, sel), ix, st, sel, q, "active")
481481

482482
# the settled rows folded under one "Settled N" row, shown while it is
483483
# open or a search is on (core's Active.open)
484484
def View.afaded.k(+lc: I.Loc, searching: Bool, +open: Bool, +n: Nat, +rs: List<&2, U.ARow>, +ix: U.SIx, +st: M.State, +sel: String) -> List<&2, D.Node>:
485485
match searching:
486486
case True{}:
487-
View.arows(lc, rs, ix, st, sel, "search")
487+
View.arows(lc, rs, ix, st, sel, "search", "active")
488488
case False{}:
489489
WI.WIcon.button(Bool.pick(String, open, "shelf older open", "shelf older"), "side-settled", "", MSG.T.sidebar.settled.note(lc),
490490
Bool.pick(String, open, "chevron-down", "chevron-right"), 14, Bool.pick(String, open, MSG.T.sidebar.settled.count(lc, Nat.show(n)), U.Shelf.words(lc, MSG.T.sidebar.settled.count(lc, Nat.show(n)), List.length(&2, U.ARow, U.Active.sel(rs, sel)))))
@@ -500,7 +500,7 @@ def View.afaded(+lc: I.Loc, rs: List<&2, U.ARow>, +q: String, +open: Map<&2, Boo
500500
def View.active.k(+lc: I.Loc, p: U.AParts, +q: String, +open: Map<&2, Bool>, +ix: U.SIx, +st: M.State, +sel: String) -> List<&2, D.Node>:
501501
match p:
502502
case U.AParts{l, f}:
503-
[D.El{"section", "", [D.At{"class", "project active"}], List.append(&2, D.Node, View.arows(lc, l, ix, st, sel, q), View.afaded(lc, f, q, open, ix, st, sel))}]
503+
[D.El{"section", "", [D.At{"class", "project active"}], List.append(&2, D.Node, View.arows(lc, l, ix, st, sel, q, "live"), View.afaded(lc, f, q, open, ix, st, sel))}]
504504

505505
def View.active(+lc: I.Loc, rs: List<&2, U.ARow>, +q: String, +open: Map<&2, Bool>, +ix: U.SIx, +st: M.State, +sel: String) -> List<&2, D.Node>:
506506
match rs:

‎test/view_page_test.bend‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ def main() -> IO(Unit):
3535
C.Check.str("next page never silently carries old ordinary rows", Bool.show(P.Page.has(P.Page.ids(next), "600")), "False")
3636
+changed : P.Page = P.Page.of(M.State.setting(lazy(), "local.view.pages", positions), "threads", "new" <> all, "")
3737
C.Check.str("source membership change resets list position", Bool.show(P.Page.has(P.Page.ids(changed), "new")), "True")
38+
+squeezed : M.State = M.State.setting(lazy(), "local.view.budget", "2")
39+
C.Check.str("a squeezed budget never hides a project", Nat.show(count(P.Page.of(squeezed, "projects", ids(60n), ""))), "60")
40+
C.Check.str("a squeezed budget never hides a live thread", Nat.show(count(P.Page.of(squeezed, "live", ids(60n), ""))), "60")
41+
C.Check.str("the project list has no pager", Bool.show(String.is_empty(P.Page.scope_of(P.Page.of(squeezed, "projects", ids(60n), "")))), "True")
42+
C.Check.str("a settled shelf still pages", Nat.show(count(P.Page.of(squeezed, "threads", ids(60n), ""))), "2")
3843
C.Check.str("legacy caller preserves complete source", Nat.show(count(P.Page.of(M.State.empty(), "threads", all, ""))), "600")
3944
+u : U.Ui = U.Ui.info_set(U.Ui.info_set(U.Ui.scratch_set(U.Ui.select.k(U.Ui.init(1n), "a"), "a", "IME 日本語 draft"), "local.view.lazy", "1"), "local.view.pages", "{}")
4045
+a : U.Act = U.Ui.act(u, "list-page", command(first))

0 commit comments

Comments
 (0)