From 8019e8957ebd94bd53bf35002c24aa2dcdbe65c5 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 13 May 2024 09:30:28 -0300 Subject: search, client: group results --- src/content/dependencies/generateSearchSidebarBox.js | 3 +++ src/static/js/client.js | 15 +++++++++++++++ src/strings-default.yaml | 1 + src/util/search-spec.js | 3 +++ 4 files changed, 22 insertions(+) diff --git a/src/content/dependencies/generateSearchSidebarBox.js b/src/content/dependencies/generateSearchSidebarBox.js index 3758f209..796cfe28 100644 --- a/src/content/dependencies/generateSearchSidebarBox.js +++ b/src/content/dependencies/generateSearchSidebarBox.js @@ -31,6 +31,9 @@ export default { html.tag('template', {class: 'wiki-search-artist-result-kind-string'}, language.$('misc.search.resultKind.artist')), + + html.tag('template', {class: 'wiki-search-group-result-kind-string'}, + language.$('misc.search.resultKind.group')), ], }), }; diff --git a/src/static/js/client.js b/src/static/js/client.js index 5b762c49..ceaec460 100644 --- a/src/static/js/client.js +++ b/src/static/js/client.js @@ -197,6 +197,7 @@ const getLinkHref = (type, directory) => rebase(`${type}/${directory}`); const openAlbum = d => rebase(`album/${d}`); const openArtist = d => rebase(`artist/${d}`); const openFlash = d => rebase(`flash/${d}`); +const openGroup = d => rebase(`group/${d}`); const openTrack = d => rebase(`track/${d}`); // TODO: This should also use urlSpec. @@ -3590,6 +3591,7 @@ const sidebarSearchInfo = initInfo('sidebarSearchInfo', { endSearchString: null, artistResultKindString: null, + groupResultKindString: null, state: { stoppedTypingTimeout: null, @@ -3632,6 +3634,9 @@ function getSidebarSearchReferences() { info.artistResultKindString = findString('artist-result-kind'); + + info.groupResultKindString = + findString('group-result-kind'); } function mutateSidebarSearchContent() { @@ -3849,6 +3854,16 @@ function generateSidebarSearchResult(result) { break; } + case 'group': { + preparedSlots.href = + openGroup(result.directory); + + preparedSlots.kindString = + info.groupResultKindString; + + break; + } + case 'flash': { preparedSlots.href = openFlash(result.directory); diff --git a/src/strings-default.yaml b/src/strings-default.yaml index 7bc215b8..a06882c1 100644 --- a/src/strings-default.yaml +++ b/src/strings-default.yaml @@ -631,6 +631,7 @@ misc: resultKind: artist: "(artist)" + group: "(group)" # skippers: # diff --git a/src/util/search-spec.js b/src/util/search-spec.js index e9e0a6f9..5aba2194 100644 --- a/src/util/search-spec.js +++ b/src/util/search-spec.js @@ -83,6 +83,7 @@ export const searchSpec = { albumData, artistData, flashData, + groupData, trackData, }) => [ albumData, @@ -92,6 +93,8 @@ export const searchSpec = { flashData, + groupData, + trackData // Exclude rereleases - there's no reasonable way to differentiate // them from the main release as part of this query. -- cgit 1.3.0-6-gf8a5