2019-09-20 19:43:29 +02:00
|
|
|
<template>
|
2019-12-20 13:04:34 +01:00
|
|
|
<div class="section container">
|
2020-02-18 08:57:00 +01:00
|
|
|
<h1 class="title">{{ $t("Explore") }}</h1>
|
2019-10-09 18:51:55 +02:00
|
|
|
<section class="hero">
|
|
|
|
<div class="hero-body">
|
2019-10-11 10:13:48 +02:00
|
|
|
<form @submit.prevent="submit()">
|
2020-02-18 08:57:00 +01:00
|
|
|
<b-field
|
|
|
|
:label="$t('Event')"
|
|
|
|
grouped
|
|
|
|
group-multiline
|
|
|
|
label-position="on-border"
|
|
|
|
label-for="search"
|
|
|
|
>
|
|
|
|
<b-input
|
|
|
|
icon="magnify"
|
|
|
|
type="search"
|
|
|
|
id="search"
|
|
|
|
size="is-large"
|
|
|
|
expanded
|
|
|
|
v-model="searchTerm"
|
|
|
|
:placeholder="$t('For instance: London, Taekwondo, Architecture…')"
|
|
|
|
/>
|
2019-10-09 18:51:55 +02:00
|
|
|
<p class="control">
|
2020-02-18 08:57:00 +01:00
|
|
|
<b-button
|
|
|
|
@click="submit"
|
|
|
|
type="is-info"
|
|
|
|
size="is-large"
|
|
|
|
v-bind:disabled="searchTerm.trim().length === 0"
|
|
|
|
>{{ $t("Search") }}</b-button
|
|
|
|
>
|
2019-10-09 18:51:55 +02:00
|
|
|
</p>
|
|
|
|
</b-field>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<section class="events-featured">
|
|
|
|
<b-loading :active.sync="$apollo.loading"></b-loading>
|
2020-02-18 08:57:00 +01:00
|
|
|
<h2 class="title">{{ $t("Featured events") }}</h2>
|
2019-10-09 18:51:55 +02:00
|
|
|
<div v-if="events.length > 0" class="columns is-multiline">
|
2019-12-20 13:04:34 +01:00
|
|
|
<div class="column is-one-third-desktop" v-for="event in events" :key="event.uuid">
|
2020-02-18 08:57:00 +01:00
|
|
|
<EventCard :event="event" />
|
2019-10-09 18:51:55 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-02-18 08:57:00 +01:00
|
|
|
<b-message v-else-if="events.length === 0 && $apollo.loading === false" type="is-danger">{{
|
|
|
|
$t("No events found")
|
|
|
|
}}</b-message>
|
2019-10-09 18:51:55 +02:00
|
|
|
</section>
|
|
|
|
</div>
|
2019-09-20 19:43:29 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-02-18 08:57:00 +01:00
|
|
|
import { Component, Vue } from "vue-property-decorator";
|
|
|
|
import EventCard from "@/components/Event/EventCard.vue";
|
|
|
|
import { FETCH_EVENTS } from "@/graphql/event";
|
|
|
|
import { IEvent } from "@/types/event.model";
|
|
|
|
import RouteName from "../../router/name";
|
2019-09-20 19:43:29 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
components: {
|
|
|
|
EventCard,
|
|
|
|
},
|
|
|
|
apollo: {
|
|
|
|
events: {
|
|
|
|
query: FETCH_EVENTS,
|
|
|
|
},
|
|
|
|
},
|
2019-10-10 16:47:38 +02:00
|
|
|
metaInfo() {
|
|
|
|
return {
|
|
|
|
// if no subcomponents specify a metaInfo.title, this title will be used
|
2020-02-18 08:57:00 +01:00
|
|
|
title: this.$t("Explore") as string,
|
2019-10-10 16:47:38 +02:00
|
|
|
// all titles will be injected into this template
|
2020-02-18 08:57:00 +01:00
|
|
|
titleTemplate: "%s | Mobilizon",
|
2019-10-10 16:47:38 +02:00
|
|
|
};
|
|
|
|
},
|
2019-09-20 19:43:29 +02:00
|
|
|
})
|
|
|
|
export default class Explore extends Vue {
|
|
|
|
events: IEvent[] = [];
|
2020-02-18 08:57:00 +01:00
|
|
|
|
|
|
|
searchTerm = "";
|
2019-10-09 18:51:55 +02:00
|
|
|
|
|
|
|
submit() {
|
2020-02-18 08:57:00 +01:00
|
|
|
this.$router.push({
|
|
|
|
name: RouteName.SEARCH,
|
|
|
|
params: { searchTerm: this.searchTerm },
|
|
|
|
});
|
2019-10-09 18:51:55 +02:00
|
|
|
}
|
2019-09-20 19:43:29 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2019-10-09 18:51:55 +02:00
|
|
|
<style scoped lang="scss">
|
2020-02-18 08:57:00 +01:00
|
|
|
@import "@/variables.scss";
|
2019-12-20 13:04:34 +01:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
main > .container {
|
|
|
|
background: $white;
|
2019-12-20 13:04:34 +01:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
.hero-body {
|
|
|
|
padding: 1rem 1.5rem;
|
2019-12-20 13:04:34 +01:00
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-12-20 13:04:34 +01:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
h1.title {
|
|
|
|
margin-top: 1.5rem;
|
|
|
|
}
|
2019-10-10 13:50:23 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
h3.title {
|
|
|
|
margin-bottom: 1.5rem;
|
|
|
|
}
|
2019-10-09 18:51:55 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
.events-featured {
|
|
|
|
margin: 25px auto;
|
2019-10-09 18:51:55 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
.columns {
|
|
|
|
margin: 1rem auto 3rem;
|
|
|
|
}
|
2019-10-09 18:51:55 +02:00
|
|
|
}
|
2019-09-20 19:43:29 +02:00
|
|
|
</style>
|