feat(ui): an empty state offers the thing it is describing - #86
Open
youhide wants to merge 1 commit into
Open
Conversation
`UI_SPEC.md` asks empty states to carry the next action rather than only naming an absence. Two of them can, and now do. A clean working directory said "the working directory matches the last commit" and left you to go and find that commit. Its own doc comment claimed it said "what to do next", which it did not. It offers the commit instead — one button, dispatching the selection that was already reachable everywhere else. A file filter matching nothing said so and stopped. It offers to clear itself. Both dispatch messages that already existed, so nothing new is plumbed through the update loop: this is a button where there was a sentence, not a feature. An action is offered only when it exists. An unborn branch has no last commit, so that state keeps the sentence and no button — one that selected a commit which is not there would be worse than none, and a test holds that open. The strings go through the catalogue rather than inline, which is what ADR-0008 asks of new user-facing text, and both locales get them. That needed the catalogue to reach two widgets it did not: `detail::view` and `staging::view` each take it now, threaded from the screen that already had it. Worth flagging rather than hiding: `staging::view` was already eleven arguments behind an `#[allow(clippy::too_many_arguments)]`, and this makes it thirteen. Bundling them into a struct is the right answer and is not this change. The panes that say "Select a file to see its changes" are deliberately left alone. Their next action is clicking a row in the list beside them, and a button repeating that is chrome. Four tests, one per behaviour, and the clean-state pair caught that nothing had ever asserted that screen at all — changing its wording broke no test before these existed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
C3b, the half of C3 that changes behaviour. #85 made there be one place to put an action; this puts one there.
Two states that could carry an action, and now do
A clean working directory said "the working directory matches the last commit" and left you to go find that commit. Its own doc comment claimed it said "what to do next" — it did not. It offers the commit now.
A file filter matching nothing said so and stopped. It offers to clear itself.
Both dispatch messages that already existed, so nothing new is plumbed through the update loop. This is a button where there was a sentence, not a feature.
An action is offered only when it exists
An unborn branch has no last commit, so that state keeps the sentence and no button. One that selected a commit which is not there would be worse than none, and a test holds that open.
What is deliberately left alone
The panes that say "Select a file to see its changes". Their next action is clicking a row in the list beside them, and a button repeating that is chrome, not help.
The strings, and what they cost
They go through the catalogue rather than inline, which is what ADR-0008 asks of new user-facing text, and both locales get them.
That needed the catalogue to reach two widgets it did not:
detail::viewandstaging::vieweach take it now, threaded from the screen that already had it.Worth flagging rather than hiding:
staging::viewwas already eleven arguments behind an#[allow(clippy::too_many_arguments)], and this makes it thirteen. Bundling them into a struct is the right answer and is not this change.Sabotage — four, four distinct failures
a_clean_working_directory_offers_the_commit_it_matchesandoffering_the_last_commit_actually_selects_itoffering_the_last_commit_actually_selects_itan_unborn_branch_has_no_commit_to_offera_filter_that_matches_nothing_offers_to_clear_itselfThe second one matters most: without it, a button that renders but goes nowhere would pass.
A coverage gap these tests closed
Nothing had ever asserted the clean-working-directory screen. Rewriting its wording broke no test — the whole suite stayed green through a copy change to a state every user with a committed repository sees. That is why two of the four are about it.
Screenshots
staging.pngretaken, showing the new empty state on a fresh clone. The other three are unchanged.Gate
cargo fmt --all -- --check,cargo clippy --workspace --all-targets --all-features --locked -- -D warnings,cargo test --workspace --all-features --locked— 904 tests, all green.