2018-10-25 06:33:15 +00:00
|
|
|
import Vue from 'vue';
|
2018-10-19 05:15:28 +00:00
|
|
|
|
|
|
|
export default {
|
2020-08-18 18:56:10 +00:00
|
|
|
SET_BOARDS(state, boards) {
|
|
|
|
state.boards = boards;
|
|
|
|
},
|
|
|
|
|
2020-08-18 22:01:16 +00:00
|
|
|
SET_BOARD(state, board) {
|
|
|
|
state.board = board;
|
|
|
|
},
|
|
|
|
|
2020-08-18 18:56:10 +00:00
|
|
|
SET_GAME_BOARD(state, board) {
|
|
|
|
state.board = board;
|
|
|
|
},
|
|
|
|
|
|
|
|
SET_BOARD_GAMES(state, boardGames) {
|
|
|
|
state.boardGames = boardGames;
|
|
|
|
},
|
|
|
|
|
|
|
|
ADD_BOARD(state, board) {
|
|
|
|
state.boards.push(board);
|
|
|
|
},
|
|
|
|
|
2020-08-21 06:13:45 +00:00
|
|
|
ADD_LIST(state, list) {
|
|
|
|
state.board.lists.push(list);
|
|
|
|
},
|
|
|
|
|
2020-08-18 18:56:10 +00:00
|
|
|
REMOVE_BOARD(state, boardId) {
|
|
|
|
const boardIndex = state.boards.findIndex(({ id }) => id === boardId);
|
|
|
|
|
|
|
|
state.boards.splice(boardIndex, 1);
|
|
|
|
},
|
|
|
|
|
2020-08-15 00:02:34 +00:00
|
|
|
SET_GAME_MODAL_DATA(state, gameModalData) {
|
|
|
|
state.gameModalData = gameModalData;
|
|
|
|
},
|
|
|
|
|
|
|
|
CLEAR_GAME_MODAL_DATA(state) {
|
|
|
|
state.gameModalData = null;
|
|
|
|
},
|
|
|
|
|
2020-08-21 06:13:45 +00:00
|
|
|
ADD_GAME_TO_LIST({ board }, { listIndex, gameId }) {
|
|
|
|
board.lists[listIndex].games.push(gameId);
|
|
|
|
},
|
|
|
|
|
2020-08-21 06:49:49 +00:00
|
|
|
REMOVE_LIST(state, index) {
|
|
|
|
state.board.lists.splice(index, 1);
|
|
|
|
},
|
|
|
|
|
|
|
|
MOVE_LIST(state, { from, to }) {
|
|
|
|
const cutOut = state.board.lists.splice(from, 1)[0];
|
|
|
|
|
|
|
|
state.board.lists.splice(to, 0, cutOut);
|
|
|
|
},
|
|
|
|
|
|
|
|
SET_LIST_SORT_ORDER(state, { listIndex, sortOrder }) {
|
|
|
|
Vue.set(state.board.lists[listIndex].settings, 'sortOrder', sortOrder);
|
|
|
|
},
|
|
|
|
|
2020-08-18 22:01:16 +00:00
|
|
|
//
|
|
|
|
// LEGACY STUFF
|
|
|
|
//
|
|
|
|
|
|
|
|
ADD_LIST_LEGACY(state, list) {
|
|
|
|
if (!state.gameLists[state.platform.code]) {
|
|
|
|
Vue.set(state.gameLists, state.platform.code, []);
|
|
|
|
}
|
|
|
|
|
|
|
|
state.gameLists[state.platform.code].push(list);
|
|
|
|
},
|
|
|
|
|
|
|
|
SET_PLATFORM_LEGACY(state, platform) {
|
|
|
|
state.platform = platform;
|
|
|
|
},
|
|
|
|
|
|
|
|
SAVE_LIST_LEGACY(state, lists) {
|
|
|
|
state.gameLists = lists;
|
|
|
|
},
|
|
|
|
|
|
|
|
REMOVE_GAME_LEGACY(state, { gameId, listId }) {
|
|
|
|
const currentList = state.gameLists[state.platform.code][listId];
|
|
|
|
|
|
|
|
currentList.games.splice(currentList.games.indexOf(gameId), 1);
|
|
|
|
},
|
|
|
|
|
|
|
|
MOVE_LIST_LEGACY(state, { from, to }) {
|
|
|
|
const cutOut = state.gameLists[state.platform.code].splice(from, 1)[0];
|
|
|
|
|
|
|
|
state.gameLists[state.platform.code].splice(to, 0, cutOut);
|
2019-11-08 19:56:03 +00:00
|
|
|
},
|
|
|
|
|
2020-08-18 22:01:16 +00:00
|
|
|
REMOVE_LIST_LEGACY(state, index) {
|
|
|
|
state.gameLists[state.platform.code].splice(index, 1);
|
|
|
|
},
|
|
|
|
|
|
|
|
REMOVE_PLATFORM_LEGACY(state) {
|
|
|
|
Vue.delete(state.gameLists, state.platform.code);
|
|
|
|
},
|
|
|
|
|
|
|
|
ADD_GAME_LEGACY(state, { gameId, listId }) {
|
|
|
|
const currentList = state.gameLists[state.platform.code][listId];
|
|
|
|
|
|
|
|
currentList.games.push(gameId);
|
|
|
|
},
|
|
|
|
|
|
|
|
SET_WALLPAPER_URL_LEGACY(state, url) {
|
2019-11-08 19:56:03 +00:00
|
|
|
state.wallpaperUrl = url;
|
|
|
|
},
|
|
|
|
|
2020-08-18 22:01:16 +00:00
|
|
|
SET_GAME_LISTS_LEGACY(state, lists) {
|
|
|
|
state.gameLists = lists;
|
|
|
|
},
|
|
|
|
|
|
|
|
//
|
|
|
|
// STUFF THAT REMAINS THE SAME
|
|
|
|
//
|
|
|
|
SET_USER(state, data) {
|
|
|
|
state.user = {
|
|
|
|
lastLogin: data.metadata.lastSignInTime,
|
|
|
|
uid: data.uid,
|
|
|
|
displayName: data.displayName,
|
|
|
|
email: data.email,
|
|
|
|
emailVerified: data.emailVerified,
|
|
|
|
dateJoined: data.metadata.creationTime,
|
|
|
|
photoURL: data.photoURL,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
CACHE_GAME_DATA(state, data) {
|
|
|
|
data.forEach((game) => {
|
|
|
|
Vue.set(state.games, game.id, { ...game });
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
SET_SETTINGS(state, settings) {
|
|
|
|
state.settings = settings;
|
|
|
|
},
|
|
|
|
|
2019-11-08 19:56:03 +00:00
|
|
|
UPDATE_TAG(state, { tagName, tagHex, tempTag }) {
|
|
|
|
const updatedTag = {
|
|
|
|
...state.tags[tempTag.tagName],
|
|
|
|
hex: tagHex,
|
|
|
|
};
|
|
|
|
|
|
|
|
const renaming = tagName !== tempTag.tagName;
|
|
|
|
|
|
|
|
if (renaming) {
|
|
|
|
Vue.set(state.tags, tagName, updatedTag);
|
|
|
|
Vue.delete(state.tags, tempTag.tagName);
|
|
|
|
} else {
|
|
|
|
state.tags[tempTag.tagName] = updatedTag;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
SET_TAGS(state, tags) {
|
|
|
|
state.tags = tags;
|
|
|
|
},
|
|
|
|
|
2020-08-18 22:01:16 +00:00
|
|
|
CLEAR_SESSION(state) {
|
|
|
|
state.user = null;
|
|
|
|
state.activeListIndex = null;
|
|
|
|
state.gameLists = {};
|
|
|
|
state.settings = null;
|
|
|
|
state.platform = null;
|
|
|
|
state.results = null;
|
|
|
|
state.games = {};
|
|
|
|
state.publicGameData = {};
|
|
|
|
state.game = null;
|
2019-12-16 19:05:52 +00:00
|
|
|
},
|
|
|
|
|
2019-11-08 19:56:03 +00:00
|
|
|
SET_NOTES(state, notes) {
|
|
|
|
state.notes = notes;
|
|
|
|
},
|
|
|
|
|
2019-12-17 05:05:35 +00:00
|
|
|
SET_PROGRESSES(state, progresses) {
|
|
|
|
state.progresses = progresses;
|
|
|
|
},
|
|
|
|
|
2020-08-15 20:41:43 +00:00
|
|
|
REMOVE_GAME_PROGRESS({ progresses }, gameId) {
|
|
|
|
if (progresses[gameId]) {
|
|
|
|
Vue.delete(progresses, gameId);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
SET_GAME_PROGRESS(state, { progress, gameId }) {
|
|
|
|
state.progresses[gameId] = progress;
|
|
|
|
},
|
2019-12-18 05:47:35 +00:00
|
|
|
|
2020-08-15 22:39:22 +00:00
|
|
|
SET_GAME_NOTE(state, { note, gameId }) {
|
|
|
|
state.notes[gameId] = note;
|
2019-12-18 23:03:57 +00:00
|
|
|
},
|
|
|
|
|
2020-08-18 22:01:16 +00:00
|
|
|
SET_DRAGGING_STATUS(state, status) {
|
|
|
|
state.dragging = status;
|
|
|
|
},
|
|
|
|
|
2020-08-15 22:39:22 +00:00
|
|
|
REMOVE_GAME_NOTE(state, gameId) {
|
|
|
|
if (state.notes[gameId]) {
|
|
|
|
Vue.delete(state.notes, gameId);
|
2019-12-18 23:03:57 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-11-08 19:56:03 +00:00
|
|
|
ADD_GAME_TAG(state, { tagName, gameId }) {
|
|
|
|
state.tags[tagName].games.push(gameId);
|
|
|
|
},
|
|
|
|
|
|
|
|
REMOVE_GAME_TAG(state, { tagName, gameId }) {
|
|
|
|
state.tags[tagName].games.splice(state.tags[tagName].games.indexOf(gameId), 1);
|
|
|
|
},
|
|
|
|
|
|
|
|
SET_SEARCH_RESULTS(state, results) {
|
|
|
|
state.results = results;
|
|
|
|
},
|
|
|
|
|
|
|
|
CLEAR_SEARCH_RESULTS(state) {
|
|
|
|
state.results = [];
|
|
|
|
},
|
|
|
|
|
2019-12-13 06:53:37 +00:00
|
|
|
UPDATE_SETTING(state, { key, value }) {
|
|
|
|
state.settings[key] = value;
|
|
|
|
},
|
2018-10-19 05:15:28 +00:00
|
|
|
};
|