Skip to content

Commit 432b103

Browse files
author
chimnayajith
committed
inbox: Add label for archived channels in headers
Fixes #800
1 parent 5a5bb5b commit 432b103

13 files changed

+173
-22
lines changed

assets/l10n/app_en.arb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,10 @@
364364
"@unknownChannelName": {
365365
"description": "Replacement name for channel when it cannot be found in the store."
366366
},
367+
"channelArchivedLabel": "(archived)",
368+
"@channelArchivedLabel": {
369+
"description": "Label shown next to an archived channel's name in headers."
370+
},
367371
"composeBoxTopicHintText": "Topic",
368372
"@composeBoxTopicHintText": {
369373
"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: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ abstract class _HeaderItem extends StatelessWidget {
222222
final _InboxPageState pageState;
223223
final int count;
224224
final bool hasMention;
225-
225+
final bool isArchived;
226226
/// A build context within the [_StreamSection] or [_AllDmsSection].
227227
///
228228
/// Used to ensure the [_StreamSection] or [_AllDmsSection] that encloses the
@@ -236,6 +236,7 @@ abstract class _HeaderItem extends StatelessWidget {
236236
required this.count,
237237
required this.hasMention,
238238
required this.sectionContext,
239+
this.isArchived = false,
239240
});
240241

241242
String title(ZulipLocalizations zulipLocalizations);
@@ -284,16 +285,33 @@ abstract class _HeaderItem extends StatelessWidget {
284285
const SizedBox(width: 5),
285286
Expanded(child: Padding(
286287
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)),
288+
child: RichText(
294289
maxLines: 1,
295290
overflow: TextOverflow.ellipsis,
296-
title(zulipLocalizations)))),
291+
text: TextSpan(
292+
children: [
293+
TextSpan(
294+
text: title(zulipLocalizations),
295+
style: TextStyle(
296+
fontSize: 17,
297+
height: (20 / 17),
298+
color: designVariables.labelMenuButton,
299+
).merge(weightVariableTextStyle(context, wght: 600)),
300+
),
301+
if (isArchived)
302+
TextSpan(
303+
text: ' ${zulipLocalizations.channelArchivedLabel}',
304+
style: TextStyle(
305+
fontSize: 17,
306+
height: (20 / 17),
307+
color: MessageListTheme.of(context).streamRecipientHeaderChevronRight,
308+
fontStyle: FontStyle.italic,
309+
),
310+
),
311+
],
312+
),
313+
),
314+
)),
297315
const SizedBox(width: 12),
298316
if (hasMention) const _IconMarker(icon: ZulipIcons.at_sign),
299317
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
@@ -441,6 +459,7 @@ class _StreamHeaderItem extends _HeaderItem {
441459
required super.count,
442460
required super.hasMention,
443461
required super.sectionContext,
462+
required super.isArchived,
444463
});
445464

446465
@override String title(ZulipLocalizations zulipLocalizations) =>
@@ -487,6 +506,7 @@ class _StreamSection extends StatelessWidget {
487506
collapsed: collapsed,
488507
pageState: pageState,
489508
sectionContext: context,
509+
isArchived: subscription.isArchived,
490510
);
491511
return StickyHeaderItem(
492512
header: header,

0 commit comments

Comments
 (0)