max / makenotwork
- Co-Authored-By
- Claude Opus 5 (1M context) <noreply@anthropic.com>
- Claude-Session
- https://claude.ai/code/session_01MptwXZ8k65v19rFmdGAyki
1 file changed,
+20 insertions,
-24 deletions
| @@ -29,7 +29,7 @@ | |||
| 29 | 29 | //! here, because the push instructions are not theirs to act on. | |
| 30 | 30 | ||
| 31 | 31 | use makeover_layout as layout; | |
| 32 | - | use quasi_router::screen::{Cell, Cells, Column, Tag}; | |
| 32 | + | use quasi_router::screen::{Cell, Cells, Column, Table, Tag}; | |
| 33 | 33 | use quasi_router::{ | |
| 34 | 34 | Action, Document, Node, RegionKind, Request, Response, RouteError, Screen as Described, Slot, | |
| 35 | 35 | }; | |
| @@ -178,29 +178,25 @@ | |||
| 178 | 178 | columns.push(Column::new("Visibility").width(layout::Width::Content)); | |
| 179 | 179 | } | |
| 180 | 180 | ||
| 181 | - | Node::Table { | |
| 182 | - | columns, | |
| 183 | - | rows: loaded | |
| 184 | - | .repos | |
| 185 | - | .iter() | |
| 186 | - | .map(|repo| { | |
| 187 | - | let mut cells = vec![ | |
| 188 | - | Cell::new(repo.name.clone()), | |
| 189 | - | Cell::new(repo.description.clone()), | |
| 190 | - | ]; | |
| 191 | - | if loaded.is_owner { | |
| 192 | - | cells.push(match repo.visibility.as_deref() { | |
| 193 | - | Some(visibility) => Cell::new(String::new()).token(Tag::badge(visibility)), | |
| 194 | - | None => Cell::new(String::new()), | |
| 195 | - | }); | |
| 196 | - | } | |
| 197 | - | Cells::new(cells).activate( | |
| 198 | - | Action::get(format!("/git/{}/{}", loaded.owner, repo.name)).navigating(), | |
| 199 | - | ) | |
| 200 | - | }) | |
| 201 | - | .collect(), | |
| 202 | - | more: None, | |
| 203 | - | } | |
| 181 | + | // The visibility cell names its column rather than counting to it, so the | |
| 182 | + | // conditional above is the only place ownership is decided. Built by | |
| 183 | + | // position, this row and that column list were two conditionals that had to | |
| 184 | + | // agree, and nothing checked that they did. | |
| 185 | + | Table::new(columns) | |
| 186 | + | .rows(loaded.repos.iter().map(|repo| { | |
| 187 | + | let visibility = repo | |
| 188 | + | .visibility | |
| 189 | + | .as_deref() | |
| 190 | + | .map(|visibility| Cell::new(String::new()).token(Tag::badge(visibility))); | |
| 191 | + | let mut row = Cells::default() | |
| 192 | + | .at("Repository", Cell::new(repo.name.clone())) | |
| 193 | + | .at("Description", Cell::new(repo.description.clone())); | |
| 194 | + | if let Some(cell) = visibility { | |
| 195 | + | row = row.at("Visibility", cell); | |
| 196 | + | } | |
| 197 | + | row.activate(Action::get(format!("/git/{}/{}", loaded.owner, repo.name)).navigating()) | |
| 198 | + | })) | |
| 199 | + | .into() | |
| 204 | 200 | } | |
| 205 | 201 | ||
| 206 | 202 | /// The document this screen is drawn in. |