2019-09-20 19:43:29 +02:00
|
|
|
<template>
|
2019-10-09 18:51:55 +02:00
|
|
|
<div class="container">
|
2019-09-20 19:43:29 +02: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()">
|
2019-10-09 18:51:55 +02:00
|
|
|
<b-field :label="$t('Event')" grouped label-position="on-border">
|
|
|
|
<b-input icon="magnify" type="search" size="is-large" expanded v-model="searchTerm" :placeholder="$t('For instance: London, Taekwondo, Architecture…')" />
|
|
|
|
<p class="control">
|
|
|
|
<b-button @click="submit" type="is-info" size="is-large">{{ $t('Search') }}</b-button>
|
|
|
|
</p>
|
|
|
|
</b-field>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<section class="events-featured">
|
|
|
|
<b-loading :active.sync="$apollo.loading"></b-loading>
|
|
|
|
<h3 class="title">{{ $t('Featured events') }}</h3>
|
|
|
|
<div v-if="events.length > 0" class="columns is-multiline">
|
|
|
|
<div class="column is-one-quarter-desktop" v-for="event in events" :key="event.uuid">
|
|
|
|
<EventCard
|
|
|
|
:event="event"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<b-message v-else-if="events.length === 0 && $apollo.loading === false" type="is-danger">
|
|
|
|
{{ $t('No events found') }}
|
|
|
|
</b-message>
|
|
|
|
</section>
|
|
|
|
</div>
|
2019-09-20 19:43:29 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
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';
|
2019-10-09 18:51:55 +02:00
|
|
|
import { RouteName } from '@/router';
|
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
|
|
|
|
title: this.$t('Explore') as string,
|
|
|
|
// all titles will be injected into this template
|
|
|
|
titleTemplate: '%s | Mobilizon',
|
|
|
|
};
|
|
|
|
},
|
2019-09-20 19:43:29 +02:00
|
|
|
})
|
|
|
|
export default class Explore extends Vue {
|
|
|
|
events: IEvent[] = [];
|
2019-10-09 18:51:55 +02:00
|
|
|
searchTerm: string = '';
|
|
|
|
|
|
|
|
submit() {
|
|
|
|
this.$router.push({ name: RouteName.SEARCH, params: { searchTerm: this.searchTerm } });
|
|
|
|
}
|
2019-09-20 19:43:29 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2019-10-09 18:51:55 +02:00
|
|
|
<style scoped lang="scss">
|
2019-10-10 13:50:23 +02:00
|
|
|
h1.title {
|
|
|
|
margin-top: 1.5rem;
|
|
|
|
}
|
|
|
|
|
2019-10-09 18:51:55 +02:00
|
|
|
h3.title {
|
|
|
|
margin-bottom: 1.5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.events-featured {
|
|
|
|
margin: 25px auto;
|
|
|
|
|
|
|
|
.columns {
|
|
|
|
margin: 1rem auto 3rem;
|
|
|
|
}
|
|
|
|
}
|
2019-09-20 19:43:29 +02:00
|
|
|
</style>
|