Skip to content

Commit 0ef4fd6

Browse files
committed
WIP basic search!
Still TODO before shipping: - "There are no messages here" placeholder text -- probably isn't ever right for the search page. Maybe we want one message for when there isn't (yet) a search query, and another message for when we've searched and there are no results. - Tests, ideally - Cut out `match_content` `match_topic` in message objects, for now
1 parent 05904fb commit 0ef4fd6

27 files changed

+301
-17
lines changed

assets/l10n/app_en.arb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,10 @@
534534
"@emptyMessageList": {
535535
"description": "Placeholder for some message-list pages when there are no messages."
536536
},
537+
"emptyMessageListSearch": "No search results.",
538+
"@emptyMessageListSearch": {
539+
"description": "Placeholder for the 'Search' page when there are no messages."
540+
},
537541
"messageListGroupYouWithYourself": "Messages with yourself",
538542
"@messageListGroupYouWithYourself": {
539543
"description": "Message list recipient header for a DM group that only includes yourself."
@@ -793,6 +797,18 @@
793797
"@userRoleUnknown": {
794798
"description": "Label for UserRole.unknown"
795799
},
800+
"searchMessagesPageTitle": "Search",
801+
"@searchMessagesPageTitle": {
802+
"description": "Page title for the 'Search' message view."
803+
},
804+
"searchMessagesHintText": "Search",
805+
"@searchMessagesHintText": {
806+
"description": "Hint text for the message search text field."
807+
},
808+
"searchMessagesClearButtonTooltip": "Clear",
809+
"@searchMessagesClearButtonTooltip": {
810+
"description": "Tooltip for the 'x' button in the search text field."
811+
},
796812
"inboxPageTitle": "Inbox",
797813
"@inboxPageTitle": {
798814
"description": "Title for the page with unreads."

lib/api/model/narrow.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,20 @@ class ApiNarrowPmWith extends ApiNarrowDm {
173173
ApiNarrowPmWith._(super.operand, {super.negated});
174174
}
175175

176+
/// An [ApiNarrowElement] with the 'search' operator.
177+
class ApiNarrowSearch extends ApiNarrowElement {
178+
@override String get operator => 'search';
179+
180+
@override final String operand;
181+
182+
ApiNarrowSearch(this.operand, {super.negated});
183+
184+
factory ApiNarrowSearch.fromJson(Map<String, dynamic> json) => ApiNarrowSearch(
185+
json['operand'] as String,
186+
negated: json['negated'] as bool? ?? false,
187+
);
188+
}
189+
176190
class ApiNarrowIs extends ApiNarrowElement {
177191
@override String get operator => 'is';
178192

lib/generated/l10n/zulip_localizations.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,12 @@ abstract class ZulipLocalizations {
851851
/// **'There are no messages here.'**
852852
String get emptyMessageList;
853853

854+
/// Placeholder for the 'Search' page when there are no messages.
855+
///
856+
/// In en, this message translates to:
857+
/// **'No search results.'**
858+
String get emptyMessageListSearch;
859+
854860
/// Message list recipient header for a DM group that only includes yourself.
855861
///
856862
/// 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
@@ -437,6 +437,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
437437
@override
438438
String get emptyMessageList => 'There are no messages here.';
439439

440+
@override
441+
String get emptyMessageListSearch => 'No search results.';
442+
440443
@override
441444
String get messageListGroupYouWithYourself => 'Messages with yourself';
442445

lib/generated/l10n/zulip_localizations_de.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,9 @@ class ZulipLocalizationsDe extends ZulipLocalizations {
452452
@override
453453
String get emptyMessageList => 'There are no messages here.';
454454

455+
@override
456+
String get emptyMessageListSearch => 'No search results.';
457+
455458
@override
456459
String get messageListGroupYouWithYourself => 'Nachrichten mit dir selbst';
457460

lib/generated/l10n/zulip_localizations_en.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
437437
@override
438438
String get emptyMessageList => 'There are no messages here.';
439439

440+
@override
441+
String get emptyMessageListSearch => 'No search results.';
442+
440443
@override
441444
String get messageListGroupYouWithYourself => 'Messages with yourself';
442445

lib/generated/l10n/zulip_localizations_it.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,9 @@ class ZulipLocalizationsIt extends ZulipLocalizations {
448448
@override
449449
String get emptyMessageList => 'There are no messages here.';
450450

451+
@override
452+
String get emptyMessageListSearch => 'No search results.';
453+
451454
@override
452455
String get messageListGroupYouWithYourself => 'Messaggi con te stesso';
453456

lib/generated/l10n/zulip_localizations_ja.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
437437
@override
438438
String get emptyMessageList => 'There are no messages here.';
439439

440+
@override
441+
String get emptyMessageListSearch => 'No search results.';
442+
440443
@override
441444
String get messageListGroupYouWithYourself => 'Messages with yourself';
442445

lib/generated/l10n/zulip_localizations_nb.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,9 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
437437
@override
438438
String get emptyMessageList => 'There are no messages here.';
439439

440+
@override
441+
String get emptyMessageListSearch => 'No search results.';
442+
440443
@override
441444
String get messageListGroupYouWithYourself => 'Messages with yourself';
442445

lib/generated/l10n/zulip_localizations_pl.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
446446
@override
447447
String get emptyMessageList => 'There are no messages here.';
448448

449+
@override
450+
String get emptyMessageListSearch => 'No search results.';
451+
449452
@override
450453
String get messageListGroupYouWithYourself => 'Zapiski na własne konto';
451454

0 commit comments

Comments
 (0)