| 59 |
59 |
|
//! would be permanent machinery in service of a frontend being removed. Add a
|
| 60 |
60 |
|
//! column in both by hand in the meantime.
|
| 61 |
61 |
|
//!
|
| 62 |
|
- |
//! **2. A table cannot say there is more.** [`Node::List`] carries a
|
| 63 |
|
- |
//! [`Rest`](quasi_router::screen::Rest) and `Node::Table` carries nothing of the
|
| 64 |
|
- |
//! kind, so paging is a [`Node::Act`] sitting under the table rather than a
|
| 65 |
|
- |
//! property of it. The shipped screen streams pages into a virtual scroller as
|
| 66 |
|
- |
//! you scroll; a description has no word for that either, and the address-shaped
|
| 67 |
|
- |
//! answer the mail list already settled on — the view says how many rows it
|
| 68 |
|
- |
//! shows, and asking for more is an address — is what this uses. What is lost is
|
| 69 |
|
- |
//! the renderer knowing the act belongs to the table above it.
|
|
62 |
+ |
//! **2. A table could not say there is more. Closed in quasi 0.15.0.**
|
|
63 |
+ |
//! [`Node::List`] carried a [`Rest`](quasi_router::screen::Rest) and
|
|
64 |
+ |
//! `Node::Table` carried nothing of the kind, so paging was a [`Node::Act`]
|
|
65 |
+ |
//! sitting under the table rather than a property of it, and what that lost was
|
|
66 |
+ |
//! the renderer knowing the act belonged to the table above it. This screen was
|
|
67 |
+ |
//! the finding's only consumer and is what closed it: `Node::Table` takes a
|
|
68 |
+ |
//! `Rest` now and the act is gone.
|
|
69 |
+ |
//!
|
|
70 |
+ |
//! The reshape that made it possible is worth knowing about, because it changed
|
|
71 |
+ |
//! what a description can say rather than only where it says it. `Rest` used to
|
|
72 |
+ |
//! be a count and one address; it is a `layout::Paging` and up to two now, so
|
|
73 |
+ |
//! the description carries *where the reader is* and not merely that there is
|
|
74 |
+ |
//! more. That is the same `layout::Window` a carousel instantiates — a frame is
|
|
75 |
+ |
//! a window of one over children that are present, a page is a window over rows
|
|
76 |
+ |
//! that were never fetched — and presence shows up as whether there are
|
|
77 |
+ |
//! addresses rather than as a second copy of the arithmetic.
|
|
78 |
+ |
//!
|
|
79 |
+ |
//! The ceiling case is still a sentence rather than a control: at `PAGE * PAGES`
|
|
80 |
+ |
//! there is no address that would show anything new, and narrowing is the way
|
|
81 |
+ |
//! through a list that long.
|
|
82 |
+ |
//!
|
|
83 |
+ |
//! The shipped screen streams pages into a virtual scroller as you scroll, and a
|
|
84 |
+ |
//! description still has no word for that. It is deliberately not one: virtual
|
|
85 |
+ |
//! scrolling windows rows the app already holds, which is a renderer performance
|
|
86 |
+ |
//! technique, where a `Rest` is a fact about rows that were never fetched.
|
| 70 |
87 |
|
//!
|
| 71 |
88 |
|
//! **3. A table row could not join a selection. Closed in quasi 0.13.0.**
|
| 72 |
89 |
|
//! `Screen::selecting`, [`Row::ticking`](quasi_router::screen::Row::ticking) and
|
| 135 |
152 |
|
TaskStatus,
|
| 136 |
153 |
|
};
|
| 137 |
154 |
|
use makeover_layout::{Sort, Tone, Width};
|
| 138 |
|
- |
use quasi_router::screen::{Act, Cell, Cells, Choice, Column, Field, Figure, Meter, Tag};
|
|
155 |
+ |
use quasi_router::screen::{Act, Cell, Cells, Choice, Column, Field, Figure, Meter, Rest, Tag};
|
| 139 |
156 |
|
use quasi_router::{Action, Node, RegionKind, Response, RouteError, Router, Screen, Slot};
|
| 140 |
157 |
|
|
| 141 |
158 |
|
use crate::state::{AppState, DESKTOP_USER_ID};
|
| 871 |
888 |
|
return Ok(vec![nothing(state, view)?]);
|
| 872 |
889 |
|
}
|
| 873 |
890 |
|
|
|
891 |
+ |
let shown = i64::try_from(tasks.len()).unwrap_or(i64::MAX);
|
|
892 |
+ |
let next = (view.shown + PAGE).min(PAGE * PAGES);
|
|
893 |
+ |
|
|
894 |
+ |
// The table's own, since quasi 0.15.0. This was a `Node::Act` pushed after
|
|
895 |
+ |
// the table until then, because `Node::Table` carried no `Rest` and there
|
|
896 |
+ |
// was nowhere else to put it; what that cost was the renderer knowing the
|
|
897 |
+ |
// control belonged to the table above it.
|
|
898 |
+ |
let more = (shown < total && next > view.shown).then(|| {
|
|
899 |
+ |
Rest::more(
|
|
900 |
+ |
usize::try_from(shown).unwrap_or(usize::MAX),
|
|
901 |
+ |
View {
|
|
902 |
+ |
shown: next,
|
|
903 |
+ |
..view.clone()
|
|
904 |
+ |
}
|
|
905 |
+ |
.list(),
|
|
906 |
+ |
)
|
|
907 |
+ |
.of(usize::try_from(total).unwrap_or(usize::MAX))
|
|
908 |
+ |
});
|
|
909 |
+ |
|
| 874 |
910 |
|
let mut out = vec![Node::Table {
|
| 875 |
911 |
|
columns: columns(view),
|
| 876 |
912 |
|
rows: tasks.iter().map(|task| row_for(task, view)).collect(),
|
|
913 |
+ |
more,
|
| 877 |
914 |
|
}];
|
| 878 |
915 |
|
|
| 879 |
|
- |
let shown = i64::try_from(tasks.len()).unwrap_or(i64::MAX);
|
| 880 |
|
- |
if shown < total {
|
| 881 |
|
- |
let next = (view.shown + PAGE).min(PAGE * PAGES);
|
| 882 |
|
- |
// At the ceiling the act would ask for the rows already on screen, so
|
| 883 |
|
- |
// what is offered instead is the honest sentence. Narrowing is the way
|
| 884 |
|
- |
// through a list this long, and the filters are on the same screen.
|
| 885 |
|
- |
if next > view.shown {
|
| 886 |
|
- |
out.push(Node::act(
|
| 887 |
|
- |
format!("Show more ({shown} of {total})"),
|
| 888 |
|
- |
View {
|
| 889 |
|
- |
shown: next,
|
| 890 |
|
- |
..view.clone()
|
| 891 |
|
- |
}
|
| 892 |
|
- |
.list(),
|
| 893 |
|
- |
));
|
| 894 |
|
- |
} else {
|
| 895 |
|
- |
out.push(Node::text(format!(
|
| 896 |
|
- |
"Showing {shown} of {total}. Narrow the list to see the rest."
|
| 897 |
|
- |
)));
|
| 898 |
|
- |
}
|
|
916 |
+ |
// At the ceiling there is no address that would show anything new, so the
|
|
917 |
+ |
// honest sentence is offered instead of a control that asks for the rows
|
|
918 |
+ |
// already on screen. Narrowing is the way through a list this long, and the
|
|
919 |
+ |
// filters are on the same screen.
|
|
920 |
+ |
if shown < total && next <= view.shown {
|
|
921 |
+ |
out.push(Node::text(format!(
|
|
922 |
+ |
"Showing {shown} of {total}. Narrow the list to see the rest."
|
|
923 |
+ |
)));
|
| 899 |
924 |
|
}
|
| 900 |
925 |
|
|
| 901 |
926 |
|
Ok(out)
|