UI cleanup

This commit is contained in:
Gamebrary 2022-06-03 08:16:02 -07:00
parent 6261fd981c
commit 3a77e22d49
11 changed files with 380 additions and 364 deletions

View file

@ -1,6 +1,6 @@
<template lang="html"> <template lang="html">
<div <div
:class="['mini-board overflow-hidden p-1 rounded cursor-pointer', { 'bg-secondary': !board.backgroundColor }]" :class="['mini-board overflow-hidden p-1 rounded cursor-pointer m-0', { 'bg-secondary': !board.backgroundColor }]"
:style="miniBoardStyles" :style="miniBoardStyles"
@click="$emit('view-board', board.id)" @click="$emit('view-board', board.id)"
> >
@ -10,10 +10,6 @@
<small v-if="board.isPublic" class="text-info"> <small v-if="board.isPublic" class="text-info">
(Public) (Public)
</small> </small>
<div class="ml-auto">
<slot />
</div>
</header> </header>
<div class="lists rounded overflow-hidden"> <div class="lists rounded overflow-hidden">
@ -68,12 +64,13 @@ $boardHeight: 200px;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;
height: $boardHeight; height: $boardHeight;
width: 363.2px; width: 100%;
// width: 363.2px;
@media(max-width: 1024px) { width: 320px; } // @media(max-width: 1024px) { width: 320px; }
@media(max-width: 768px) { width: 360px; } // @media(max-width: 768px) { width: 360px; }
@media(width: 500px) { width: 222px; } // @media(width: 500px) { width: 222px; }
@media(max-width: 500px) { width: calc(100% - 8px); } // @media(max-width: 500px) { width: calc(100% - 8px); }
} }
.lists { .lists {

View file

@ -1,7 +1,8 @@
<template lang="html"> <template lang="html">
<div> <b-card class="bg-info">
<pre>{{ gameLogo }}</pre> [SPEEDRUNS]
</div> <!-- <pre>{{ gameLogo }}</pre> -->
</b-card>
</template> </template>
<script> <script>

View file

@ -1,29 +0,0 @@
<template lang="html">
<div class="videos">
<b-embed
v-for="{ video_id } in videos"
class="rounded mb-2"
:key="video_id"
type="iframe"
aspect="16by9"
:src="`https://www.youtube.com/embed/${video_id}`"
allowfullscreen
/>
</div>
</template>
<script>
export default {
props: {
videos: Array,
},
};
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
.videos {
display: grid;
grid-template-columns: auto auto auto auto;
grid-gap: 1rem;
}
</style>

View file

@ -1,5 +1,5 @@
<template lang="html"> <template lang="html">
<b-card v-if="similarGames.length" class="mx-2"> <b-card v-if="similarGames.length">
<h4 class="text-center">You may also like:</h4> <h4 class="text-center">You may also like:</h4>
<div class="d-flex overflow-auto"> <div class="d-flex overflow-auto">

View file

@ -1,5 +1,5 @@
<template lang="html"> <template lang="html">
<div v-if="user"> <b-row v-if="user" class="p-1">
<!-- TODO: allow reorganizing and save --> <!-- TODO: allow reorganizing and save -->
<empty-state <empty-state
v-if="!user || !loading && sortedBoards.length === 0" v-if="!user || !loading && sortedBoards.length === 0"
@ -15,47 +15,28 @@
</b-button> --> </b-button> -->
</empty-state> </empty-state>
<div class="packery-grid"> <template v-if="showPlaceholder">
<div v-if="showPlaceholder">
Loading Loading
</div> </template>
<mini-board <template v-else>
<b-col
v-for="board in sortedBoards" v-for="board in sortedBoards"
:key="board.id" :key="board.id"
cols="6"
sm="6"
md="4"
lg="3"
class="p-1"
>
<mini-board
:board="board" :board="board"
:background-image="getWallpaperUrl(board.backgroundUrl)" :background-image="getWallpaperUrl(board.backgroundUrl)"
class="p-relative"
@view-board="viewBoard(board.id)" @view-board="viewBoard(board.id)"
> />
<!-- <b-button </b-col>
size="sm" </template>
variant="transparent" </b-row>
@click.stop="editBoard(board.id)"
>
<i class="fas fa-pencil-alt fa-fw" aria-hidden />
</b-button> -->
</mini-board>
<!-- TODO: show public boards -->
<!-- <mini-board
v-for="board in publicBoards"
:key="board.id"
:board="board"
:background-image="getWallpaperUrl(board.backgroundUrl)"
class="p-relative"
@view-board="viewPublicBoard(board.id)"
>
<b-button
class="position-absolute edit-board-button"
size="sm"
@click.stop="editBoard(board)"
>
<i class="fas fa-pencil-alt fa-fw" aria-hidden />
</b-button>
</mini-board> -->
</div>
</div>
</template> </template>
<script> <script>
@ -104,10 +85,7 @@ export default {
methods: { methods: {
load() { load() {
if (this.user) { if (this.user) this.loadPlatforms();
this.renderGrid();
this.loadPlatforms();
}
}, },
editBoard(id) { editBoard(id) {
@ -152,13 +130,6 @@ export default {
}); });
this.loading = false; this.loading = false;
this.renderGrid();
},
renderGrid() {
this.packery = this.showPlaceholder && this.user
? null
: new Packery('.packery-grid', { itemSelector: '.mini-board', gutter: 16 });
}, },
viewBoard(id) { viewBoard(id) {

View file

@ -48,6 +48,7 @@
<b-button <b-button
v-else v-else
class="ml-2" class="ml-2"
variant="primary"
:to="{ name: 'auth' }" :to="{ name: 'auth' }"
> >
Login Login

View file

@ -1,5 +1,5 @@
<template lang="html"> <template lang="html">
<b-container fluid class="p-2"> <b-container fluid>
<portal to="headerActions"> <portal to="headerActions">
<b-button <b-button
variant="primary" variant="primary"
@ -10,9 +10,7 @@
</b-button> </b-button>
</portal> </portal>
<div v-if="boards.length"> <game-boards v-if="boards.length" class="mb-3" />
<game-boards class="mb-3" />
</div>
<empty-state <empty-state
v-else v-else

View file

@ -1,9 +1,27 @@
<!-- TODO: Add back button -->
<!-- TODO: refactor platforms and wallpapers -->
<!-- TODO: add board preview-->
<!-- TODO: use board placeholder for preview / disable placeholder animation -->
<template lang="html"> <template lang="html">
<!-- TODO: Add back button --> <b-container fluid class="p-0">
<!-- TODO: refactor platforms and wallpapers --> <b-row v-if="board" no-gutters>
<!-- TODO: add board preview--> <b-col sm="12" md="6">
<!-- TODO: use board placeholder for preview / disable placeholder animation --> <div class="p-3 list-preview d-flex justify-content-center">
<b-container fluid class="p-2"> <!-- <game-list :list="list" preview /> -->
<board-placeholder />
</div>
</b-col>
<b-col>
<b-card>
<header class="p-1 mb-3 pl-2 d-flex justify-content-between align-items-center">
<h1 class="mb-0">Edit board</h1>
<b-button variant="success">
Add games
</b-button>
</header>
<form ref="boardSettingsForm" @submit.stop.prevent="submit"> <form ref="boardSettingsForm" @submit.stop.prevent="submit">
<b-row> <b-row>
<b-col> <b-col>
@ -170,16 +188,21 @@
</b-col> </b-col>
</b-row> </b-row>
</form> </form>
</b-card>
</b-col>
</b-row>
</b-container> </b-container>
</template> </template>
<script> <script>
import { mapState, mapGetters } from 'vuex'; import { mapState, mapGetters } from 'vuex';
import EditBoardBackgroundModal from '@/components/Board/EditBoardBackgroundModal'; import EditBoardBackgroundModal from '@/components/Board/EditBoardBackgroundModal';
import BoardPlaceholder from '@/components/Board/BoardPlaceholder';
import orderby from 'lodash.orderby'; import orderby from 'lodash.orderby';
export default { export default {
components: { components: {
BoardPlaceholder,
EditBoardBackgroundModal, EditBoardBackgroundModal,
}, },

View file

@ -11,7 +11,14 @@
<template v-else-if="game"> <template v-else-if="game">
<b-row> <b-row>
<b-col> <b-col
offset="2"
offset-sm="0"
cols="8"
sm="4"
md="4"
xl="3"
>
<b-img <b-img
:src="gameCoverUrl" :src="gameCoverUrl"
:alt="game.name" :alt="game.name"
@ -26,9 +33,6 @@
height="100px" height="100px"
/> --> /> -->
<!-- <template v-else>
<game-videos :videos="game.videos" v-if="game.videos" />
</template> -->
<amazon-links class="mt-2" /> <amazon-links class="mt-2" />
<div class="game-info"> <div class="game-info">
@ -36,7 +40,22 @@
</div> </div>
</b-col> </b-col>
<b-col> <b-col
cols="12"
sm="8"
md="8"
lg="8"
xl="9"
>
<b-row>
<b-col
offset="12"
offset-sm="0"
cols="12"
sm="12"
md="7"
xl="8"
>
<game-titles /> <game-titles />
<b-progress <b-progress
v-if="progress" v-if="progress"
@ -66,10 +85,16 @@
<game-notes /> <game-notes />
</b-col> </b-col>
<b-col> <b-col
offset="1"
offset-sm="0"
cols="10"
sm="12"
md="5"
xl="4"
>
<b-card <b-card
no-body no-body
style="max-width: 20rem;"
> >
<b-link :to="{ name: 'game.media', params: { id: game.id, slug: game.slug } }"> <b-link :to="{ name: 'game.media', params: { id: game.id, slug: game.slug } }">
<b-card-img :src="gameScrenshot" top /> <b-card-img :src="gameScrenshot" top />
@ -98,20 +123,41 @@
</b-card> </b-card>
</b-col> </b-col>
</b-row> </b-row>
</b-col>
<b-row> <b-col
<b-col> cols="12"
sm="12"
md="6"
xl="6"
class="mt-3"
>
<similar-games <similar-games
:loading="loading" :loading="loading"
class="mb-2"
/> />
</b-col> </b-col>
<b-col>
<!-- Bundles --> <b-col
cols="12"
sm="12"
md="6"
xl="6"
class="mt-3"
>
<game-speedruns v-if="game" /> <game-speedruns v-if="game" />
<!-- <pre>{{ game.speedruns }}</pre> --> <!-- <pre>{{ game.speedruns }}</pre> -->
<!-- TODO: add bundles to game detail? --> <!-- TODO: add bundles to game detail? -->
{{ game.bundles ? `Found in ${game.bundles.length} compilations.` : null }} </b-col>
<b-col
cols="12"
class="mt-3"
>
<b-card>
<h4>[BUNDLES]</h4>
</b-card>
<!-- <pre>{{ game }}</pre> -->
<!-- {{ game.bundles ? `Found in ${game.bundles.length} compilations.` : null }} -->
</b-col> </b-col>
</b-row> </b-row>
</template> </template>

View file

@ -4,18 +4,18 @@
<b-col cols="3"> <b-col cols="3">
<!-- TODO: add filters --> <!-- TODO: add filters -->
<!-- TODO: add view toggle --> <!-- TODO: add view toggle -->
<!-- Filter --> Filter
<!-- <h3>Sort by</h3> --> <h3>Sort by</h3>
<!-- Latest --> Latest
<!-- Oldest --> Oldest
<!-- Relevance --> Relevance
<!-- <h3>Filters</h3> --> <h3>Filters</h3>
<!-- Tags --> Tags
<!-- Genre --> Genre
<!-- Platform --> Platform
<!-- Year released --> Year released
</b-col> </b-col>
<b-col cols="9"> <b-col cols="9">
@ -79,21 +79,20 @@ export default {
watch: { watch: {
query(value) { query(value) {
// todo: Avoid search if new/old values are same
this.search(value); this.search(value);
}, },
}, },
mounted() { mounted() {
if (this.query) this.search(); this.search();
}, },
methods: { methods: {
async search() { async search() {
this.loading = true; this.loading = true;
this.searchResults = this.query this.searchResults = await this.$store.dispatch('CUSTOM_SEARCH', { searchText: 'mario' })
? await this.$store.dispatch('CUSTOM_SEARCH', { searchText: this.query })
: [];
this.loading = false; this.loading = false;
}, },

View file

@ -3,38 +3,61 @@
<!-- TODO: add loading placeholder --> <!-- TODO: add loading placeholder -->
<template lang="html"> <template lang="html">
<b-container fluid class="p-2"> <b-container fluid class="p-2">
<b-row> <b-form-row>
<b-col cols="3"> <b-col cols="3">
<b-img <b-img
:src="gameCoverUrl" :src="gameCoverUrl"
rounded rounded
fluid-grow fluid-grow
@click.stop="openModal(index)" @click.stop="openModal"
/> />
</b-col> </b-col>
<b-col cols="7"> <b-col cols="9">
<div>
<h2>{{ game.name }}</h2> <h2>{{ game.name }}</h2>
<p class="text-muted"> <h4>Screenshots</h4>
Images
</p>
</div> <b-form-row no-gutters>
<b-col
<div class="packery-grid"> cols="4"
<b-img sm="4"
md="3"
xl="2"
v-for="(thumbnail, index) in gameThumbnails" v-for="(thumbnail, index) in gameThumbnails"
v-show="index > 1"
class="p-1"
:key="index" :key="index"
>
<b-img
:src="thumbnail" :src="thumbnail"
width="200"
:class="index === 0 ? 'd-none' : 'image'"
rounded rounded
fluid
@click.stop="openModal(index)" @click.stop="openModal(index)"
/> />
</div>
</b-col> </b-col>
</b-row>
<template v-if="game.videos">
<b-col
cols="4"
sm="4"
md="3"
xl="2"
v-for="{ video_id } in game.videos"
:key="video_id"
class="p-1"
>
<b-embed
class="rounded"
type="iframe"
aspect="16by9"
:src="`https://www.youtube.com/embed/${video_id}`"
allowfullscreen
/>
</b-col>
</template>
</b-form-row>
</b-col>
</b-form-row>
<b-modal <b-modal
id="game-images" id="game-images"
@ -114,13 +137,11 @@
<script> <script>
import { mapGetters, mapState } from 'vuex'; import { mapGetters, mapState } from 'vuex';
import Packery from 'packery';
// TODO: load game if not loaded // TODO: load game if not loaded
export default { export default {
data() { data() {
return { return {
packery: null,
activeIndex: 0, activeIndex: 0,
maxThumbnails: 3, maxThumbnails: 3,
saving: false, saving: false,
@ -218,19 +239,7 @@ export default {
}, },
}, },
mounted() {
this.packery = new Packery('.packery-grid', { itemSelector: '.image', gutter: 16 });
this.$nextTick(() => {
setTimeout(() => { this.layout(); }, 1000);
});
},
methods: { methods: {
layout() {
this.packery.layout();
},
async setAsWallpaper() { async setAsWallpaper() {
this.saving = true; this.saving = true;