From f421548979d02987db6687dc4a1e3e780022c5a4 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Wed, 11 Nov 2020 10:51:20 +0100 Subject: [PATCH] navigation: show search results length badge --- appinfo/routes.php | 3 +-- css/icons.scss | 1 + lib/Search/SearchProvider.php | 4 ++-- src/components/Main.vue | 5 +++-- src/components/Navigation.vue | 18 ++++++++++++++++-- src/router.js | 8 +------- 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/appinfo/routes.php b/appinfo/routes.php index 79bc45b..dcb9be0 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -68,10 +68,9 @@ return [ ], [ 'name' => 'page#index', - 'url' => '/search/{query}', + 'url' => '/search', 'verb' => 'GET', 'postfix' => 'search', - 'requirements' => ['query' => '.+'], ], // Settings diff --git a/css/icons.scss b/css/icons.scss index a8bf497..743e80a 100644 --- a/css/icons.scss +++ b/css/icons.scss @@ -23,3 +23,4 @@ @include icon-black-white('recent', 'radio', 1); @include icon-black-white('radio', 'radio', 1); +@include icon-black-white('radio-trans', 'radio', 1); diff --git a/lib/Search/SearchProvider.php b/lib/Search/SearchProvider.php index 06feb70..149d849 100644 --- a/lib/Search/SearchProvider.php +++ b/lib/Search/SearchProvider.php @@ -69,8 +69,8 @@ class SearchProvider implements IProvider { $result['favicon'], $result['name'], str_replace(",",", ",$result['tags']), - $this->url->linkToRouteAbsolute('radio.page.index') . 'search/'.$term.'#/search/'.$term, - 'icon-radio' + $this->url->linkToRouteAbsolute('radio.page.index') . 'search#'.$term, + 'icon-radio-trans' ); }, $parsed); diff --git a/src/components/Main.vue b/src/components/Main.vue index d723f3f..0120d8a 100644 --- a/src/components/Main.vue +++ b/src/components/Main.vue @@ -1,6 +1,7 @@ @@ -52,6 +54,12 @@ export default { AppNavigationCounter, Player, }, + props: { + stationData: { + type: Array, + default() { return [] }, + }, + }, computed: { isSearch() { return this.$route.name === 'SEARCH' @@ -59,3 +67,9 @@ export default { }, } + + diff --git a/src/router.js b/src/router.js index 76e5268..d597b6d 100644 --- a/src/router.js +++ b/src/router.js @@ -39,7 +39,7 @@ const router = new Router({ name: 'CATEGORIES', }, { - path: '/search/:query', + path: '/search', component: Main, name: 'SEARCH', }, @@ -48,12 +48,6 @@ const router = new Router({ router.beforeEach((to, from, next) => { - if (to.hash) { - const hashPath = to.hash.substr(1) - next(hashPath) - return - } - if (to.name) { store.dispatch('setMenuState', to.name) next()