2016-10-10 10:57:39 +02:00
|
|
|
<template>
|
|
|
|
<header>
|
|
|
|
<div class="wrap">
|
|
|
|
<router-link to="/" class="logo" >
|
|
|
|
<img src="../../../public/assets/img/logo.png" alt="Flox" width="108" height="32">
|
|
|
|
</router-link>
|
|
|
|
|
|
|
|
<span class="sort-wrap">
|
2016-11-23 21:16:41 +01:00
|
|
|
<i :title="lang('last seen')" class="icon-sort-time" :class="{active: userFilter == 'created_at'}" @click="setUserFilter('created_at')"></i>
|
|
|
|
<i :title="lang('best rated')" class="icon-sort-star" :class="{active: userFilter == 'rating'}" @click="setUserFilter('rating')"></i>
|
|
|
|
<span :title="lang('change color')" class="icon-constrast" @click="toggleColorScheme()"><i></i></span>
|
2016-10-10 10:57:39 +02:00
|
|
|
</span>
|
|
|
|
|
2016-10-14 12:15:54 +02:00
|
|
|
<nav class="site-nav">
|
|
|
|
<ul>
|
2016-11-23 21:16:41 +01:00
|
|
|
<li><router-link to="/trending">{{ lang('trending') }}</router-link></li>
|
|
|
|
<li><router-link to="/upcoming">{{ lang('upcoming') }}</router-link></li>
|
2016-10-14 12:15:54 +02:00
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
|
2016-10-10 10:57:39 +02:00
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2016-11-23 21:16:41 +01:00
|
|
|
import Helper from '../helper';
|
2016-10-10 10:57:39 +02:00
|
|
|
import store from '../store/index';
|
|
|
|
import { mapActions, mapMutations, mapState } from 'vuex'
|
|
|
|
|
|
|
|
export default {
|
2016-11-23 21:16:41 +01:00
|
|
|
mixins: [Helper],
|
|
|
|
|
2016-10-10 10:57:39 +02:00
|
|
|
created() {
|
|
|
|
this.checkForUserFilter();
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
...mapState({
|
|
|
|
userFilter: state => state.userFilter,
|
|
|
|
colorScheme: state => state.colorScheme
|
|
|
|
}),
|
|
|
|
root() {
|
|
|
|
return config.uri;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
...mapActions([ 'setColorScheme', 'loadItems' ]),
|
|
|
|
...mapMutations([ 'SET_USER_FILTER' ]),
|
|
|
|
|
|
|
|
toggleColorScheme() {
|
|
|
|
const color = this.colorScheme == 'light' ? 'dark' : 'light';
|
|
|
|
|
|
|
|
this.setColorScheme(color);
|
|
|
|
},
|
|
|
|
|
|
|
|
checkForUserFilter() {
|
|
|
|
if( ! localStorage.getItem('filter')) {
|
|
|
|
localStorage.setItem('filter', 'created_at');
|
|
|
|
}
|
|
|
|
|
|
|
|
this.SET_USER_FILTER(localStorage.getItem('filter'));
|
|
|
|
},
|
|
|
|
|
|
|
|
setUserFilter(type) {
|
|
|
|
localStorage.setItem('filter', type);
|
|
|
|
this.SET_USER_FILTER(type);
|
|
|
|
this.loadItems(type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|