Skip to content

Commit

Permalink
feat(search): ✨ add search portals to empty state
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair3149 committed Jan 16, 2023
1 parent 7416a7f commit 4b8e128
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 2 additions & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
"citizen-action-addsection": "Add topic",
"citizen-jumptotop": "Back to top",
"citizen-search-fulltext": "Search for pages containing $1",
"citizen-search-fulltext-empty": "Search text within pages",
"citizen-search-mediasearch": "Search for media related to $1",
"citizen-search-mediasearch-empty": "Search for media",
"citizen-search-empty-desc": "Type to start searching",
"citizen-search-noresults-title": "Uh oh! No results for $1",
"citizen-search-noresults-desc": "Maybe try the options below?",
Expand Down
2 changes: 2 additions & 0 deletions i18n/qqq.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
"citizen-action-addsection": "Used in the Citizen skin. See for example {{canonicalurl:Talk:Main_Page|useskin=vector}}\n{{Identical|Add topic}}. Same as vector-action-addsection in Vector skin.",
"citizen-jumptotop": "Label for link to jump to top of page",
"citizen-search-fulltext": "Fulltext search suggestion",
"citizen-search-fulltext-empty": "Helper text for Fulltext search",
"citizen-search-mediasearch": "MediaSearch suggestion",
"citizen-search-mediasearch-empty": "Helper text for MediaSearch",
"citizen-search-empty-desc": "Helper text in the search suggestion when there are no search query",
"citizen-search-noresults-title": "Title in the search suggestion when there are no search results",
"citizen-search-noresults-desc": "Description in the search suggestion when there are no search results",
Expand Down
10 changes: 2 additions & 8 deletions resources/skins.citizen.search/typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,12 +394,6 @@ function updateTypeahead( messages ) {
desc: itemDesc
}
);
// FIXME: There is probably a more efficient way
if ( hasQuery ) {
item.classList.remove( HIDDEN_CLASS );
} else {
item.classList.add( HIDDEN_CLASS );
}
} else {
item = getMenuItem( {
icon: data.icon,
Expand All @@ -417,7 +411,7 @@ function updateTypeahead( messages ) {
id: 'fulltext',
link: `${config.wgScriptPath}/index.php?title=Special:Search&fulltext=1&search=`,
icon: 'articleSearch',
msg: 'citizen-search-fulltext'
msg: hasQuery ? 'citizen-search-fulltext' : 'citizen-search-fulltext-empty'
} );

// MediaSearch
Expand All @@ -426,7 +420,7 @@ function updateTypeahead( messages ) {
id: 'mediasearch',
link: `${config.wgScriptPath}/index.php?title=Special:MediaSearch&type=image&search=`,
icon: 'imageGallery',
msg: 'citizen-search-mediasearch'
msg: hasQuery ? 'citizen-search-mediasearch' : 'citizen-search-mediasearch-empty'
} );
}

Expand Down
2 changes: 2 additions & 0 deletions skin.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@
],
"messages": [
"citizen-search-fulltext",
"citizen-search-fulltext-empty",
"citizen-search-mediasearch",
"citizen-search-mediasearch-empty",
"citizen-search-empty-desc",
"citizen-search-noresults-title",
"citizen-search-noresults-desc",
Expand Down

0 comments on commit 4b8e128

Please sign in to comment.