Add advanced theme settings (#157)

* Add advanced theme settings

- header position
- border-radius
- list background
- amount of games next to list title
- settings section headlines

* Linting

* Linting: indent

* keep options consistent

switching from "hide this" and "display this" is bad UX.

* Hide number of games in lists by default

* reverse header position with css

* border-radius

* remove transparent background setting

this will be handled by themes

* only affect top/bottom settings on mobile
This commit is contained in:
Patrick Kontschak 2020-01-22 17:39:16 +01:00 committed by Roman Cervantes
parent 0ccee1c559
commit b392112b54
28 changed files with 161 additions and 45 deletions

View file

@ -1,7 +1,7 @@
<template> <template>
<div <div
id="app" id="app"
:class="theme" :class="[theme, headerPosition]"
:style="style" :style="style"
:dir="dir" :dir="dir"
> >
@ -53,9 +53,20 @@ export default {
}, },
style() { style() {
return this.$route.name === 'game-board' && this.wallpaperUrl return {
? `background-image: url('${this.wallpaperUrl}')` 'background-image':
: null; this.$route.name === 'game-board' &&
this.wallpaperUrl
? `url('${this.wallpaperUrl}')`
: null,
'--border-radius':
this.settings &&
this.platform &&
this.settings[this.platform.code] &&
!this.settings[this.platform.code].borderRadius
? '0px'
: null,
};
}, },
customWallpaper() { customWallpaper() {
@ -80,6 +91,22 @@ export default {
? `theme-${this.settings[this.platform.code].theme}` ? `theme-${this.settings[this.platform.code].theme}`
: 'theme-default'; : 'theme-default';
}, },
headerPosition() {
const hasPlatform = this.platform && this.platform.code;
const hasPosition = hasPlatform
&& this.settings
&& this.settings[this.platform.code]
&& this.settings[this.platform.code].position;
const isGameBoard = this.$route.name === 'game-board';
const hasPlatformPosition = hasPlatform && hasPosition;
return isGameBoard && hasPlatformPosition
? `${this.settings[this.platform.code].position}`
: 'top';
},
}, },
watch: { watch: {
@ -292,8 +319,17 @@ export default {
@import "~styles/styles"; @import "~styles/styles";
#app { #app {
display: flex;
flex-direction: column;
background: var(--body-background); background: var(--body-background);
background-size: cover; background-size: cover;
overflow-x: hidden; overflow-x: hidden;
--border-radius: 4px;
@media($small) {
&.bottom {
flex-direction: column-reverse;
}
}
} }
</style> </style>

View file

@ -59,7 +59,7 @@ export default {
.list { .list {
flex-shrink: 0; flex-shrink: 0;
cursor: default; cursor: default;
border-radius: $border-radius; border-radius: var(--border-radius);
background: var(--list-background); background: var(--list-background);
overflow: hidden; overflow: hidden;
position: relative; position: relative;
@ -83,7 +83,7 @@ export default {
&.single { &.single {
--placeholder-text-margin: #{$gp / 2} #{$gp / 2} 0 0; --placeholder-text-margin: #{$gp / 2} #{$gp / 2} 0 0;
border-radius: $border-radius; border-radius: var(--border-radius);
} }
&.masonry { &.masonry {
@ -115,7 +115,7 @@ export default {
.game { .game {
background: var(--game-card-background); background: var(--game-card-background);
border-radius: $border-radius; border-radius: var(--border-radius);
overflow: hidden; overflow: hidden;
} }
</style> </style>

View file

@ -83,7 +83,7 @@ export default {
position: relative; position: relative;
display: grid; display: grid;
grid-template-columns: 50px auto; grid-template-columns: 50px auto;
border-radius: $border-radius; border-radius: var(--border-radius);
overflow: hidden; overflow: hidden;
img { img {

View file

@ -86,7 +86,7 @@ export default {
position: relative; position: relative;
display: grid; display: grid;
grid-template-columns: $gameCoverWidth auto; grid-template-columns: $gameCoverWidth auto;
border-radius: $border-radius; border-radius: var(--border-radius);
overflow: hidden; overflow: hidden;
&.card-placeholder { &.card-placeholder {

View file

@ -75,7 +75,7 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: relative; position: relative;
border-radius: $border-radius; border-radius: var(--border-radius);
overflow: hidden; overflow: hidden;
cursor: pointer; cursor: pointer;
@ -105,8 +105,8 @@ export default {
padding: $gp / 2; padding: $gp / 2;
width: 100%; width: 100%;
display: flex; display: flex;
border-bottom-left-radius: $border-radius; border-bottom-left-radius: var(--border-radius);
border-bottom-right-radius: $border-radius; border-bottom-right-radius: var(--border-radius);
flex-direction: column; flex-direction: column;
background: var(--game-card-background); background: var(--game-card-background);

View file

@ -28,7 +28,7 @@ export default {
position: relative; position: relative;
width: calc((100%/3) - 5.5px); width: calc((100%/3) - 5.5px);
margin-bottom: 4px; margin-bottom: 4px;
border-radius: $border-radius; border-radius: var(--border-radius);
overflow: hidden; overflow: hidden;
cursor: pointer; cursor: pointer;

View file

@ -47,7 +47,7 @@ $gameCoverWidth: 80px;
position: relative; position: relative;
display: grid; display: grid;
grid-template-columns: $gameCoverWidth auto; grid-template-columns: $gameCoverWidth auto;
border-radius: $border-radius; border-radius: var(--border-radius);
overflow: hidden; overflow: hidden;
img { img {

View file

@ -74,7 +74,7 @@ export default {
background: var(--game-card-background); background: var(--game-card-background);
margin-bottom: $gp / 2; margin-bottom: $gp / 2;
position: relative; position: relative;
border-radius: $border-radius; border-radius: var(--border-radius);
min-height: 50px; min-height: 50px;
&.card-placeholder { &.card-placeholder {

View file

@ -98,7 +98,7 @@ export default {
z-index: 1; z-index: 1;
margin: $gp * 3; margin: $gp * 3;
padding: $gp 0; padding: $gp 0;
border-radius: $border-radius; border-radius: var(--border-radius);
@media($small) { @media($small) {
margin: 0; margin: 0;

View file

@ -67,7 +67,7 @@ export default {
width: 100%; width: 100%;
margin: $gp / 4 0; margin: $gp / 4 0;
overflow: hidden; overflow: hidden;
border-radius: $border-radius / 2; border-radius: var(--border-radius) / 2;
} }
.progress-bar-label { .progress-bar-label {

View file

@ -92,7 +92,7 @@ export default {
img { img {
margin: 0 $gp / 4 $gp / 4; margin: 0 $gp / 4 $gp / 4;
cursor: pointer; cursor: pointer;
border-radius: $border-radius; border-radius: var(--border-radius);
} }
} }
</style> </style>
@ -144,7 +144,7 @@ export default {
font-family: "Font Awesome 5 Free"; font-family: "Font Awesome 5 Free";
content: "\f00d"; content: "\f00d";
border: 1px solid #a5a2a2; border: 1px solid #a5a2a2;
border-radius: $border-radius; border-radius: var(--border-radius);
position: fixed; position: fixed;
right: $gp / 2; right: $gp / 2;
top: $gp / 2; top: $gp / 2;

View file

@ -29,7 +29,7 @@ export default {
.igdb-credit { .igdb-credit {
color: var(--primary-text-color); color: var(--primary-text-color);
border-radius: $border-radius; border-radius: var(--border-radius);
display: flex; display: flex;
align-items: center; align-items: center;
text-decoration: none; text-decoration: none;

View file

@ -8,7 +8,12 @@
title="List sorted automatically" title="List sorted automatically"
/> />
{{ list[listIndex].name }} ({{ gameList.length }}) {{ list[listIndex].name }}
<span
v-if="showGameCount"
>
({{ gameList.length }})
</span>
</span> </span>
<list-settings-modal :list-index="listIndex" /> <list-settings-modal :list-index="listIndex" />
@ -201,6 +206,10 @@ export default {
return this.list.length === 1; return this.list.length === 1;
}, },
showGameCount() {
return this.settings[this.platform.code].showGameCount;
},
gameCardComponent() { gameCardComponent() {
return this.view && Object.keys(this.gameCardComponents).includes(this.view) return this.view && Object.keys(this.gameCardComponents).includes(this.view)
? this.gameCardComponents[this.view] ? this.gameCardComponents[this.view]
@ -281,7 +290,7 @@ export default {
position: relative; position: relative;
width: 300px; width: 300px;
background: var(--list-background); background: var(--list-background);
border-radius: $border-radius; border-radius: var(--border-radius);
overflow: hidden; overflow: hidden;
margin-right: $gp; margin-right: $gp;
max-height: calc(100vh - 100px); max-height: calc(100vh - 100px);
@ -314,7 +323,7 @@ export default {
justify-content: space-between; justify-content: space-between;
padding-left: $gp / 2; padding-left: $gp / 2;
position: absolute; position: absolute;
border-radius: $border-radius; border-radius: var(--border-radius);
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
width: 100%; width: 100%;

View file

@ -131,7 +131,7 @@ export default {
overflow-y: auto; overflow-y: auto;
margin: $gp * 2 auto $gp; margin: $gp * 2 auto $gp;
padding: 0; padding: 0;
border-radius: $border-radius; border-radius: var(--border-radius);
cursor: default; cursor: default;
@media($small) { @media($small) {

View file

@ -77,7 +77,7 @@ export default {
width: var(--placeholder-image-width, 80px); width: var(--placeholder-image-width, 80px);
height: var(--placeholder-image-height, 120px); height: var(--placeholder-image-height, 120px);
@extend .animated-background; @extend .animated-background;
border-radius: $border-radius / 2; border-radius: var(--border-radius) / 2;
} }
.text { .text {
@ -88,7 +88,7 @@ export default {
width: var(--placeholder-text-width, 100%); width: var(--placeholder-text-width, 100%);
height: var(--placeholder-text-height, 12px); height: var(--placeholder-text-height, 12px);
margin-bottom: $gp / 2; margin-bottom: $gp / 2;
border-radius: $border-radius / 2; border-radius: var(--border-radius) / 2;
@extend .animated-background; @extend .animated-background;
} }
</style> </style>

View file

@ -92,7 +92,7 @@ export default {
margin-bottom: $gp; margin-bottom: $gp;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border-radius: $border-radius; border-radius: var(--border-radius);
overflow: hidden; overflow: hidden;
width: 180px; width: 180px;
height: 100px; height: 100px;
@ -135,7 +135,7 @@ export default {
padding: 0 $gp / 4; padding: 0 $gp / 4;
color: var(--primary-text-color); color: var(--primary-text-color);
font-size: 10px; font-size: 10px;
border-bottom-left-radius: $border-radius; border-bottom-left-radius: var(--border-radius);
} }
} }

View file

@ -72,7 +72,7 @@ export default {
.thumbnail { .thumbnail {
padding: $gp; padding: $gp;
border-radius: $border-radius; border-radius: var(--border-radius);
justify-content: center; justify-content: center;
text-align: center; text-align: center;
display: flex; display: flex;
@ -114,7 +114,7 @@ export default {
max-width: 100%; max-width: 100%;
align-self: center; align-self: center;
max-height: 50px; max-height: 50px;
border-radius: $border-radius; border-radius: var(--border-radius);
} }
.has-lists-badge { .has-lists-badge {

View file

@ -10,11 +10,13 @@
/> />
</div> --> </div> -->
<h3>Theme</h3>
<wallpaper-upload /> <wallpaper-upload />
<div class="setting" v-if="value[platform.code]"> <div class="setting" v-if="value[platform.code]">
<i class="fas fa-palette" /> <i class="fas fa-palette" />
<h5>Global theme</h5> <h5>Theme</h5>
<select v-model="value[platform.code].theme" @change="$emit('save')"> <select v-model="value[platform.code].theme" @change="$emit('save')">
<option <option
@ -27,6 +29,44 @@
</select> </select>
</div> </div>
<div class="setting">
<i class="fas fa-bars" />
<h5>Header position (only affects mobile)</h5>
<select v-model="value[platform.code].position" @change="$emit('save')">
<option
v-for="{ id, name } in positions"
:key="id"
:value="id"
>
{{ name }}
</option>
</select>
</div>
<div class="setting">
<i class="fas fa-shapes" />
<h5>Border Radius</h5>
<toggle-switch
id="borderRadius"
@change="$emit('save')"
v-model="value[platform.code].borderRadius"
/>
</div>
<h3>Gameboard</h3>
<div class="setting">
<i class="fas fa-heading" />
<h5>Show amount of games next to list title</h5>
<toggle-switch
id="showGameCount"
@change="$emit('save')"
v-model="value[platform.code].showGameCount"
/>
</div>
<div class="setting"> <div class="setting">
<i class="fas fa-exclamation-triangle" /> <i class="fas fa-exclamation-triangle" />
<h5>{{ $t('gameBoard.settings.dangerZone') }}</h5> <h5>{{ $t('gameBoard.settings.dangerZone') }}</h5>
@ -53,6 +93,7 @@
<script> <script>
import { mapState } from 'vuex'; import { mapState } from 'vuex';
import themes from '@/themes'; import themes from '@/themes';
import positions from '@/positions';
import Modal from '@/components/Modal'; import Modal from '@/components/Modal';
import WallpaperUpload from '@/components/WallpaperUpload'; import WallpaperUpload from '@/components/WallpaperUpload';
import ToggleSwitch from '@/components/ToggleSwitch'; import ToggleSwitch from '@/components/ToggleSwitch';
@ -74,6 +115,7 @@ export default {
data() { data() {
return { return {
themes, themes,
positions,
}; };
}, },

View file

@ -87,7 +87,7 @@ export default {
max-width: 300px; max-width: 300px;
opacity: 0; opacity: 0;
z-index: 1; z-index: 1;
border-radius: $border-radius; border-radius: var(--border-radius);
padding: $gp; padding: $gp;
transition: all 200ms linear; transition: all 200ms linear;

View file

@ -165,7 +165,7 @@ export default {
cursor: pointer; cursor: pointer;
height: auto; height: auto;
border: 1px solid transparent; border: 1px solid transparent;
border-radius: $border-radius; border-radius: var(--border-radius);
&:hover { &:hover {
border-color: var(--accent-color); border-color: var(--accent-color);

View file

@ -183,7 +183,7 @@ aside {
} }
.game-cover { .game-cover {
border-radius: $border-radius; border-radius: var(--border-radius);
} }
.game-title { .game-title {

View file

@ -140,6 +140,12 @@ export default {
overflow-x: overlay; overflow-x: overlay;
display: flex; display: flex;
@media($small) {
.bottom & {
padding: $gp $gp 0;
}
}
@media($small) { @media($small) {
&:not(.dragging) { &:not(.dragging) {
scroll-snap-type: mandatory; scroll-snap-type: mandatory;

View file

@ -7,6 +7,8 @@
class="settings" class="settings"
> >
<game-board-settings v-model="localSettings" @save="save" v-if="isGameBoard" /> <game-board-settings v-model="localSettings" @save="save" v-if="isGameBoard" />
<h3>Global</h3>
<tags-settings v-model="localSettings" /> <tags-settings v-model="localSettings" />
<div class="setting"> <div class="setting">
@ -78,6 +80,11 @@ export default {
theme: { theme: {
global: 'default', global: 'default',
}, },
position: {
global: 'top',
},
borderRadius: true,
showGameCount: false,
}, },
}; };
}, },
@ -109,6 +116,9 @@ export default {
if (this.platform && !this.localSettings[this.platform.code]) { if (this.platform && !this.localSettings[this.platform.code]) {
this.localSettings[this.platform.code] = { this.localSettings[this.platform.code] = {
theme: 'default', theme: 'default',
position: 'top',
borderRadius: true,
showGameCount: false,
}; };
} }
}, },
@ -180,7 +190,7 @@ export default {
.avatar { .avatar {
width: $avatarSize; width: $avatarSize;
height: $avatarSize; height: $avatarSize;
border-radius: $border-radius; border-radius: var(--border-radius);
overflow: hidden; overflow: hidden;
} }
</style> </style>

10
src/positions.js Normal file
View file

@ -0,0 +1,10 @@
export default [
{
name: 'Top',
id: 'top',
},
{
name: 'Bottom',
id: 'bottom',
},
];

View file

@ -20,7 +20,7 @@ button, a.link {
background: transparent; background: transparent;
color: inherit; color: inherit;
font: inherit; font: inherit;
border-radius: $border-radius; border-radius: var(--border-radius);
line-height: normal; line-height: normal;
-webkit-font-smoothing: inherit; -webkit-font-smoothing: inherit;
-moz-osx-font-smoothing: inherit; -moz-osx-font-smoothing: inherit;

View file

@ -1,7 +1,7 @@
textarea, input, select { textarea, input, select {
border: 1px solid #555555; border: 1px solid #555555;
background: #fff; background: #fff;
border-radius: $border-radius; border-radius: var(--border-radius);
height: 40px; height: 40px;
padding: 0 $gp / 2; padding: 0 $gp / 2;
width: 100%; width: 100%;
@ -83,7 +83,7 @@ input[type=range] {
width: 100%; width: 100%;
height: 36px; height: 36px;
border: 0; border: 0;
border-radius: $border-radius; border-radius: var(--border-radius);
padding: 0; padding: 0;
background: transparent; background: transparent;
overflow: hidden; overflow: hidden;
@ -106,7 +106,7 @@ input[type=range] {
cursor: pointer; cursor: pointer;
animate: 0.2s; animate: 0.2s;
background: var(--progress-primary-color); background: var(--progress-primary-color);
border-radius: $border-radius; border-radius: var(--border-radius);
overflow: hidden; overflow: hidden;
} }
@ -127,7 +127,7 @@ input[type=range] {
animate: 0.2s; animate: 0.2s;
overflow: hidden; overflow: hidden;
background: var(--progress-secondary-color); background: var(--progress-secondary-color);
border-radius: $border-radius; border-radius: var(--border-radius);
} }
&::-moz-range-thumb { &::-moz-range-thumb {
@ -160,13 +160,17 @@ input[type=range] {
} }
&::-ms-fill-lower { &::-ms-fill-lower {
background: var(--progress-primary-color); border-radius: var(--border-radius);
border-radius: $border-radius;
} }
&::-ms-fill-upper { &::-ms-fill-upper {
background: var(--progress-primary-color); background: var(--progress-primary-color);
border-radius: $border-radius; border-radius: var(--border-radius);
}
&::-ms-fill-upper {
background: var(--progress-primary-color);
border-radius: var(--border-radius);
} }
&::-ms-thumb { &::-ms-thumb {

View file

@ -7,7 +7,7 @@
background-color: rgba(255, 255, 255, .1); background-color: rgba(255, 255, 255, .1);
padding: $gp / 2; padding: $gp / 2;
margin-top: $gp / 2; margin-top: $gp / 2;
border-radius: $border-radius; border-radius: var(--border-radius);
} }
.markdown .octicon { .markdown .octicon {

View file

@ -8,7 +8,6 @@ $font-size-large: 18px;
$font-size-xlarge: 24px; $font-size-xlarge: 24px;
// Measurements // Measurements
$border-radius: 4px;
$gp: 16px; $gp: 16px;
$navHeight: 48px; $navHeight: 48px;
$container-width: 900px; $container-width: 900px;