Skip to content
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

topicList: Add topic list page for each channel #1449

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Binary file modified assets/icons/ZulipIcons.ttf
Binary file not shown.
3 changes: 3 additions & 0 deletions assets/icons/chevron_down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/list.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@
"@actionSheetOptionUnresolveTopic": {
"description": "Label for the 'Mark as unresolved' button on the topic action sheet."
},
"actionSheetOptionTopicList": "Topic list",
"@actionSheetOptionTopicList": {
"description": "Label for a button in the channel action sheet that opens the list of topics in the channel"
},
"errorResolveTopicFailedTitle": "Failed to mark topic as resolved",
"@errorResolveTopicFailedTitle": {
"description": "Error title when marking a topic as resolved failed."
Expand Down Expand Up @@ -710,6 +714,10 @@
"@channelFeedButtonTooltip": {
"description": "Tooltip for button to navigate to a given channel's feed"
},
"topicListButtonTooltip": "Topic list",
"@topicListButtonTooltip": {
"description": "Tooltip for button to navigate to topic list page."
},
"notifGroupDmConversationLabel": "{senderFullName} to you and {numOthers, plural, =1{1 other} other{{numOthers} others}}",
"@notifGroupDmConversationLabel": {
"description": "Label for a group DM conversation notification.",
Expand Down Expand Up @@ -868,6 +876,14 @@
"@emojiPickerSearchEmoji": {
"description": "Hint text for the emoji picker search text field."
},
"errorFetchingTopics": "Error fetching topics",
"@errorFetchingTopics": {
"description": "Error title when fetching the topics failed."
},
"noTopicsInChannel": "No topics in the channel",
"@noTopicsInChannel": {
"description": "Text to show when a channel has no topics."
},
"noEarlierMessages": "No earlier messages",
"@noEarlierMessages": {
"description": "Text to show at the start of a message list if there are no earlier messages."
Expand Down
24 changes: 24 additions & 0 deletions lib/generated/l10n/zulip_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ abstract class ZulipLocalizations {
/// **'Mark as unresolved'**
String get actionSheetOptionUnresolveTopic;

/// Label for a button in the channel action sheet that opens the list of topics in the channel
///
/// In en, this message translates to:
/// **'Topic list'**
String get actionSheetOptionTopicList;

/// Error title when marking a topic as resolved failed.
///
/// In en, this message translates to:
Expand Down Expand Up @@ -1047,6 +1053,12 @@ abstract class ZulipLocalizations {
/// **'Channel feed'**
String get channelFeedButtonTooltip;

/// Tooltip for button to navigate to topic list page.
///
/// In en, this message translates to:
/// **'Topic list'**
String get topicListButtonTooltip;

/// Label for a group DM conversation notification.
///
/// In en, this message translates to:
Expand Down Expand Up @@ -1263,6 +1275,18 @@ abstract class ZulipLocalizations {
/// **'Search emoji'**
String get emojiPickerSearchEmoji;

/// Error title when fetching the topics failed.
///
/// In en, this message translates to:
/// **'Error fetching topics'**
String get errorFetchingTopics;

/// Text to show when a channel has no topics.
///
/// In en, this message translates to:
/// **'No topics in the channel'**
String get noTopicsInChannel;

/// Text to show at the start of a message list if there are no earlier messages.
///
/// In en, this message translates to:
Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get actionSheetOptionUnresolveTopic => 'Mark as unresolved';

@override
String get actionSheetOptionTopicList => 'Topic list';

@override
String get errorResolveTopicFailedTitle => 'Failed to mark topic as resolved';

Expand Down Expand Up @@ -553,6 +556,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get channelFeedButtonTooltip => 'Channel feed';

@override
String get topicListButtonTooltip => 'Topic list';

@override
String notifGroupDmConversationLabel(String senderFullName, int numOthers) {
String _temp0 = intl.Intl.pluralLogic(
Expand Down Expand Up @@ -675,6 +681,12 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get emojiPickerSearchEmoji => 'Search emoji';

@override
String get errorFetchingTopics => 'Error fetching topics';

@override
String get noTopicsInChannel => 'No topics in the channel';

@override
String get noEarlierMessages => 'No earlier messages';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
@override
String get actionSheetOptionUnresolveTopic => 'Mark as unresolved';

@override
String get actionSheetOptionTopicList => 'Topic list';

@override
String get errorResolveTopicFailedTitle => 'Failed to mark topic as resolved';

Expand Down Expand Up @@ -553,6 +556,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
@override
String get channelFeedButtonTooltip => 'Channel feed';

@override
String get topicListButtonTooltip => 'Topic list';

@override
String notifGroupDmConversationLabel(String senderFullName, int numOthers) {
String _temp0 = intl.Intl.pluralLogic(
Expand Down Expand Up @@ -675,6 +681,12 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
@override
String get emojiPickerSearchEmoji => 'Search emoji';

@override
String get errorFetchingTopics => 'Error fetching topics';

@override
String get noTopicsInChannel => 'No topics in the channel';

@override
String get noEarlierMessages => 'No earlier messages';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_ja.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
@override
String get actionSheetOptionUnresolveTopic => 'Mark as unresolved';

@override
String get actionSheetOptionTopicList => 'Topic list';

@override
String get errorResolveTopicFailedTitle => 'Failed to mark topic as resolved';

Expand Down Expand Up @@ -553,6 +556,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
@override
String get channelFeedButtonTooltip => 'Channel feed';

@override
String get topicListButtonTooltip => 'Topic list';

@override
String notifGroupDmConversationLabel(String senderFullName, int numOthers) {
String _temp0 = intl.Intl.pluralLogic(
Expand Down Expand Up @@ -675,6 +681,12 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
@override
String get emojiPickerSearchEmoji => 'Search emoji';

@override
String get errorFetchingTopics => 'Error fetching topics';

@override
String get noTopicsInChannel => 'No topics in the channel';

@override
String get noEarlierMessages => 'No earlier messages';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_nb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
@override
String get actionSheetOptionUnresolveTopic => 'Mark as unresolved';

@override
String get actionSheetOptionTopicList => 'Topic list';

@override
String get errorResolveTopicFailedTitle => 'Failed to mark topic as resolved';

Expand Down Expand Up @@ -553,6 +556,9 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
@override
String get channelFeedButtonTooltip => 'Channel feed';

@override
String get topicListButtonTooltip => 'Topic list';

@override
String notifGroupDmConversationLabel(String senderFullName, int numOthers) {
String _temp0 = intl.Intl.pluralLogic(
Expand Down Expand Up @@ -675,6 +681,12 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
@override
String get emojiPickerSearchEmoji => 'Search emoji';

@override
String get errorFetchingTopics => 'Error fetching topics';

@override
String get noTopicsInChannel => 'No topics in the channel';

@override
String get noEarlierMessages => 'No earlier messages';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_pl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
@override
String get actionSheetOptionUnresolveTopic => 'Oznacz brak rozwiązania';

@override
String get actionSheetOptionTopicList => 'Topic list';

@override
String get errorResolveTopicFailedTitle => 'Nie udało się oznaczyć jako rozwiązany';

Expand Down Expand Up @@ -553,6 +556,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
@override
String get channelFeedButtonTooltip => 'Strumień kanału';

@override
String get topicListButtonTooltip => 'Topic list';

@override
String notifGroupDmConversationLabel(String senderFullName, int numOthers) {
String _temp0 = intl.Intl.pluralLogic(
Expand Down Expand Up @@ -675,6 +681,12 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
@override
String get emojiPickerSearchEmoji => 'Szukaj emoji';

@override
String get errorFetchingTopics => 'Error fetching topics';

@override
String get noTopicsInChannel => 'No topics in the channel';

@override
String get noEarlierMessages => 'Brak historii';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_ru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
@override
String get actionSheetOptionUnresolveTopic => 'Mark as unresolved';

@override
String get actionSheetOptionTopicList => 'Topic list';

@override
String get errorResolveTopicFailedTitle => 'Failed to mark topic as resolved';

Expand Down Expand Up @@ -553,6 +556,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
@override
String get channelFeedButtonTooltip => 'Лента канала';

@override
String get topicListButtonTooltip => 'Topic list';

@override
String notifGroupDmConversationLabel(String senderFullName, int numOthers) {
String _temp0 = intl.Intl.pluralLogic(
Expand Down Expand Up @@ -675,6 +681,12 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
@override
String get emojiPickerSearchEmoji => 'Поиск эмодзи';

@override
String get errorFetchingTopics => 'Error fetching topics';

@override
String get noTopicsInChannel => 'No topics in the channel';

@override
String get noEarlierMessages => 'No earlier messages';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_sk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
@override
String get actionSheetOptionUnresolveTopic => 'Mark as unresolved';

@override
String get actionSheetOptionTopicList => 'Topic list';

@override
String get errorResolveTopicFailedTitle => 'Failed to mark topic as resolved';

Expand Down Expand Up @@ -553,6 +556,9 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
@override
String get channelFeedButtonTooltip => 'Channel feed';

@override
String get topicListButtonTooltip => 'Topic list';

@override
String notifGroupDmConversationLabel(String senderFullName, int numOthers) {
String _temp0 = intl.Intl.pluralLogic(
Expand Down Expand Up @@ -675,6 +681,12 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
@override
String get emojiPickerSearchEmoji => 'Hľadať emotikon';

@override
String get errorFetchingTopics => 'Error fetching topics';

@override
String get noTopicsInChannel => 'No topics in the channel';

@override
String get noEarlierMessages => 'No earlier messages';

Expand Down
42 changes: 33 additions & 9 deletions lib/widgets/action_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import 'page.dart';
import 'store.dart';
import 'text.dart';
import 'theme.dart';
import 'topic_list.dart';

void _showActionSheet(
BuildContext context, {
Expand Down Expand Up @@ -175,23 +176,46 @@ void showChannelActionSheet(BuildContext context, {
final store = PerAccountStoreWidget.of(pageContext);

final optionButtons = <ActionSheetMenuItemButton>[];

optionButtons.add(
TopicListButton(pageContext: pageContext, channelId: channelId));

final unreadCount = store.unreads.countInChannelNarrow(channelId);
if (unreadCount > 0) {
optionButtons.add(
MarkChannelAsReadButton(pageContext: pageContext, channelId: channelId));
}
if (optionButtons.isEmpty) {
// TODO(a11y): This case makes a no-op gesture handler; as a consequence,
// we're presenting some UI (to people who use screen-reader software) as
// though it offers a gesture interaction that it doesn't meaningfully
// offer, which is confusing. The solution here is probably to remove this
// is-empty case by having at least one button that's always present,
// such as "copy link to channel".
return;
}

_showActionSheet(pageContext, optionButtons: optionButtons);
}

class TopicListButton extends ActionSheetMenuItemButton {
const TopicListButton({
super.key,
required this.channelId,
required super.pageContext,
});

final int channelId;

@override
IconData get icon => ZulipIcons.list;

@override
String label(ZulipLocalizations zulipLocalizations) {
return zulipLocalizations.actionSheetOptionTopicList;
}

@override
void onPressed() {
Navigator.push(pageContext,
TopicListPage.buildRoute(
context: pageContext,
streamId: channelId,
));
}
}

class MarkChannelAsReadButton extends ActionSheetMenuItemButton {
const MarkChannelAsReadButton({
super.key,
Expand Down
Loading