Skip to content

msglist: Friendlier placeholder text when narrow has no messages (simple version) #1650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 3, 2025

Conversation

chrisbobbe
Copy link
Collaborator

@chrisbobbe chrisbobbe commented Jul 2, 2025

Splitting this out from #1640, so it can be merged soon.

Fixes #1555.

For now, the text simply says "There are no messages here." We'll add per-narrow logic later, but this is an improvement over the current appearance which just says "No earlier messages." (Earlier than what?)

@chrisbobbe
Copy link
Collaborator Author

Before After
image image

Copy link
Member

@rajveermalviya rajveermalviya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @chrisbobbe! Just one small comment, otherwise LGTM.

@@ -148,40 +148,6 @@ class _HomePageState extends State<HomePage> {
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

page: Move no-content placeholder widget to page.dart, from home.dart

Should this commit be marked as nfc?

@chrisbobbe chrisbobbe force-pushed the pr-empty-msglist-simple-placeholder branch from 9ed5862 to 1fc69d5 Compare July 2, 2025 18:43
@chrisbobbe
Copy link
Collaborator Author

Thanks! Revision pushed, and I'll mark for Greg's review.

@chrisbobbe chrisbobbe requested a review from gnprice July 2, 2025 18:43
@chrisbobbe chrisbobbe assigned gnprice and unassigned rajveermalviya Jul 2, 2025
@chrisbobbe chrisbobbe added integration review Added by maintainers when PR may be ready for integration and removed maintainer review PR ready for review by Zulip maintainers labels Jul 2, 2025
@chrisbobbe chrisbobbe force-pushed the pr-empty-msglist-simple-placeholder branch from 1fc69d5 to 6cfdd1d Compare July 2, 2025 21:50
@chrisbobbe
Copy link
Collaborator Author

(Updated just to add a test that I wrote for #1640 but also belongs here.)

Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good; one small comment.

).findsOne();
});

testWidgets('when `messages` empty but `outboxMessages` not empty, show outboxes, not placeholder', (tester) async {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good thought to test this.

Comment on lines +353 to +378
await tester.enterText(contentInputFinder, 'asdfjkl;');
await tester.tap(find.byIcon(ZulipIcons.send));
await tester.pump(kLocalEchoDebounceDuration);

check(findPlaceholder).findsNothing();
check(find.text('asdfjkl;')).findsOne();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is a nice user-focused structure for the test.

Comment on lines 795 to 796
if (model.haveNewest && model.haveOldest
&& model.messages.isEmpty && model.outboxMessages.isEmpty) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe test model.items is empty, rather than messages and outboxMessages separately?

Suggested change
if (model.haveNewest && model.haveOldest
&& model.messages.isEmpty && model.outboxMessages.isEmpty) {
if (model.items.isEmpty && model.haveNewest && model.haveOldest) {

That's the layer the rest of this widget's logic works at: it operates on items and doesn't look at the messages or outboxMessages lists directly.

If in some future we add another way there can be items in the list, with neither messages nor outbox-messages, and don't edit this, then that would mean it'd show the start and end caps, and the items in between. I think that's probably the right outcome: the items are there in the view-model, so should be shown. (If they shouldn't be shown, they shouldn't be in the view-model.)

@chrisbobbe chrisbobbe force-pushed the pr-empty-msglist-simple-placeholder branch from 6cfdd1d to d526799 Compare July 3, 2025 01:31
@chrisbobbe
Copy link
Collaborator Author

Thanks! Revision pushed.

…e.dart

We can reuse this for the empty message list.
Fixes zulip#1555.

For now, the text simply says "There are no messages here." We'll
add per-narrow logic later, but this is an improvement over the
current appearance which just says "No earlier messages." (Earlier
than what?)

To support being used in the message-list page (in addition to
Inbox, etc.), the placeholder widget only needs small changes, it
turns out.
@gnprice gnprice force-pushed the pr-empty-msglist-simple-placeholder branch from d526799 to 8749817 Compare July 3, 2025 04:04
@gnprice
Copy link
Member

gnprice commented Jul 3, 2025

Thanks! Looks good; merging.

@gnprice gnprice merged commit 8749817 into zulip:main Jul 3, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration review Added by maintainers when PR may be ready for integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

msglist: Friendlier placeholder text when narrow has no messages
3 participants