Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1492,5 +1492,9 @@
"zulipAppTitle": "Zulip",
"@zulipAppTitle": {
"description": "The name of Zulip. This should be either 'Zulip' or a transliteration."
},
"topicListEmptyPlaceholderHeader": "There are no topics here yet.",
"@topicListEmptyPlaceholderHeader": {
"description": "Header text shown when a channel has no topics."
}
}
6 changes: 6 additions & 0 deletions lib/generated/l10n/zulip_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2162,6 +2162,12 @@ abstract class ZulipLocalizations {
/// In en, this message translates to:
/// **'Zulip'**
String get zulipAppTitle;

/// Header text shown when a channel has no topics.
///
/// In en, this message translates to:
/// **'There are no topics here yet.'**
String get topicListEmptyPlaceholderHeader;
}

class _ZulipLocalizationsDelegate
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1245,4 +1245,7 @@ class ZulipLocalizationsAr extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_de.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1271,4 +1271,7 @@ class ZulipLocalizationsDe extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_el.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1245,4 +1245,7 @@ class ZulipLocalizationsEl extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}

/// The translations for English, as used in the United Kingdom (`en_GB`).
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_es.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1245,4 +1245,7 @@ class ZulipLocalizationsEs extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_fr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1261,4 +1261,7 @@ class ZulipLocalizationsFr extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_he.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1245,4 +1245,7 @@ class ZulipLocalizationsHe extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_hu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1245,4 +1245,7 @@ class ZulipLocalizationsHu extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_it.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1265,4 +1265,7 @@ class ZulipLocalizationsIt extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_ja.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1219,4 +1219,7 @@ class ZulipLocalizationsJa extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_nb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1245,4 +1245,7 @@ class ZulipLocalizationsNb extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_pl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1264,4 +1264,7 @@ class ZulipLocalizationsPl extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_ru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1277,4 +1277,7 @@ class ZulipLocalizationsRu extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_sk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1247,4 +1247,7 @@ class ZulipLocalizationsSk extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_sl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1286,4 +1286,7 @@ class ZulipLocalizationsSl extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_uk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1266,4 +1266,7 @@ class ZulipLocalizationsUk extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,9 @@ class ZulipLocalizationsZh extends ZulipLocalizations {

@override
String get zulipAppTitle => 'Zulip';

@override
String get topicListEmptyPlaceholderHeader => 'There are no topics here yet.';
}

/// The translations for Chinese, as used in China, using the Han script (`zh_Hans_CN`).
Expand Down
6 changes: 5 additions & 1 deletion lib/widgets/topic_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ class _TopicListState extends State<_TopicList> with PerAccountStoreAwareStateMi
return const Center(child: CircularProgressIndicator());
}

// TODO(design) handle the rare case when `lastFetchedTopics` is empty
if (lastFetchedTopics!.isEmpty) {
final zulipLocalizations = ZulipLocalizations.of(context);
return PageBodyEmptyContentPlaceholder(
header: zulipLocalizations.topicListEmptyPlaceholderHeader);
}

// This is adapted from parts of the build method on [_InboxPageState].
final topicItems = <_TopicItemData>[];
Expand Down
6 changes: 6 additions & 0 deletions test/widgets/topic_list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ void main() {
check(find.byType(CircularProgressIndicator)).findsNothing();
});

testWidgets('shows empty state when no topics', (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.

Great, this is the right spot for this test. (The code being tested comes right after the logic for when the list hasn't been loaded yet and we show a loading indicator; so this test goes right after the test for the loading indicator.)

final channel = eg.stream();
await prepare(tester, channel: channel, topics: [], messages: []);
check(find.text('There are no topics here yet.')).findsOne();
});

testWidgets('fetch again when navigating away and back', (tester) async {
addTearDown(testBinding.reset);
await testBinding.globalStore.add(eg.selfAccount, eg.initialSnapshot());
Expand Down