Skip to content

Add topic-list page #1500

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

Open
wants to merge 3 commits 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/topics.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@
"@actionSheetOptionMarkChannelAsRead": {
"description": "Label for marking a channel as read."
},
"actionSheetOptionListOfTopics": "List of topics",
"@actionSheetOptionListOfTopics": {
"description": "Label for navigating to a channel's topic-list page."
},
"actionSheetOptionMuteTopic": "Mute topic",
"@actionSheetOptionMuteTopic": {
"description": "Label for muting a topic on action sheet."
Expand Down Expand Up @@ -713,6 +717,10 @@
"@mainMenuMyProfile": {
"description": "Label for main-menu button leading to the user's own profile."
},
"topicsButtonLabel": "TOPICS",
"@topicsButtonLabel": {
"description": "Label for message list button leading to topic-list page. (Use ALL CAPS for cased alphabets: Latin, Greek, Cyrillic, etc.)"
},
"channelFeedButtonTooltip": "Channel feed",
"@channelFeedButtonTooltip": {
"description": "Tooltip for button to navigate to a given channel's feed"
Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ abstract class ZulipLocalizations {
/// **'Mark channel as read'**
String get actionSheetOptionMarkChannelAsRead;

/// Label for navigating to a channel's topic-list page.
///
/// In en, this message translates to:
/// **'List of topics'**
String get actionSheetOptionListOfTopics;

/// Label for muting a topic on action sheet.
///
/// In en, this message translates to:
Expand Down Expand Up @@ -1064,6 +1070,12 @@ abstract class ZulipLocalizations {
/// **'My profile'**
String get mainMenuMyProfile;

/// Label for message list button leading to topic-list page. (Use ALL CAPS for cased alphabets: Latin, Greek, Cyrillic, etc.)
///
/// In en, this message translates to:
/// **'TOPICS'**
String get topicsButtonLabel;

/// Tooltip for button to navigate to a given channel's feed
///
/// In en, this message translates to:
Expand Down
6 changes: 6 additions & 0 deletions lib/generated/l10n/zulip_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get actionSheetOptionMarkChannelAsRead => 'Mark channel as read';

@override
String get actionSheetOptionListOfTopics => 'List of topics';

@override
String get actionSheetOptionMuteTopic => 'Mute topic';

Expand Down Expand Up @@ -584,6 +587,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get mainMenuMyProfile => 'My profile';

@override
String get topicsButtonLabel => 'TOPICS';

@override
String get channelFeedButtonTooltip => 'Channel feed';

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

@override
String get actionSheetOptionListOfTopics => 'List of topics';

@override
String get actionSheetOptionMuteTopic => 'Mute topic';

Expand Down Expand Up @@ -584,6 +587,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
@override
String get mainMenuMyProfile => 'My profile';

@override
String get topicsButtonLabel => 'TOPICS';

@override
String get channelFeedButtonTooltip => 'Channel feed';

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

@override
String get actionSheetOptionListOfTopics => 'List of topics';

@override
String get actionSheetOptionMuteTopic => 'Mute topic';

Expand Down Expand Up @@ -584,6 +587,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
@override
String get mainMenuMyProfile => 'My profile';

@override
String get topicsButtonLabel => 'TOPICS';

@override
String get channelFeedButtonTooltip => 'Channel feed';

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

@override
String get actionSheetOptionListOfTopics => 'List of topics';

@override
String get actionSheetOptionMuteTopic => 'Mute topic';

Expand Down Expand Up @@ -584,6 +587,9 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
@override
String get mainMenuMyProfile => 'My profile';

@override
String get topicsButtonLabel => 'TOPICS';

@override
String get channelFeedButtonTooltip => 'Channel feed';

Expand Down
6 changes: 6 additions & 0 deletions lib/generated/l10n/zulip_localizations_pl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
String get actionSheetOptionMarkChannelAsRead =>
'Oznacz kanał jako przeczytany';

@override
String get actionSheetOptionListOfTopics => 'List of topics';

@override
String get actionSheetOptionMuteTopic => 'Wycisz wątek';

Expand Down Expand Up @@ -593,6 +596,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
@override
String get mainMenuMyProfile => 'Mój profil';

@override
String get topicsButtonLabel => 'TOPICS';

@override
String get channelFeedButtonTooltip => 'Strumień kanału';

Expand Down
6 changes: 6 additions & 0 deletions lib/generated/l10n/zulip_localizations_ru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
String get actionSheetOptionMarkChannelAsRead =>
'Отметить канал как прочитанный';

@override
String get actionSheetOptionListOfTopics => 'List of topics';

@override
String get actionSheetOptionMuteTopic => 'Отключить тему';

Expand Down Expand Up @@ -597,6 +600,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
@override
String get mainMenuMyProfile => 'Мой профиль';

@override
String get topicsButtonLabel => 'TOPICS';

@override
String get channelFeedButtonTooltip => 'Лента канала';

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

@override
String get actionSheetOptionListOfTopics => 'List of topics';

@override
String get actionSheetOptionMuteTopic => 'Stlmiť tému';

Expand Down Expand Up @@ -586,6 +589,9 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
@override
String get mainMenuMyProfile => 'Môj profil';

@override
String get topicsButtonLabel => 'TOPICS';

@override
String get channelFeedButtonTooltip => 'Channel feed';

Expand Down
6 changes: 6 additions & 0 deletions lib/generated/l10n/zulip_localizations_uk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ class ZulipLocalizationsUk extends ZulipLocalizations {
String get actionSheetOptionMarkChannelAsRead =>
'Позначити канал як прочитаний';

@override
String get actionSheetOptionListOfTopics => 'List of topics';

@override
String get actionSheetOptionMuteTopic => 'Заглушити тему';

Expand Down Expand Up @@ -596,6 +599,9 @@ class ZulipLocalizationsUk extends ZulipLocalizations {
@override
String get mainMenuMyProfile => 'Мій профіль';

@override
String get topicsButtonLabel => 'TOPICS';

@override
String get channelFeedButtonTooltip => 'Стрічка каналу';

Expand Down
40 changes: 30 additions & 10 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 @@ -174,24 +175,43 @@ void showChannelActionSheet(BuildContext context, {
final pageContext = PageRoot.contextOf(context);
final store = PerAccountStoreWidget.of(pageContext);

final optionButtons = <ActionSheetMenuItemButton>[];
final optionButtons = <ActionSheetMenuItemButton>[
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.topics;

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

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

class MarkChannelAsReadButton extends ActionSheetMenuItemButton {
const MarkChannelAsReadButton({
super.key,
Expand Down
3 changes: 2 additions & 1 deletion lib/widgets/content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import 'poll.dart';
import 'scrolling.dart';
import 'store.dart';
import 'text.dart';
import 'theme.dart';

/// A central place for styles for Zulip content (rendered Zulip Markdown).
///
Expand Down Expand Up @@ -988,7 +989,7 @@ class WebsitePreview extends StatelessWidget {
// TODO(#488) use different color for non-message contexts
// TODO(#647) use different color for highlighted messages
// TODO(#681) use different color for DM messages
color: MessageListTheme.of(context).bgMessageRegular,
color: DesignVariables.of(context).bgMessageRegular,
child: ClipRect(
child: ConstrainedBox(
constraints: BoxConstraints(maxHeight: 80),
Expand Down
7 changes: 5 additions & 2 deletions lib/widgets/icons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,14 @@ abstract final class ZulipIcons {
/// The Zulip custom icon "topic".
static const IconData topic = IconData(0xf128, fontFamily: "Zulip Icons");

/// The Zulip custom icon "topics".
static const IconData topics = IconData(0xf129, fontFamily: "Zulip Icons");

/// The Zulip custom icon "unmute".
static const IconData unmute = IconData(0xf129, fontFamily: "Zulip Icons");
static const IconData unmute = IconData(0xf12a, fontFamily: "Zulip Icons");

/// The Zulip custom icon "user".
static const IconData user = IconData(0xf12a, fontFamily: "Zulip Icons");
static const IconData user = IconData(0xf12b, fontFamily: "Zulip Icons");

// END GENERATED ICON DATA
}
Expand Down
Loading