diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-06-08 04:34:15 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-06-08 04:34:15 +0900 |
| commit | caabdc68f313fb775167b62c941b81463a7a541f (patch) | |
| tree | 6e51b8f5bbd05b98b729df7b7a2014f464efdf43 /src | |
| parent | MisskeyDeck: カラムをスタックできるように (diff) | |
| download | misskey-caabdc68f313fb775167b62c941b81463a7a541f.tar.gz misskey-caabdc68f313fb775167b62c941b81463a7a541f.tar.bz2 misskey-caabdc68f313fb775167b62c941b81463a7a541f.zip | |
MisskeyDeck: スタックしたカラムを上下移動できるように
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/app/common/views/components/menu.vue | 4 | ||||
| -rw-r--r-- | src/client/app/desktop/views/pages/deck/deck.column.vue | 16 | ||||
| -rw-r--r-- | src/client/app/store.ts | 38 |
3 files changed, 53 insertions, 5 deletions
diff --git a/src/client/app/common/views/components/menu.vue b/src/client/app/common/views/components/menu.vue index 8874e4c49b..f1e23df007 100644 --- a/src/client/app/common/views/components/menu.vue +++ b/src/client/app/common/views/components/menu.vue @@ -3,8 +3,8 @@ <div class="backdrop" ref="backdrop" @click="close"></div> <div class="popover" :class="{ hukidasi }" ref="popover"> <template v-for="item in items"> - <div v-if="item == null"></div> - <button v-else @click="clicked(item.onClick)" v-html="item.content"></button> + <div v-if="item === null"></div> + <button v-if="item" @click="clicked(item.onClick)" v-html="item.content"></button> </template> </div> </div> diff --git a/src/client/app/desktop/views/pages/deck/deck.column.vue b/src/client/app/desktop/views/pages/deck/deck.column.vue index 172880df6e..897181dd37 100644 --- a/src/client/app/desktop/views/pages/deck/deck.column.vue +++ b/src/client/app/desktop/views/pages/deck/deck.column.vue @@ -111,17 +111,27 @@ export default Vue.extend({ onClick: () => { this.$store.dispatch('settings/swapRightDeckColumn', this.column.id); } - }, null, { + }, this.isStacked ? { + content: '%fa:arrow-up% %i18n:common.deck.swap-up%', + onClick: () => { + this.$store.dispatch('settings/swapUpDeckColumn', this.column.id); + } + } : undefined, this.isStacked ? { + content: '%fa:arrow-down% %i18n:common.deck.swap-down%', + onClick: () => { + this.$store.dispatch('settings/swapDownDeckColumn', this.column.id); + } + } : undefined, null, { content: '%fa:window-restore R% %i18n:common.deck.stack-left%', onClick: () => { this.$store.dispatch('settings/stackLeftDeckColumn', this.column.id); } - }, { + }, this.isStacked ? { content: '%fa:window-restore R% %i18n:common.deck.pop-right%', onClick: () => { this.$store.dispatch('settings/popRightDeckColumn', this.column.id); } - }, null, { + } : undefined, null, { content: '%fa:trash-alt R% %i18n:common.deck.remove%', onClick: () => { this.$store.dispatch('settings/removeDeckColumn', this.column.id); diff --git a/src/client/app/store.ts b/src/client/app/store.ts index e78d941d8c..e6c3863d7f 100644 --- a/src/client/app/store.ts +++ b/src/client/app/store.ts @@ -208,6 +208,34 @@ export default (os: MiOS) => new Vuex.Store({ }); }, + swapUpDeckColumn(state, id) { + const ids = state.deck.layout.find(ids => ids.indexOf(id) != -1); + ids.some((x, i) => { + if (x == id) { + const up = ids[i - 1]; + if (up) { + ids[i - 1] = id; + ids[i] = up; + } + return true; + } + }); + }, + + swapDownDeckColumn(state, id) { + const ids = state.deck.layout.find(ids => ids.indexOf(id) != -1); + ids.some((x, i) => { + if (x == id) { + const down = ids[i + 1]; + if (down) { + ids[i + 1] = id; + ids[i] = down; + } + return true; + } + }); + }, + stackLeftDeckColumn(state, id) { const i = state.deck.layout.findIndex(ids => ids.indexOf(id) != -1); state.deck.layout = state.deck.layout.map(ids => ids.filter(x => x != id)); @@ -288,6 +316,16 @@ export default (os: MiOS) => new Vuex.Store({ ctx.dispatch('saveDeck'); }, + swapUpDeckColumn(ctx, id) { + ctx.commit('swapUpDeckColumn', id); + ctx.dispatch('saveDeck'); + }, + + swapDownDeckColumn(ctx, id) { + ctx.commit('swapDownDeckColumn', id); + ctx.dispatch('saveDeck'); + }, + stackLeftDeckColumn(ctx, id) { ctx.commit('stackLeftDeckColumn', id); ctx.dispatch('saveDeck'); |