2018-06-05 21:36:21 +09:00
|
|
|
<template>
|
|
|
|
<mk-ui :class="$style.root">
|
2018-10-19 06:47:55 +09:00
|
|
|
<div class="qlvquzbjribqcaozciifydkngcwtyzje" :style="style" :class="{ center: $store.state.device.deckColumnAlign == 'center' }">
|
2018-06-08 04:21:06 +09:00
|
|
|
<template v-for="ids in layout">
|
|
|
|
<div v-if="ids.length > 1" class="folder">
|
|
|
|
<template v-for="id, i in ids">
|
2018-06-08 07:43:12 +09:00
|
|
|
<x-column-core :ref="id" :key="id" :column="columns.find(c => c.id == id)" :is-stacked="true"/>
|
2018-06-08 04:21:06 +09:00
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
<x-column-core v-else :ref="ids[0]" :key="ids[0]" :column="columns.find(c => c.id == ids[0])"/>
|
2018-06-06 03:12:06 +09:00
|
|
|
</template>
|
2018-10-19 06:18:33 +09:00
|
|
|
<template v-if="temporaryColumn">
|
|
|
|
<x-user-column v-if="temporaryColumn.type == 'user'" :acct="temporaryColumn.acct" :key="temporaryColumn.acct"/>
|
|
|
|
<x-note-column v-else-if="temporaryColumn.type == 'note'" :note-id="temporaryColumn.noteId" :key="temporaryColumn.noteId"/>
|
|
|
|
</template>
|
2018-06-07 01:17:29 +09:00
|
|
|
<button ref="add" @click="add" title="%i18n:common.deck.add-column%">%fa:plus%</button>
|
2018-06-05 21:36:21 +09:00
|
|
|
</div>
|
|
|
|
</mk-ui>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-06-08 04:21:06 +09:00
|
|
|
import XColumnCore from './deck.column-core.vue';
|
2018-06-06 05:18:08 +09:00
|
|
|
import Menu from '../../../../common/views/components/menu.vue';
|
|
|
|
import MkUserListsWindow from '../../components/user-lists-window.vue';
|
2018-10-19 06:18:33 +09:00
|
|
|
import XUserColumn from './deck.user-column.vue';
|
|
|
|
import XNoteColumn from './deck.note-column.vue';
|
|
|
|
|
2018-06-06 03:12:06 +09:00
|
|
|
import * as uuid from 'uuid';
|
2018-06-05 21:36:21 +09:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
components: {
|
2018-10-19 06:18:33 +09:00
|
|
|
XColumnCore,
|
|
|
|
XUserColumn,
|
|
|
|
XNoteColumn
|
2018-06-06 03:12:06 +09:00
|
|
|
},
|
2018-06-07 01:00:38 +09:00
|
|
|
|
2018-06-06 03:12:06 +09:00
|
|
|
computed: {
|
2018-06-08 04:21:06 +09:00
|
|
|
columns(): any[] {
|
2018-06-06 03:12:06 +09:00
|
|
|
if (this.$store.state.settings.deck == null) return [];
|
|
|
|
return this.$store.state.settings.deck.columns;
|
2018-06-08 04:21:06 +09:00
|
|
|
},
|
2018-10-19 06:18:33 +09:00
|
|
|
|
2018-06-08 04:21:06 +09:00
|
|
|
layout(): any[] {
|
|
|
|
if (this.$store.state.settings.deck == null) return [];
|
|
|
|
if (this.$store.state.settings.deck.layout == null) return this.$store.state.settings.deck.columns.map(c => [c.id]);
|
|
|
|
return this.$store.state.settings.deck.layout;
|
2018-09-22 20:11:13 +09:00
|
|
|
},
|
2018-10-19 06:18:33 +09:00
|
|
|
|
2018-09-22 20:11:13 +09:00
|
|
|
style(): any {
|
|
|
|
return {
|
|
|
|
height: `calc(100vh - ${this.$store.state.uiHeaderHeight}px)`
|
|
|
|
};
|
2018-10-19 06:18:33 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
temporaryColumn(): any {
|
|
|
|
return this.$store.state.device.deckTemporaryColumn;
|
2018-06-06 03:12:06 +09:00
|
|
|
}
|
|
|
|
},
|
2018-06-07 01:00:38 +09:00
|
|
|
|
2018-06-08 04:21:06 +09:00
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
getColumnVm: this.getColumnVm
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2018-06-06 03:12:06 +09:00
|
|
|
created() {
|
2018-10-19 06:18:33 +09:00
|
|
|
this.$store.commit('navHook', this.onNav);
|
|
|
|
|
2018-06-06 03:12:06 +09:00
|
|
|
if (this.$store.state.settings.deck == null) {
|
|
|
|
const deck = {
|
|
|
|
columns: [/*{
|
|
|
|
type: 'widgets',
|
|
|
|
widgets: []
|
|
|
|
}, */{
|
|
|
|
id: uuid(),
|
|
|
|
type: 'home'
|
|
|
|
}, {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'notifications'
|
|
|
|
}, {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'local'
|
|
|
|
}, {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'global'
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
|
2018-06-08 04:21:06 +09:00
|
|
|
deck.layout = deck.columns.map(c => [c.id]);
|
|
|
|
|
2018-06-06 03:12:06 +09:00
|
|
|
this.$store.dispatch('settings/set', {
|
|
|
|
key: 'deck',
|
|
|
|
value: deck
|
|
|
|
});
|
|
|
|
}
|
2018-06-08 04:21:06 +09:00
|
|
|
|
|
|
|
// 互換性のため
|
|
|
|
if (this.$store.state.settings.deck != null && this.$store.state.settings.deck.layout == null) {
|
|
|
|
this.$store.dispatch('settings/set', {
|
|
|
|
key: 'deck',
|
|
|
|
value: Object.assign({}, this.$store.state.settings.deck, {
|
|
|
|
layout: this.$store.state.settings.deck.columns.map(c => [c.id])
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
2018-06-06 05:18:08 +09:00
|
|
|
},
|
|
|
|
|
2018-06-07 01:00:38 +09:00
|
|
|
mounted() {
|
2018-09-08 21:44:28 +09:00
|
|
|
document.title = (this as any).os.instanceName;
|
2018-06-07 01:00:38 +09:00
|
|
|
document.documentElement.style.overflow = 'hidden';
|
|
|
|
},
|
|
|
|
|
|
|
|
beforeDestroy() {
|
2018-10-19 06:18:33 +09:00
|
|
|
this.$store.commit('navHook', null);
|
|
|
|
|
2018-06-07 01:00:38 +09:00
|
|
|
document.documentElement.style.overflow = 'auto';
|
|
|
|
},
|
|
|
|
|
2018-06-06 05:18:08 +09:00
|
|
|
methods: {
|
2018-06-08 04:21:06 +09:00
|
|
|
getColumnVm(id) {
|
|
|
|
return this.$refs[id][0];
|
|
|
|
},
|
|
|
|
|
2018-10-19 06:18:33 +09:00
|
|
|
onNav(to) {
|
|
|
|
if (!this.$store.state.settings.deckNav) return false;
|
|
|
|
|
|
|
|
if (to.name == 'user') {
|
|
|
|
this.$store.commit('device/set', {
|
|
|
|
key: 'deckTemporaryColumn',
|
|
|
|
value: {
|
|
|
|
type: 'user',
|
|
|
|
acct: to.params.user
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return true;
|
|
|
|
} else if (to.name == 'note') {
|
|
|
|
this.$store.commit('device/set', {
|
|
|
|
key: 'deckTemporaryColumn',
|
|
|
|
value: {
|
|
|
|
type: 'note',
|
|
|
|
noteId: to.params.note
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-06-06 05:18:08 +09:00
|
|
|
add() {
|
|
|
|
this.os.new(Menu, {
|
|
|
|
source: this.$refs.add,
|
|
|
|
compact: true,
|
|
|
|
items: [{
|
2018-06-08 11:46:45 +09:00
|
|
|
icon: '%fa:home%',
|
|
|
|
text: '%i18n:common.deck.home%',
|
|
|
|
action: () => {
|
2018-06-06 05:18:08 +09:00
|
|
|
this.$store.dispatch('settings/addDeckColumn', {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'home'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}, {
|
2018-06-08 11:46:45 +09:00
|
|
|
icon: '%fa:comments R%',
|
|
|
|
text: '%i18n:common.deck.local%',
|
|
|
|
action: () => {
|
2018-06-06 05:18:08 +09:00
|
|
|
this.$store.dispatch('settings/addDeckColumn', {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'local'
|
|
|
|
});
|
|
|
|
}
|
2018-07-11 13:43:09 +09:00
|
|
|
}, {
|
|
|
|
icon: '%fa:share-alt%',
|
|
|
|
text: '%i18n:common.deck.hybrid%',
|
|
|
|
action: () => {
|
|
|
|
this.$store.dispatch('settings/addDeckColumn', {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'hybrid'
|
|
|
|
});
|
|
|
|
}
|
2018-06-06 05:18:08 +09:00
|
|
|
}, {
|
2018-06-08 11:46:45 +09:00
|
|
|
icon: '%fa:globe%',
|
|
|
|
text: '%i18n:common.deck.global%',
|
|
|
|
action: () => {
|
2018-06-06 05:18:08 +09:00
|
|
|
this.$store.dispatch('settings/addDeckColumn', {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'global'
|
|
|
|
});
|
|
|
|
}
|
2018-09-16 23:15:02 +09:00
|
|
|
}, {
|
|
|
|
icon: '%fa:at%',
|
|
|
|
text: '%i18n:common.deck.mentions%',
|
|
|
|
action: () => {
|
|
|
|
this.$store.dispatch('settings/addDeckColumn', {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'mentions'
|
|
|
|
});
|
|
|
|
}
|
2018-09-18 02:14:12 +09:00
|
|
|
}, {
|
|
|
|
icon: '%fa:envelope R%',
|
|
|
|
text: '%i18n:common.deck.direct%',
|
|
|
|
action: () => {
|
|
|
|
this.$store.dispatch('settings/addDeckColumn', {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'direct'
|
|
|
|
});
|
|
|
|
}
|
2018-06-06 05:18:08 +09:00
|
|
|
}, {
|
2018-06-08 11:46:45 +09:00
|
|
|
icon: '%fa:list%',
|
|
|
|
text: '%i18n:common.deck.list%',
|
|
|
|
action: () => {
|
2018-06-06 05:18:08 +09:00
|
|
|
const w = (this as any).os.new(MkUserListsWindow);
|
|
|
|
w.$once('choosen', list => {
|
|
|
|
this.$store.dispatch('settings/addDeckColumn', {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'list',
|
|
|
|
list: list
|
|
|
|
});
|
|
|
|
w.close();
|
|
|
|
});
|
|
|
|
}
|
2018-09-17 09:00:20 +09:00
|
|
|
}, {
|
|
|
|
icon: '%fa:hashtag%',
|
|
|
|
text: '%i18n:common.deck.hashtag%',
|
|
|
|
action: () => {
|
|
|
|
(this as any).apis.input({
|
|
|
|
title: '%i18n:@enter-hashtag-tl-title%'
|
|
|
|
}).then(title => {
|
|
|
|
this.$store.dispatch('settings/addDeckColumn', {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'hashtag',
|
|
|
|
tagTlId: this.$store.state.settings.tagTimelines.find(x => x.title == title).id
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2018-06-06 05:18:08 +09:00
|
|
|
}, {
|
2018-06-08 11:46:45 +09:00
|
|
|
icon: '%fa:bell R%',
|
|
|
|
text: '%i18n:common.deck.notifications%',
|
|
|
|
action: () => {
|
2018-06-06 05:18:08 +09:00
|
|
|
this.$store.dispatch('settings/addDeckColumn', {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'notifications'
|
|
|
|
});
|
|
|
|
}
|
2018-06-06 19:22:45 +09:00
|
|
|
}, {
|
2018-06-08 11:46:45 +09:00
|
|
|
icon: '%fa:calculator%',
|
|
|
|
text: '%i18n:common.deck.widgets%',
|
|
|
|
action: () => {
|
2018-06-06 19:22:45 +09:00
|
|
|
this.$store.dispatch('settings/addDeckColumn', {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'widgets',
|
|
|
|
widgets: []
|
|
|
|
});
|
|
|
|
}
|
2018-06-06 05:18:08 +09:00
|
|
|
}]
|
|
|
|
});
|
|
|
|
}
|
2018-06-05 21:36:21 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" module>
|
|
|
|
.root
|
|
|
|
height 100vh
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-09-28 15:34:34 +09:00
|
|
|
.qlvquzbjribqcaozciifydkngcwtyzje
|
2018-06-05 21:36:21 +09:00
|
|
|
display flex
|
|
|
|
flex 1
|
2018-06-05 21:44:02 +09:00
|
|
|
padding 16px 0 16px 16px
|
|
|
|
overflow auto
|
2018-06-05 21:36:21 +09:00
|
|
|
|
2018-06-06 04:00:48 +09:00
|
|
|
> div
|
2018-06-07 01:17:29 +09:00
|
|
|
margin-right 8px
|
2018-06-06 04:00:48 +09:00
|
|
|
|
|
|
|
&:last-of-type
|
|
|
|
margin-right 0
|
|
|
|
|
2018-06-08 04:21:06 +09:00
|
|
|
&.folder
|
|
|
|
display flex
|
|
|
|
flex-direction column
|
|
|
|
|
|
|
|
> *:not(:last-child)
|
|
|
|
margin-bottom 8px
|
|
|
|
|
2018-10-19 06:47:55 +09:00
|
|
|
&.center
|
|
|
|
> *
|
|
|
|
&:first-child
|
|
|
|
margin-left auto
|
2018-06-07 05:14:37 +09:00
|
|
|
|
2018-10-19 06:47:55 +09:00
|
|
|
&:last-child
|
|
|
|
margin-right auto
|
2018-06-07 05:14:37 +09:00
|
|
|
|
2018-06-06 04:00:48 +09:00
|
|
|
> button
|
|
|
|
padding 0 16px
|
2018-09-28 15:34:34 +09:00
|
|
|
color var(--faceTextButton)
|
2018-06-06 04:00:48 +09:00
|
|
|
|
|
|
|
&:hover
|
2018-09-28 15:34:34 +09:00
|
|
|
color var(--faceTextButtonHover)
|
2018-06-06 04:00:48 +09:00
|
|
|
|
|
|
|
&:active
|
2018-09-28 15:34:34 +09:00
|
|
|
color var(--faceTextButtonActive)
|
2018-06-05 21:36:21 +09:00
|
|
|
|
|
|
|
</style>
|