more clean up

This commit is contained in:
Gamebrary 2022-08-18 14:51:46 -07:00
parent 9f4db66d3e
commit d36d2880a4
8 changed files with 9 additions and 42 deletions

View file

@ -1,3 +1,4 @@
<!-- TODO: improve board and game caching -->
<!-- TODO: GOG, steam, and amazon affiliate links -->
<!-- TODO: allow board sorting -->
<!-- TODO: Use moment? or use dayjs without wrapper -->

View file

@ -122,10 +122,8 @@ export default {
});
this.$forceUpdate();
// this.$bvToast.toast('List added');
this.reset();
this.saving = false;
// this.$bvModal.hide(this.modalId);
this.scroll();
},

View file

@ -180,9 +180,7 @@ export default {
},
viewClass() {
const { settings } = this.list;
return settings.view || DEFAULT_LIST_VIEW;
return this.list?.settings?.view || DEFAULT_LIST_VIEW;
},
},
@ -223,8 +221,6 @@ export default {
.catch(() => {
this.$store.commit('SET_SESSION_EXPIRED', true);
});
this.$bvToast.toast('List saved');
},
},
};

View file

@ -34,7 +34,7 @@ export default {
},
tagsApplied() {
return this.tags?.filter((tag) => tag?.games?.includes(this.game?.id))
return this.tags?.filter((tag) => tag?.games?.includes(this.game?.id)) || [];
},
gameNotes() {

View file

@ -87,7 +87,6 @@ export default {
},
signInSuccess({ additionalUserInfo, user }) {
console.log('signInSuccess');
this.loading = true;
if (additionalUserInfo?.isNewUser) {
@ -98,9 +97,6 @@ export default {
this.$store.commit('SET_SESSION_EXPIRED', false);
}
console.log(user);
console.log(additionalUserInfo);
this.$store.commit('SET_USER', user);
this.$router.replace({ name: 'home' });
this.load();

View file

@ -117,12 +117,6 @@ export default {
computed: {
...mapState(['board', 'user']),
buttonLabel() {
return this.value.length
? this.$t('board.settings.platformLabel', { platformCount: this.value.length })
: this.$t('board.settings.platformPlaceholder');
},
},
mounted() {
@ -139,7 +133,6 @@ export default {
const { board } = this;
this.description = board.description;
this.name = board.name;
this.selectedPlatforms = board.platforms;
this.isPublic = board.isPublic || false;
this.theme = board.theme || 'default';
},
@ -180,18 +173,14 @@ export default {
...board,
description: this.description,
name: this.name,
// platforms: this.platforms,
isPublic: this.isPublic,
theme: this.theme,
};
console.log(payload);
this.$store.commit('SET_ACTIVE_BOARD', payload);
await this.$store.dispatch('SAVE_BOARD')
.catch((e) => {
console.log(e);
.catch(() => {
this.saving = false;
this.$bvToast.toast('There was an saving board settings', { variant: 'danger' });
@ -199,15 +188,8 @@ export default {
this.saving = false;
this.$bvToast.toast('Board settings saved');
// TODO: route back to board
this.$router.push({ name: 'board', params: { id: board.id } });
},
},
};
</script>
<style lang="scss" rel="stylesheet/scss">
.platforms-dropdown .dropdown-menu {
max-height: 300px;
overflow-y: auto;
}
</style>

View file

@ -315,10 +315,7 @@ export default {
watch: {
gameId(gameId) {
// document.getElementsByTagName('main')[0].scrollTop = 0;
if (gameId) this.loadGame();
// TODO: handle missing id, redirect? 404? search?
},
},
@ -338,6 +335,8 @@ export default {
},
async loadGame() {
document.body.scrollTop = document.documentElement.scrollTop = 0;
const gameCached = this.game?.id === this.gameId;
if (!this.gameId || gameCached) return;

View file

@ -29,10 +29,10 @@
class="mb-4"
message="Looks like you don't have any tags yet."
>
<b-button @click="manageTags">Manage tags</b-button>
<b-button :to="{ name: 'tags' }">Manage tags</b-button>
</empty-state>
<section class="field">
<section v-else class="field">
<section>
<h4 class="my-3">Tags applied to {{ game.name }}</h4>
@ -168,11 +168,6 @@ export default {
this.saving = false;
},
manageTags() {
this.$bvModal.hide('tags');
this.$router.push({ name: 'tags' });
},
},
};
</script>