From 1ed83e463b44c57a1906c3576e61fa37b21738da Mon Sep 17 00:00:00 2001
From: Thomas Citharel <tcit@tcit.fr>
Date: Mon, 10 Aug 2020 18:54:25 +0200
Subject: [PATCH] Bring back tag search

Closes #369

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
---
 js/src/i18n/en_US.json  | 10 ++++++++--
 js/src/i18n/fr_FR.json  | 10 ++++++++--
 js/src/views/Search.vue | 11 +++++++++--
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/js/src/i18n/en_US.json b/js/src/i18n/en_US.json
index 398e0761a..0ba5586c5 100644
--- a/js/src/i18n/en_US.json
+++ b/js/src/i18n/en_US.json
@@ -333,7 +333,6 @@
   "Save draft": "Save draft",
   "Save": "Save",
   "Search events, groups, etc.": "Search events, groups, etc.",
-  "Search results: \"{search}\"": "Search results: \"{search}\"",
   "Search": "Search",
   "Searching…": "Searching…",
   "Send email": "Send email",
@@ -743,5 +742,12 @@
   "Next month": "Next month",
   "Any day": "Any day",
   "{nb} km": "{nb} km",
-  "any distance": "any distance"
+  "any distance": "any distance",
+  "Group visibility": "Group visibility",
+  "The group will be publicly listed in search results and may be suggested in the explore section. Only public informations will be shown on it's page.": "The group will be publicly listed in search results and may be suggested in the explore section. Only public informations will be shown on it's page.",
+  "You'll need to transmit the group URL so people may access the group's profile.": "You'll need to transmit the group URL so people may access the group's profile.",
+  "Group address": "Group address",
+  "Events tagged with {tag}": "Events tagged with {tag}",
+  "Explore events": "Explore events",
+  "#{tag}": "#{tag}"
 }
diff --git a/js/src/i18n/fr_FR.json b/js/src/i18n/fr_FR.json
index 7eb4b669b..e2bfa4326 100644
--- a/js/src/i18n/fr_FR.json
+++ b/js/src/i18n/fr_FR.json
@@ -492,7 +492,6 @@
   "Save draft": "Enregistrer le brouillon",
   "Search": "Rechercher",
   "Search events, groups, etc.": "Rechercher des évènements, des groupes, etc.",
-  "Search results: \"{search}\"": "Résultats de recherche : « {search} »",
   "Searching…": "Recherche en cours…",
   "Select a language": "Choisissez une langue",
   "Select a timezone": "Selectionnez un fuseau horaire",
@@ -743,5 +742,12 @@
   "Next month": "Le mois-prochain",
   "Any day": "N'importe quand",
   "{nb} km": "{nb} km",
-  "any distance": "peu importe"
+  "any distance": "peu importe",
+  "Group visibility": "Visibility du groupe",
+  "The group will be publicly listed in search results and may be suggested in the explore section. Only public informations will be shown on it's page.": "Le groupe sera listé publiquement dans les résultats de recherche et pourra être suggéré sur la page « Explorer ». Seules les informations publiques seront affichées sur sa page.",
+  "You'll need to transmit the group URL so people may access the group's profile.": "Vous aurez besoin de transmettre l'URL du groupe pour que d'autres personnes accèdent au profil du groupe.",
+  "Group address": "Adresse du groupe",
+  "Events tagged with {tag}": "Événements taggés avec {tag}",
+  "Explore events": "Explorer les événements",
+  "#{tag}": "#{tag}"
 }
diff --git a/js/src/views/Search.vue b/js/src/views/Search.vue
index 873100e4c..a7583efbb 100644
--- a/js/src/views/Search.vue
+++ b/js/src/views/Search.vue
@@ -1,7 +1,12 @@
 <template>
   <div class="section container">
     <h1 class="title">{{ $t("Explore") }}</h1>
-    <section class="hero is-light">
+    <section v-if="actualTag">
+      <i18n path="Events tagged with {tag}">
+        <b-tag slot="tag" type="is-light">{{ $t("#{tag}", { tag: actualTag }) }}</b-tag>
+      </i18n>
+    </section>
+    <section class="hero is-light" v-else>
       <div class="hero-body">
         <form @submit.prevent="submit()">
           <b-field :label="$t('Key words')" label-for="search" expanded>
@@ -44,7 +49,7 @@
         </form>
       </div>
     </section>
-    <section class="events-featured" v-if="searchEvents.initial">
+    <section class="events-featured" v-if="!actualTag && searchEvents.initial">
       <b-loading :active.sync="$apollo.loading"></b-loading>
       <h2 class="title">{{ $t("Featured events") }}</h2>
       <div v-if="events.length > 0" class="columns is-multiline">
@@ -197,6 +202,7 @@ const tabsName: { events: number; groups: number } = {
   },
 })
 export default class Search extends Vue {
+  @Prop({ type: String, required: false }) tag!: string;
   events: IEvent[] = [];
 
   searchEvents: Paginate<IEvent> & { initial: boolean } = { total: 0, elements: [], initial: true };
@@ -207,6 +213,7 @@ export default class Search extends Vue {
   activeTab: SearchTabs = tabsName[this.$route.query.searchType as "events" | "groups"] || 0;
 
   location: IAddress = new Address();
+  actualTag: string = this.tag;
 
   options: ISearchTimeOption[] = [
     {