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">
<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"
@click="$emit('view-board', board.id)"
>
@ -10,10 +10,6 @@
<small v-if="board.isPublic" class="text-info">
(Public)
</small>
<div class="ml-auto">
<slot />
</div>
</header>
<div class="lists rounded overflow-hidden">
@ -68,12 +64,13 @@ $boardHeight: 200px;
background-repeat: no-repeat;
background-size: cover;
height: $boardHeight;
width: 363.2px;
width: 100%;
// width: 363.2px;
@media(max-width: 1024px) { width: 320px; }
@media(max-width: 768px) { width: 360px; }
@media(width: 500px) { width: 222px; }
@media(max-width: 500px) { width: calc(100% - 8px); }
// @media(max-width: 1024px) { width: 320px; }
// @media(max-width: 768px) { width: 360px; }
// @media(width: 500px) { width: 222px; }
// @media(max-width: 500px) { width: calc(100% - 8px); }
}
.lists {

View file

@ -1,7 +1,8 @@
<template lang="html">
<div>
<pre>{{ gameLogo }}</pre>
</div>
<b-card class="bg-info">
[SPEEDRUNS]
<!-- <pre>{{ gameLogo }}</pre> -->
</b-card>
</template>
<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">
<b-card v-if="similarGames.length" class="mx-2">
<b-card v-if="similarGames.length">
<h4 class="text-center">You may also like:</h4>
<div class="d-flex overflow-auto">

View file

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

View file

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

View file

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

View file

@ -1,185 +1,208 @@
<!-- 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">
<!-- TODO: Add back button -->
<!-- TODO: refactor platforms and wallpapers -->
<!-- TODO: add board preview-->
<!-- TODO: use board placeholder for preview / disable placeholder animation -->
<b-container fluid class="p-2">
<form ref="boardSettingsForm" @submit.stop.prevent="submit">
<b-row>
<b-col>
<b-button @click="goToBoard">
Back to board
</b-button>
<b-container fluid class="p-0">
<b-row v-if="board" no-gutters>
<b-col sm="12" md="6">
<div class="p-3 list-preview d-flex justify-content-center">
<!-- <game-list :list="list" preview /> -->
<board-placeholder />
</div>
</b-col>
<b-form-group
:label="$t('board.settings.nameLabel')"
label-for="name"
>
<b-form-input
id="name"
v-model="name"
required
/>
</b-form-group>
<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-form-group
:label="$t('board.settings.descriptionLabel')"
label-for="description"
>
<b-form-textarea
id="description"
v-model="description"
maxlength="280"
rows="3"
/>
</b-form-group>
<b-button variant="success">
Add games
</b-button>
</header>
<b-form-checkbox v-model="isPublic" switch class="mb-2">
Make board public (beta)
</b-form-checkbox>
<form ref="boardSettingsForm" @submit.stop.prevent="submit">
<b-row>
<b-col>
<b-button @click="goToBoard">
Back to board
</b-button>
<b-alert show variant="info" v-if="isPublic" class="m-0">
<strong>Public Board URL</strong>
<br>
<small>{{ `https://app.gamebrary.com/#/b/${board.id}` }}</small>
</b-alert>
<b-form-group
:label="$t('board.settings.nameLabel')"
label-for="name"
>
<b-form-input
id="name"
v-model="name"
required
/>
</b-form-group>
<hr class="my-3">
<b-form-group
:label="$t('board.settings.descriptionLabel')"
label-for="description"
>
<b-form-textarea
id="description"
v-model="description"
maxlength="280"
rows="3"
/>
</b-form-group>
<hr class="my-3">
<b-form-checkbox v-model="isPublic" switch class="mb-2">
Make board public (beta)
</b-form-checkbox>
<b-button
variant="danger"
@click="confirmDelete"
>
{{ $t('board.settings.deleteBoard') }}
</b-button>
<b-alert show variant="info" v-if="isPublic" class="m-0">
<strong>Public Board URL</strong>
<br>
<small>{{ `https://app.gamebrary.com/#/b/${board.id}` }}</small>
</b-alert>
<b-button
variant="primary"
:disabled="saving"
@click="saveSettings"
>
<b-spinner small v-if="saving" />
<span v-else>{{ $t('global.save') }}</span>
</b-button>
</b-col>
<hr class="my-3">
<b-col>
<!-- <b-button
variant="primary"
:disabled="saving"
@click="saveSettings"
>
<b-spinner small v-if="saving" />
<span v-else>{{ $t('global.save') }}</span>
</b-button> -->
<hr class="my-3">
<b-alert :show="noPlatformsSelected" variant="warning">
No platforms selected, game search will include all platforms.
</b-alert>
<b-button
variant="danger"
@click="confirmDelete"
>
{{ $t('board.settings.deleteBoard') }}
</b-button>
<b-alert :show="noPlatformsSelected" variant="success">
Select platforms to limit search results.
</b-alert>
<b-button
variant="primary"
:disabled="saving"
@click="saveSettings"
>
<b-spinner small v-if="saving" />
<span v-else>{{ $t('global.save') }}</span>
</b-button>
</b-col>
<!-- <platform-picker v-model="platforms" /> -->
<!-- <b-button-toolbar aria-label="Toolbar with button groups and dropdown menu">
<b-button-group class="mx-1">
<b-button>New</b-button>
<b-button>Edit</b-button>
<b-button>Undo</b-button>
</b-button-group>
<b-dropdown class="mx-1" right text="menu">
<b-dropdown-item>Item 1</b-dropdown-item>
<b-dropdown-item>Item 2</b-dropdown-item>
<b-dropdown-item>Item 3</b-dropdown-item>
</b-dropdown>
<b-button-group class="mx-1">
<b-button>Save</b-button>
<b-button>Cancel</b-button>
</b-button-group>
</b-button-toolbar> -->
<b-col>
<!-- <b-button
variant="primary"
:disabled="saving"
@click="saveSettings"
>
<b-spinner small v-if="saving" />
<span v-else>{{ $t('global.save') }}</span>
</b-button> -->
<!-- <div class="d-flex mb-2">
<div class="filter mr-2">
<small class="d-block text-muted">Show:</small>
<b-button size="sm">All</b-button>
<b-button size="sm">Consoles</b-button>
<b-button size="sm">Handhelds</b-button>
<b-button size="sm">PC</b-button>
</div>
<b-alert :show="noPlatformsSelected" variant="warning">
No platforms selected, game search will include all platforms.
</b-alert>
<div class="sort">
<small class="d-block text-muted">Sort by:</small>
<b-button size="sm">All</b-button>
<b-button size="sm">All</b-button>
<b-button size="sm">All</b-button>
</div>
</div> -->
<!-- <b-form-group
label="Stacked (vertical) switch style checkboxes"
v-slot="{ ariaDescribedby }"
>
<b-form-checkbox-group
v-model="selected"
:options="options"
:aria-describedby="ariaDescribedby"
switches
stacked
/>
</b-form-group> -->
<b-alert :show="noPlatformsSelected" variant="success">
Select platforms to limit search results.
</b-alert>
<b-dropdown
text="Select platforms"
class="platforms-dropdown"
>
<b-dropdown-item
v-for="platform in platforms"
:key="platform.id"
>
{{ platform.name }}
</b-dropdown-item>
<!-- <pre>{{ platforms }}</pre> -->
<!-- <b-dropdown-item>Second Action</b-dropdown-item> -->
<!-- <b-dropdown-item>Third Action</b-dropdown-item> -->
<!-- <b-dropdown-divider></b-dropdown-divider> -->
<!-- <b-dropdown-item active>Active action</b-dropdown-item> -->
<!-- <b-dropdown-item disabled>Disabled action</b-dropdown-item> -->
</b-dropdown>
<!-- <platform-picker v-model="platforms" /> -->
<!-- <b-button-toolbar aria-label="Toolbar with button groups and dropdown menu">
<b-button-group class="mx-1">
<b-button>New</b-button>
<b-button>Edit</b-button>
<b-button>Undo</b-button>
</b-button-group>
<b-dropdown class="mx-1" right text="menu">
<b-dropdown-item>Item 1</b-dropdown-item>
<b-dropdown-item>Item 2</b-dropdown-item>
<b-dropdown-item>Item 3</b-dropdown-item>
</b-dropdown>
<b-button-group class="mx-1">
<b-button>Save</b-button>
<b-button>Cancel</b-button>
</b-button-group>
</b-button-toolbar> -->
<!-- <div class="d-flex mb-2">
<div class="filter mr-2">
<small class="d-block text-muted">Show:</small>
<b-button size="sm">All</b-button>
<b-button size="sm">Consoles</b-button>
<b-button size="sm">Handhelds</b-button>
<b-button size="sm">PC</b-button>
</div>
<div class="sort">
<small class="d-block text-muted">Sort by:</small>
<b-button size="sm">All</b-button>
<b-button size="sm">All</b-button>
<b-button size="sm">All</b-button>
</div>
</div> -->
<!-- <b-form-group
label="Stacked (vertical) switch style checkboxes"
v-slot="{ ariaDescribedby }"
>
<b-form-checkbox-group
v-model="selected"
:options="options"
:aria-describedby="ariaDescribedby"
switches
stacked
/>
</b-form-group> -->
<b-dropdown
text="Select platforms"
class="platforms-dropdown"
>
<b-dropdown-item
v-for="platform in platforms"
:key="platform.id"
>
{{ platform.name }}
</b-dropdown-item>
<!-- <pre>{{ platforms }}</pre> -->
<!-- <b-dropdown-item>Second Action</b-dropdown-item> -->
<!-- <b-dropdown-item>Third Action</b-dropdown-item> -->
<!-- <b-dropdown-divider></b-dropdown-divider> -->
<!-- <b-dropdown-item active>Active action</b-dropdown-item> -->
<!-- <b-dropdown-item disabled>Disabled action</b-dropdown-item> -->
</b-dropdown>
<!-- <b-button
v-for="platform in sortedPlatforms"
:variant="value.includes(platform.id) ? 'primary' : 'dark'"
:key="platform.id"
>
<small :class="value.includes(platform.id) ? '' : 'text-muted'">
{{ platform.name }}
</small>
</b-button> -->
</b-col>
<!-- <b-button
v-for="platform in sortedPlatforms"
:variant="value.includes(platform.id) ? 'primary' : 'dark'"
:key="platform.id"
>
<small :class="value.includes(platform.id) ? '' : 'text-muted'">
{{ platform.name }}
</small>
</b-button> -->
</b-col>
<b-col>
<edit-board-background-modal />
<b-button v-b-modal.boardBackground>
<i class="fas fa-images fa-fw" aria-hidden />
<br />
Change background
</b-button>
</b-col>
</b-row>
</form>
<b-col>
<edit-board-background-modal />
<b-button v-b-modal.boardBackground>
<i class="fas fa-images fa-fw" aria-hidden />
<br />
Change background
</b-button>
</b-col>
</b-row>
</form>
</b-card>
</b-col>
</b-row>
</b-container>
</template>
<script>
import { mapState, mapGetters } from 'vuex';
import EditBoardBackgroundModal from '@/components/Board/EditBoardBackgroundModal';
import BoardPlaceholder from '@/components/Board/BoardPlaceholder';
import orderby from 'lodash.orderby';
export default {
components: {
BoardPlaceholder,
EditBoardBackgroundModal,
},

View file

@ -11,7 +11,14 @@
<template v-else-if="game">
<b-row>
<b-col>
<b-col
offset="2"
offset-sm="0"
cols="8"
sm="4"
md="4"
xl="3"
>
<b-img
:src="gameCoverUrl"
:alt="game.name"
@ -26,9 +33,6 @@
height="100px"
/> -->
<!-- <template v-else>
<game-videos :videos="game.videos" v-if="game.videos" />
</template> -->
<amazon-links class="mt-2" />
<div class="game-info">
@ -36,82 +40,124 @@
</div>
</b-col>
<b-col>
<game-titles />
<b-progress
v-if="progress"
:value="progress"
variant="success"
height="8px"
v-b-modal.progress
class="my-1 w-25"
@click.native="$router.push({ name: 'game.notes', params: { id: game.id, slug: game.slug } })"
/>
<b-badge variant="success" v-if="game && game.steam && game.steam.metacritic">{{ game.steam.metacritic.score }}</b-badge>
<b-badge
v-for="({ hex, tagTextColor }, name) in gameTags"
:key="name"
pill
tag="small"
class="mr-1 mb-2"
:style="`background-color: ${hex}; color: ${tagTextColor}`"
@click="$router.push({ name: 'game.tags', params: { id: game.id, slug: game.slug } })"
v-b-modal.tags
>
{{ name }}
</b-badge>
<game-description />
<game-notes />
</b-col>
<b-col>
<b-card
no-body
style="max-width: 20rem;"
>
<b-link :to="{ name: 'game.media', params: { id: game.id, slug: game.slug } }">
<b-card-img :src="gameScrenshot" top />
</b-link>
<b-button
class="m-1"
variant="light"
:to="{ name: 'game.media', params: { id: game.id, slug: game.slug } }"
<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"
>
<i class="fa-solid fa-photo-film" />
Videos & Screenshots
</b-button>
<game-titles />
<b-progress
v-if="progress"
:value="progress"
variant="success"
height="8px"
v-b-modal.progress
class="my-1 w-25"
@click.native="$router.push({ name: 'game.notes', params: { id: game.id, slug: game.slug } })"
/>
<b-badge variant="success" v-if="game && game.steam && game.steam.metacritic">{{ game.steam.metacritic.score }}</b-badge>
<game-details />
<game-websites
:game="game"
/>
<b-badge
v-for="({ hex, tagTextColor }, name) in gameTags"
:key="name"
pill
tag="small"
class="mr-1 mb-2"
:style="`background-color: ${hex}; color: ${tagTextColor}`"
@click="$router.push({ name: 'game.tags', params: { id: game.id, slug: game.slug } })"
v-b-modal.tags
>
{{ name }}
</b-badge>
<game-description />
<b-card-footer v-if="legalNotice">
<small class="text-muted" v-html="legalNotice" />
</b-card-footer>
<game-notes />
</b-col>
<!-- TODO: use speedrun logo -->
<!-- <pre>{{ game}}</pre> -->
<!-- <b-card-img src="https://placekitten.com/480/210" alt="Image" bottom></b-card-img> -->
</b-card>
<b-col
offset="1"
offset-sm="0"
cols="10"
sm="12"
md="5"
xl="4"
>
<b-card
no-body
>
<b-link :to="{ name: 'game.media', params: { id: game.id, slug: game.slug } }">
<b-card-img :src="gameScrenshot" top />
</b-link>
<b-button
class="m-1"
variant="light"
:to="{ name: 'game.media', params: { id: game.id, slug: game.slug } }"
>
<i class="fa-solid fa-photo-film" />
Videos & Screenshots
</b-button>
<game-details />
<game-websites
:game="game"
/>
<b-card-footer v-if="legalNotice">
<small class="text-muted" v-html="legalNotice" />
</b-card-footer>
<!-- TODO: use speedrun logo -->
<!-- <pre>{{ game}}</pre> -->
<!-- <b-card-img src="https://placekitten.com/480/210" alt="Image" bottom></b-card-img> -->
</b-card>
</b-col>
</b-row>
</b-col>
</b-row>
<b-row>
<b-col>
<b-col
cols="12"
sm="12"
md="6"
xl="6"
class="mt-3"
>
<similar-games
:loading="loading"
class="mb-2"
/>
</b-col>
<b-col>
<!-- Bundles -->
<b-col
cols="12"
sm="12"
md="6"
xl="6"
class="mt-3"
>
<game-speedruns v-if="game" />
<!-- <pre>{{ game.speedruns }}</pre> -->
<!-- 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-row>
</template>

View file

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

View file

@ -3,38 +3,61 @@
<!-- TODO: add loading placeholder -->
<template lang="html">
<b-container fluid class="p-2">
<b-row>
<b-form-row>
<b-col cols="3">
<b-img
:src="gameCoverUrl"
rounded
fluid-grow
@click.stop="openModal(index)"
@click.stop="openModal"
/>
</b-col>
<b-col cols="7">
<div>
<h2>{{ game.name }}</h2>
<p class="text-muted">
Images
</p>
<b-col cols="9">
<h2>{{ game.name }}</h2>
<h4>Screenshots</h4>
</div>
<div class="packery-grid">
<b-img
<b-form-row no-gutters>
<b-col
cols="4"
sm="4"
md="3"
xl="2"
v-for="(thumbnail, index) in gameThumbnails"
v-show="index > 1"
class="p-1"
:key="index"
:src="thumbnail"
width="200"
:class="index === 0 ? 'd-none' : 'image'"
rounded
@click.stop="openModal(index)"
/>
</div>
>
<b-img
:src="thumbnail"
rounded
fluid
@click.stop="openModal(index)"
/>
</b-col>
<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-row>
</b-form-row>
<b-modal
id="game-images"
@ -114,13 +137,11 @@
<script>
import { mapGetters, mapState } from 'vuex';
import Packery from 'packery';
// TODO: load game if not loaded
export default {
data() {
return {
packery: null,
activeIndex: 0,
maxThumbnails: 3,
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: {
layout() {
this.packery.layout();
},
async setAsWallpaper() {
this.saving = true;