2018-09-04 02:09:56 +09:00
|
|
|
<template>
|
|
|
|
<div class="csqvmxybqbycalfhkxvyfrgbrdalkaoc">
|
2018-11-13 22:45:28 +09:00
|
|
|
<p class="fetching" v-if="fetching"><fa icon="spinner" pulse fixed-width/>{{ $t('@.loading') }}<mk-ellipsis/></p>
|
2018-11-09 03:44:35 +09:00
|
|
|
<p class="empty" v-else-if="stats.length == 0"><fa icon="exclamation-circle"/>{{ $t('empty') }}</p>
|
2018-09-04 02:09:56 +09:00
|
|
|
<!-- トランジションを有効にするとなぜかメモリリークする -->
|
2018-09-16 03:46:53 +09:00
|
|
|
<transition-group v-else tag="div" name="chart">
|
2019-04-07 21:50:36 +09:00
|
|
|
<div v-for="stat in stats" :key="stat.name">
|
2018-09-04 02:09:56 +09:00
|
|
|
<div class="tag">
|
2019-04-07 21:50:36 +09:00
|
|
|
<router-link :to="`/tags/${ encodeURIComponent(stat.name) }`" :title="stat.name">#{{ stat.name }}</router-link>
|
2018-11-09 21:42:36 +09:00
|
|
|
<p>{{ $t('count').replace('{}', stat.usersCount) }}</p>
|
2018-09-04 02:09:56 +09:00
|
|
|
</div>
|
|
|
|
<x-chart class="chart" :src="stat.chart"/>
|
|
|
|
</div>
|
2018-09-16 03:46:53 +09:00
|
|
|
</transition-group>
|
2018-09-04 02:09:56 +09:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-11-09 03:44:35 +09:00
|
|
|
import i18n from '../../../i18n';
|
2018-09-04 02:09:56 +09:00
|
|
|
import XChart from './trends.chart.vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-11-09 03:44:35 +09:00
|
|
|
i18n: i18n('common/views/components/trends.vue'),
|
2018-09-04 02:09:56 +09:00
|
|
|
components: {
|
|
|
|
XChart
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
stats: [],
|
|
|
|
fetching: true,
|
|
|
|
clock: null
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.fetch();
|
|
|
|
this.clock = setInterval(this.fetch, 1000 * 60);
|
|
|
|
},
|
|
|
|
beforeDestroy() {
|
|
|
|
clearInterval(this.clock);
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
fetch() {
|
2018-11-09 08:13:34 +09:00
|
|
|
this.$root.api('hashtags/trend').then(stats => {
|
2018-09-04 02:09:56 +09:00
|
|
|
this.stats = stats;
|
|
|
|
this.fetching = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-09-28 19:59:19 +09:00
|
|
|
.csqvmxybqbycalfhkxvyfrgbrdalkaoc
|
2018-09-04 02:09:56 +09:00
|
|
|
> .fetching
|
|
|
|
> .empty
|
|
|
|
margin 0
|
|
|
|
padding 16px
|
|
|
|
text-align center
|
2018-09-28 19:59:19 +09:00
|
|
|
color var(--text)
|
|
|
|
opacity 0.7
|
2018-09-04 02:09:56 +09:00
|
|
|
|
2018-11-06 01:40:11 +09:00
|
|
|
> [data-icon]
|
2018-09-04 02:09:56 +09:00
|
|
|
margin-right 4px
|
|
|
|
|
|
|
|
> div
|
|
|
|
.chart-move
|
|
|
|
transition transform 1s ease
|
|
|
|
|
|
|
|
> div
|
|
|
|
display flex
|
|
|
|
align-items center
|
|
|
|
padding 14px 16px
|
|
|
|
|
|
|
|
&:not(:last-child)
|
2018-09-28 19:59:19 +09:00
|
|
|
border-bottom solid 1px var(--faceDivider)
|
2018-09-04 02:09:56 +09:00
|
|
|
|
|
|
|
> .tag
|
|
|
|
flex 1
|
|
|
|
overflow hidden
|
|
|
|
font-size 14px
|
2018-09-28 19:59:19 +09:00
|
|
|
color var(--text)
|
2018-09-04 02:09:56 +09:00
|
|
|
|
|
|
|
> a
|
|
|
|
display block
|
|
|
|
width 100%
|
|
|
|
white-space nowrap
|
|
|
|
overflow hidden
|
|
|
|
text-overflow ellipsis
|
|
|
|
color inherit
|
|
|
|
|
|
|
|
> p
|
|
|
|
margin 0
|
|
|
|
font-size 75%
|
|
|
|
opacity 0.7
|
|
|
|
|
|
|
|
> .chart
|
|
|
|
height 30px
|
|
|
|
|
|
|
|
</style>
|