This commit is contained in:
Gamebrary 2020-09-09 13:38:52 -07:00
parent cc82bae241
commit f337948ff2
7 changed files with 33 additions and 92 deletions

View file

@ -17,7 +17,6 @@ import firebase from 'firebase/app';
import { mapState } from 'vuex';
import 'firebase/auth';
import 'firebase/firestore';
import 'firebase/storage';
// TODO: store in env vars
firebase.initializeApp({
@ -29,7 +28,6 @@ firebase.initializeApp({
messagingSenderId: '324529217902',
});
const storage = firebase.storage().ref();
const db = firebase.firestore();
export default {
@ -47,7 +45,7 @@ export default {
},
computed: {
...mapState(['user', 'platform', 'wallpaperUrl', 'settings']),
...mapState(['user', 'wallpaperUrl', 'settings']),
userId() {
return this.debugUserId || this.user.uid;
@ -60,18 +58,6 @@ export default {
},
},
watch: {
customWallpaper(value) {
if (value) {
if (this.platform) {
this.loadWallpaper();
}
} else {
this.$store.commit('SET_WALLPAPER_URL_LEGACY', '');
}
},
},
mounted() {
this.init();
},
@ -83,10 +69,6 @@ export default {
return;
}
if (this.customWallpaper) {
this.loadWallpaper();
}
firebase.auth().getRedirectResult().then(({ additionalUserInfo, user }) => {
if (additionalUserInfo && additionalUserInfo.isNewUser) {
this.$store.dispatch('SEND_WELCOME_EMAIL', additionalUserInfo);
@ -113,15 +95,6 @@ export default {
});
},
loadWallpaper() {
const wallpaperRef = this.customWallpaper;
this.$store.commit('SET_WALLPAPER_URL_LEGACY', '');
storage.child(wallpaperRef).getDownloadURL().then((url) => {
this.$store.commit('SET_WALLPAPER_URL_LEGACY', url);
});
},
loadWallpapers() {
this.$store.dispatch('LOAD_WALLPAPERS')
.catch(() => {

View file

@ -20,7 +20,10 @@
>
<b-row no-gutters>
<b-col md="3">
<b-card-img :src="getWallpaper(board)" alt="Image" class="rounded-0" />
<b-card-img
:src="getWallpaper(board)"
:alt="board.name"
/>
</b-col>
<b-col md="9" >
@ -32,7 +35,7 @@
<b-avatar-group
v-if="Object.keys(platformNames).length"
size="lg"
variant="light"
variant="dark"
>
<b-avatar :src="getPlatformImage(id)"
v-for="id in board.platforms"
@ -55,7 +58,7 @@
@click="openDeprecationWarning(platform)"
>
<b-card-body>
<h4 class="mb-0">
<h4 class="mb-2">
{{ platform.name }}
<b-badge variant="warning">Deprecated</b-badge>
</h4>
@ -213,7 +216,7 @@ export default {
},
deleteLegacyPlatform(platform) {
this.$store.commit('SET_PLATFORM_LEGACY', platform);
this.$store.commit('SET_ACTIVE_PLATFORM_LEGACY', platform);
this.$store.commit('REMOVE_PLATFORM_LEGACY');

View file

@ -80,7 +80,7 @@ export default {
},
async saveTags() {
await this.$store.dispatch('SAVE_TAGS_LEGACY', this.tags)
await this.$store.dispatch('SAVE_TAGS', this.tags)
.catch(() => {
this.$bvToast.toast('Authentication error', { title: 'Error', variant: 'danger' });
});

View file

@ -30,12 +30,6 @@ export default new Router({
name: 'board',
component: Board,
},
{
path: '/board/:id',
name: 'board',
component: Board,
},
{
name: 'sessionExpired',
path: '/session-expired',

View file

@ -1,5 +1,6 @@
import axios from 'axios';
import firebase from 'firebase/app';
import 'firebase/storage';
import 'firebase/firestore';
const API_BASE = 'https://us-central1-gamebrary-8c736.cloudfunctions.net';
@ -238,7 +239,7 @@ export default {
});
},
SAVE_TAGS_LEGACY({ state }, tags) {
SAVE_TAGS({ state }, tags) {
const db = firebase.firestore();
return new Promise((resolve, reject) => {

View file

@ -1,5 +1,3 @@
// TODO: clean up state and mutations
import Vue from 'vue';
import { PLATFORM_CATEGORIES, EXCLUDED_PLATFORMS, PLATFORM_BG_HEX, PLATFORM_LOGO_FORMAT, PLATFORM_NAME_OVERRIDES, POPULAR_PLATFORMS } from '@/constants';
@ -126,49 +124,6 @@ export default {
state.board.lists[listIndex].name = listName;
},
//
// LEGACY STUFF
//
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);
},
REMOVE_LIST_LEGACY(state, index) {
state.gameLists[state.platform.code].splice(index, 1);
},
REMOVE_PLATFORM_LEGACY(state) {
Vue.delete(state.gameLists, state.platform.code);
},
SET_WALLPAPER_URL_LEGACY(state, url) {
state.wallpaperUrl = url;
},
SET_GAME_LISTS_LEGACY(state, lists) {
state.gameLists = lists;
},
//
// STUFF THAT REMAINS THE SAME
//
SET_USER(state, data) {
state.user = {
lastLogin: data.metadata.lastSignInTime,
@ -227,7 +182,6 @@ export default {
state.board = {};
state.boardGames = [];
state.gameModalData = null;
state.game = null;
state.wallpaperUrl = null;
state.wallpapers = [];
},
@ -283,4 +237,24 @@ export default {
UPDATE_SETTING(state, { key, value }) {
state.settings[key] = value;
},
//
// LEGACY STUFF
//
SET_ACTIVE_PLATFORM_LEGACY(state, platform) {
state.platform = platform;
},
SAVE_LIST_LEGACY(state, lists) {
state.gameLists = lists;
},
REMOVE_PLATFORM_LEGACY(state) {
Vue.delete(state.gameLists, state.platform.code);
},
SET_GAME_LISTS_LEGACY(state, lists) {
state.gameLists = lists;
},
};

View file

@ -1,5 +1,3 @@
// TODO: clean up state and mutations
export default {
user: null,
tags: {},
@ -9,15 +7,13 @@ export default {
dragging: false,
gameLists: {},
settings: null,
platform: null,
legacyPlatforms: [],
results: [],
games: {},
boards: [],
board: {},
boardGames: [],
gameModalData: null,
game: null,
wallpaperUrl: null,
wallpapers: [],
platform: null,
legacyPlatforms: [],
};