summaryrefslogtreecommitdiff
path: root/src/client/app/store.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-06-06 05:18:08 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-06-06 05:18:08 +0900
commit69b5de3346377ef2b7e5786e078d870717277084 (patch)
treeab30dfac17c3dba53ccfeda11ded39f150257b09 /src/client/app/store.ts
parentwip (diff)
downloadmisskey-69b5de3346377ef2b7e5786e078d870717277084.tar.gz
misskey-69b5de3346377ef2b7e5786e078d870717277084.tar.bz2
misskey-69b5de3346377ef2b7e5786e078d870717277084.zip
wip
Diffstat (limited to 'src/client/app/store.ts')
-rw-r--r--src/client/app/store.ts74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/client/app/store.ts b/src/client/app/store.ts
index 7795c9477a..17faeb97e5 100644
--- a/src/client/app/store.ts
+++ b/src/client/app/store.ts
@@ -152,6 +152,44 @@ export default (os: MiOS) => new Vuex.Store({
removeMobileHomeWidget(state, widget) {
state.mobileHome = state.mobileHome.filter(w => w.id != widget.id);
+ },
+
+ addDeckColumn(state, column) {
+ if (state.deck.columns == null) state.deck.columns = [];
+ state.deck.columns.push(column);
+ },
+
+ removeDeckColumn(state, id) {
+ if (state.deck.columns == null) return;
+ state.deck.columns = state.deck.columns.filter(c => c.id != id);
+ },
+
+ swapLeftDeckColumn(state, id) {
+ if (state.deck.columns == null) return;
+ state.deck.columns.some((c, i) => {
+ if (c.id == id) {
+ const left = state.deck.columns[i - 1];
+ if (left) {
+ state.deck.columns[i - 1] = state.deck.columns[i];
+ state.deck.columns[i] = left;
+ }
+ return true;
+ }
+ });
+ },
+
+ swapRightDeckColumn(state, id) {
+ if (state.deck.columns == null) return;
+ state.deck.columns.some((c, i) => {
+ if (c.id == id) {
+ const right = state.deck.columns[i + 1];
+ if (right) {
+ state.deck.columns[i + 1] = state.deck.columns[i];
+ state.deck.columns[i] = right;
+ }
+ return true;
+ }
+ });
}
},
@@ -174,6 +212,42 @@ export default (os: MiOS) => new Vuex.Store({
}
},
+ addDeckColumn(ctx, column) {
+ ctx.commit('addDeckColumn', column);
+
+ os.api('i/update_client_setting', {
+ name: 'deck',
+ value: ctx.state.deck
+ });
+ },
+
+ removeDeckColumn(ctx, id) {
+ ctx.commit('removeDeckColumn', id);
+
+ os.api('i/update_client_setting', {
+ name: 'deck',
+ value: ctx.state.deck
+ });
+ },
+
+ swapLeftDeckColumn(ctx, id) {
+ ctx.commit('swapLeftDeckColumn', id);
+
+ os.api('i/update_client_setting', {
+ name: 'deck',
+ value: ctx.state.deck
+ });
+ },
+
+ swapRightDeckColumn(ctx, id) {
+ ctx.commit('swapRightDeckColumn', id);
+
+ os.api('i/update_client_setting', {
+ name: 'deck',
+ value: ctx.state.deck
+ });
+ },
+
addHomeWidget(ctx, widget) {
ctx.commit('addHomeWidget', widget);