From caabdc68f313fb775167b62c941b81463a7a541f Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 8 Jun 2018 04:34:15 +0900 Subject: [PATCH] =?UTF-8?q?MisskeyDeck:=20=E3=82=B9=E3=82=BF=E3=83=83?= =?UTF-8?q?=E3=82=AF=E3=81=97=E3=81=9F=E3=82=AB=E3=83=A9=E3=83=A0=E3=82=92?= =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E7=A7=BB=E5=8B=95=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/ja.yml | 2 + .../app/common/views/components/menu.vue | 4 +- .../desktop/views/pages/deck/deck.column.vue | 16 ++++++-- src/client/app/store.ts | 38 +++++++++++++++++++ 4 files changed, 55 insertions(+), 5 deletions(-) diff --git a/locales/ja.yml b/locales/ja.yml index 3161040ec..120ccc799 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -85,6 +85,8 @@ common: list: "リスト" swap-left: "左に移動" swap-right: "右に移動" + swap-up: "上に移動" + swap-down: "下に移動" remove: "カラムを削除" add-column: "カラムを追加" rename: "名前を変更" diff --git a/src/client/app/common/views/components/menu.vue b/src/client/app/common/views/components/menu.vue index 8874e4c49..f1e23df00 100644 --- a/src/client/app/common/views/components/menu.vue +++ b/src/client/app/common/views/components/menu.vue @@ -3,8 +3,8 @@
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 172880df6..897181dd3 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 e78d941d8..e6c3863d7 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');