misskey/src/client/app/common/views/deck/deck.tl-column.vue

102 lines
2.3 KiB
Vue
Raw Normal View History

2018-06-05 22:54:03 +09:00
<template>
2018-06-08 07:43:12 +09:00
<x-column :menu="menu" :name="name" :column="column" :is-stacked="isStacked">
2019-02-18 11:13:56 +09:00
<template #header>
2018-11-16 05:53:17 +09:00
<fa v-if="column.type == 'home'" icon="home"/>
<fa v-if="column.type == 'local'" :icon="['far', 'comments']"/>
<fa v-if="column.type == 'hybrid'" icon="share-alt"/>
<fa v-if="column.type == 'global'" icon="globe"/>
<fa v-if="column.type == 'list'" icon="list"/>
<fa v-if="column.type == 'hashtag'" icon="hashtag"/>
<span>{{ name }}</span>
2019-02-18 09:48:00 +09:00
</template>
2018-06-06 05:18:08 +09:00
<div class="editor" style="padding:12px" v-if="edit">
<ui-switch v-model="column.isMediaOnly" @change="onChangeSettings">{{ $t('is-media-only') }}</ui-switch>
</div>
<x-list-tl v-if="column.type == 'list'"
:list="column.list"
:media-only="column.isMediaOnly"
ref="tl"
/>
<x-hashtag-tl v-else-if="column.type == 'hashtag'"
:tag-tl="$store.state.settings.tagTimelines.find(x => x.id == column.tagTlId)"
:media-only="column.isMediaOnly"
ref="tl"
/>
<x-tl v-else
:src="column.type"
:media-only="column.isMediaOnly"
ref="tl"
/>
</x-column>
2018-06-05 22:54:03 +09:00
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
2018-06-05 22:54:03 +09:00
import XColumn from './deck.column.vue';
import XTl from './deck.tl.vue';
2018-06-06 05:18:08 +09:00
import XListTl from './deck.list-tl.vue';
import XHashtagTl from './deck.hashtag-tl.vue';
2018-06-05 22:54:03 +09:00
export default Vue.extend({
i18n: i18n('deck/deck.tl-column.vue'),
2018-06-05 22:54:03 +09:00
components: {
XColumn,
2018-06-06 05:18:08 +09:00
XTl,
XListTl,
XHashtagTl
2018-06-05 22:54:03 +09:00
},
2018-06-08 05:48:27 +09:00
props: {
column: {
type: Object,
required: true
},
isStacked: {
type: Boolean,
required: true
}
},
2018-06-07 06:13:57 +09:00
data() {
return {
edit: false,
menu: [{
icon: 'cog',
text: this.$t('edit'),
2018-06-08 11:46:45 +09:00
action: () => {
2018-06-07 06:13:57 +09:00
this.edit = !this.edit;
}
}]
}
},
computed: {
name(): string {
if (this.column.name) return this.column.name;
switch (this.column.type) {
case 'home': return this.$t('@deck.home');
case 'local': return this.$t('@deck.local');
case 'hybrid': return this.$t('@deck.hybrid');
case 'global': return this.$t('@deck.global');
2018-06-07 06:13:57 +09:00
case 'list': return this.column.list.title;
case 'hashtag': return this.$store.state.settings.tagTimelines.find(x => x.id == this.column.tagTlId).title;
2018-06-07 06:13:57 +09:00
}
}
},
methods: {
onChangeSettings(v) {
this.$store.commit('device/updateDeckColumn', this.column);
},
focus() {
this.$refs.tl.focus();
2018-10-21 16:18:02 +09:00
}
2018-06-06 05:18:08 +09:00
}
2018-06-05 22:54:03 +09:00
});
</script>