Skip to content

Commit f45792c

Browse files
committed
inbox: Add label for archived channels in headers
Fixes #800
1 parent 9a31cae commit f45792c

13 files changed

+154
-17
lines changed

assets/l10n/app_en.arb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,10 @@
363363
"@unknownChannelName": {
364364
"description": "Replacement name for channel when it cannot be found in the store."
365365
},
366+
"channelArchivedLabel": "(archived)",
367+
"@channelArchivedLabel": {
368+
"description": "Label shown next to an archived channel's name in headers."
369+
},
366370
"composeBoxTopicHintText": "Topic",
367371
"@composeBoxTopicHintText": {
368372
"description": "Hint text for topic input widget in compose box."

lib/generated/l10n/zulip_localizations.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,12 @@ abstract class ZulipLocalizations {
585585
/// **'(unknown channel)'**
586586
String get unknownChannelName;
587587

588+
/// Label shown next to an archived channel's name in headers.
589+
///
590+
/// In en, this message translates to:
591+
/// **'(archived)'**
592+
String get channelArchivedLabel;
593+
588594
/// Hint text for topic input widget in compose box.
589595
///
590596
/// In en, this message translates to:

lib/generated/l10n/zulip_localizations_ar.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
286286
@override
287287
String get unknownChannelName => '(unknown channel)';
288288

289+
@override
290+
String get channelArchivedLabel => '(archived)';
291+
289292
@override
290293
String get composeBoxTopicHintText => 'Topic';
291294

lib/generated/l10n/zulip_localizations_en.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
286286
@override
287287
String get unknownChannelName => '(unknown channel)';
288288

289+
@override
290+
String get channelArchivedLabel => '(archived)';
291+
289292
@override
290293
String get composeBoxTopicHintText => 'Topic';
291294

lib/generated/l10n/zulip_localizations_ja.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
286286
@override
287287
String get unknownChannelName => '(unknown channel)';
288288

289+
@override
290+
String get channelArchivedLabel => '(archived)';
291+
289292
@override
290293
String get composeBoxTopicHintText => 'Topic';
291294

lib/generated/l10n/zulip_localizations_nb.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
286286
@override
287287
String get unknownChannelName => '(unknown channel)';
288288

289+
@override
290+
String get channelArchivedLabel => '(archived)';
291+
289292
@override
290293
String get composeBoxTopicHintText => 'Topic';
291294

lib/generated/l10n/zulip_localizations_pl.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
286286
@override
287287
String get unknownChannelName => '(nieznany kanał)';
288288

289+
@override
290+
String get channelArchivedLabel => '(archived)';
291+
289292
@override
290293
String get composeBoxTopicHintText => 'Wątek';
291294

lib/generated/l10n/zulip_localizations_ru.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
286286
@override
287287
String get unknownChannelName => '(unknown channel)';
288288

289+
@override
290+
String get channelArchivedLabel => '(archived)';
291+
289292
@override
290293
String get composeBoxTopicHintText => 'Тема';
291294

lib/generated/l10n/zulip_localizations_sk.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
286286
@override
287287
String get unknownChannelName => '(unknown channel)';
288288

289+
@override
290+
String get channelArchivedLabel => '(archived)';
291+
289292
@override
290293
String get composeBoxTopicHintText => 'Topic';
291294

lib/widgets/inbox.dart

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ abstract class _HeaderItem extends StatelessWidget {
222222
final _InboxPageState pageState;
223223
final int count;
224224
final bool hasMention;
225+
final bool isArchived;
225226

226227
/// A build context within the [_StreamSection] or [_AllDmsSection].
227228
///
@@ -236,6 +237,7 @@ abstract class _HeaderItem extends StatelessWidget {
236237
required this.count,
237238
required this.hasMention,
238239
required this.sectionContext,
240+
this.isArchived = false,
239241
});
240242

241243
String title(ZulipLocalizations zulipLocalizations);
@@ -284,16 +286,32 @@ abstract class _HeaderItem extends StatelessWidget {
284286
const SizedBox(width: 5),
285287
Expanded(child: Padding(
286288
padding: const EdgeInsets.symmetric(vertical: 4),
287-
child: Text(
288-
style: TextStyle(
289-
fontSize: 17,
290-
height: (20 / 17),
291-
// TODO(design) check if this is the right variable
292-
color: designVariables.labelMenuButton,
293-
).merge(weightVariableTextStyle(context, wght: 600)),
289+
child: RichText(
294290
maxLines: 1,
295291
overflow: TextOverflow.ellipsis,
296-
title(zulipLocalizations)))),
292+
text: TextSpan(
293+
children: [
294+
TextSpan(
295+
text: title(zulipLocalizations),
296+
style: TextStyle(
297+
fontSize: 17,
298+
height: 20 / 17,
299+
// TODO(design) check if this is the right variable
300+
color: designVariables.labelMenuButton,
301+
).merge(weightVariableTextStyle(context, wght: 600))),
302+
if (isArchived)
303+
// TODO(#1285): Avoid concatenating translated strings
304+
WidgetSpan(
305+
child: Padding(
306+
padding: EdgeInsetsDirectional.only(start: 4),
307+
child: Text(
308+
zulipLocalizations.channelArchivedLabel,
309+
style: TextStyle(
310+
fontSize: 17,
311+
height: 20 / 17,
312+
color: MessageListTheme.of(context).streamRecipientHeaderChevronRight,
313+
fontStyle: FontStyle.italic)))),
314+
])))),
297315
const SizedBox(width: 12),
298316
if (hasMention) const _IconMarker(icon: ZulipIcons.at_sign),
299317
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
@@ -435,6 +453,7 @@ class _StreamHeaderItem extends _HeaderItem {
435453
required super.count,
436454
required super.hasMention,
437455
required super.sectionContext,
456+
required super.isArchived,
438457
});
439458

440459
@override String title(ZulipLocalizations zulipLocalizations) =>
@@ -481,6 +500,7 @@ class _StreamSection extends StatelessWidget {
481500
collapsed: collapsed,
482501
pageState: pageState,
483502
sectionContext: context,
503+
isArchived: subscription.isArchived,
484504
);
485505
return StickyHeaderItem(
486506
header: header,

0 commit comments

Comments
 (0)