Updates from designer

This commit is contained in:
Kasper Rynning-Tønnesen
2020-01-29 16:29:47 +01:00
parent ed31e922c0
commit 46d83b9feb
7 changed files with 227 additions and 96 deletions

View File

@@ -1,9 +1,7 @@
<template> <template>
<div class="container"> <div class="container">
<h1 class="title" @click="startCountdown">Loddgenerator</h1> <h1 class="title" @click="startCountdown">Loddgenerator</h1>
<p class="subtext"> <p class="subtext">Velg hvilke farger du vil ha, fyll inn antall lodd og klikk 'generer'</p>
Velg hvilke farger du vil ha, fyll inn antall lodd og klikk 'generer'
</p>
<div class="input-line"> <div class="input-line">
<label for="redCheckbox"> <label for="redCheckbox">
<input type="checkbox" id="redCheckbox" v-model="redCheckbox" /> <input type="checkbox" id="redCheckbox" v-model="redCheckbox" />
@@ -53,6 +51,13 @@
></div> ></div>
</div> </div>
<div class="color-count-container" v-if="generated && !generating">
<span>Rød: {{red}}</span>
<span>Blå: {{blue}}</span>
<span>Gul: {{yellow}}</span>
<span>Grønn: {{green}}</span>
</div>
<Vipps class="vipps" :amount="numberOfBallots" /> <Vipps class="vipps" :amount="numberOfBallots" />
<Countdown :hardEnable="hardStart" @countdown="changeEnabled" /> <Countdown :hardEnable="hardStart" @countdown="changeEnabled" />
</div> </div>
@@ -83,7 +88,9 @@ export default {
greenCheckbox: true, greenCheckbox: true,
yellowCheckbox: true, yellowCheckbox: true,
blueCheckbox: true, blueCheckbox: true,
hardStart: false hardStart: false,
generated: false,
generating: false
}; };
}, },
watch: { watch: {
@@ -105,7 +112,10 @@ export default {
this.hardStart = true; this.hardStart = true;
}, },
generateColors: function(event, time) { generateColors: function(event, time) {
this.generating = true;
if (time == 5) { if (time == 5) {
this.generating = false;
this.generated = true;
if (this.numberOfBallots > 1 && new Set(this.colors).size == 1) { if (this.numberOfBallots > 1 && new Set(this.colors).size == 1) {
alert("BINGO"); alert("BINGO");
} }
@@ -212,6 +222,16 @@ p {
margin: 0; margin: 0;
} }
.color-count-container {
margin: auto;
width: 20vw;
justify-content: space-around;
align-items: center;
display: flex;
font-family: Arial;
margin-top: 35px;
}
.input-line { .input-line {
margin: auto; margin: auto;
display: flex; display: flex;
@@ -243,7 +263,7 @@ p {
} }
.vipps { .vipps {
margin: 8rem auto 2.5rem auto; margin: 5rem auto 2.5rem auto;
@include mobile { @include mobile {
margin-top: 2rem; margin-top: 2rem;

View File

@@ -15,12 +15,12 @@
<TotalBought /> <TotalBought />
<hr class="bought-and-highscore-separator" /> <hr class="bought-and-highscore-separator" />
<div class="highscore-and-wines"> <div class="highscore-and-wines">
<Highscore /> <Highscore class="highscore-container" />
<Wines class="wines-container" /> <Wines class="wines-container" />
</div> </div>
</div> </div>
<div class="vipps-outer-container"> <div class="vipps-outer-container">
<Vipps class="vipps-container" /> <Vipps class="vipps-inner-container" />
</div> </div>
</div> </div>
</div> </div>
@@ -86,7 +86,11 @@ export default {
margin: auto; margin: auto;
justify-content: space-evenly; justify-content: space-evenly;
align-items: center; align-items: center;
padding: 0 25px; padding: 0 30px;
@include mobile {
padding: 0 20px;
}
} }
.title { .title {
@@ -113,10 +117,27 @@ export default {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
padding-top: 1.5rem; padding-top: 1.5rem;
} justify-content: space-between;
.wines-container { @include mobile {
margin-left: 30px; padding: 0 20px;
}
.highscore-container {
width: 35%;
@include mobile {
width: 100%;
}
}
.wines-container {
width: 65%;
@include mobile {
width: 100%;
}
}
} }
.vipps-outer-container { .vipps-outer-container {
@@ -177,10 +198,14 @@ h1 {
display: inline-block; display: inline-block;
} }
.vipps-container { .vipps-inner-container {
margin-top: 15px; margin-top: 15px;
margin-bottom: 15px; margin-bottom: 15px;
margin-left: 30px; margin-left: 30px;
@include mobile {
margin: auto;
}
} }
.chart-container { .chart-container {
@@ -188,7 +213,7 @@ h1 {
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 100vw; width: 99vw;
max-width: 1400px; max-width: 1400px;
margin: auto; margin: auto;
padding: 50px 0; padding: 50px 0;

View File

@@ -27,22 +27,39 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.highscores { @import "../styles/media-queries.scss";
padding-right: 50px;
}
div { div {
margin: 15px 0 0 0; margin: 0;
font-family: Arial; font-family: Arial;
display: inline-flex; display: inline-flex;
flex-direction: column; flex-direction: column;
} }
ol { ol {
padding-left: 1.375rem !important; padding-left: 1.375rem !important;
margin-left: 0; margin-left: 0;
margin: 0 0 1.5em;
li { padding: 0;
counter-reset: item;
& > li {
padding: 2.5px 0; padding: 2.5px 0;
width: max-content; width: max-content;
margin: 0 0 0 -1.25rem;
padding: 0;
list-style-type: none;
counter-increment: item;
&:before {
display: inline-block;
width: 1em;
padding-right: 0.5rem;
font-weight: bold;
text-align: right;
content: counter(item) ".";
}
@include mobile {
padding: 5px 0;
}
} }
} }
</style> </style>

View File

@@ -134,13 +134,13 @@ export default {
.chart { .chart {
height: 40vh; height: 40vh;
max-height: 364px; max-height: 500px;
@include mobile { @include mobile {
position: relative; position: relative;
width: 90vw !important; width: 90vw !important;
max-height: unset; max-height: unset;
height: 50vh; height: 30vh;
margin-bottom: 2rem; margin-bottom: 2rem;
} }
} }

View File

@@ -4,11 +4,11 @@
<div class="bought-container"> <div class="bought-container">
<div <div
v-for="color in colors" v-for="color in colors"
:class="color.name + '-container inner-bought-container'" :class="color.name + '-container ' + color.name + '-ballot inner-bought-container ballot-element'"
:key="color.name" :key="color.name"
> >
<div class="number-container"> <div class="number-container">
<span :class="color.name + ' bought-number-span'"> <span class="color-total bought-number-span">
{{ {{
color.total color.total
}} }}
@@ -16,22 +16,19 @@
<span>kjøpte</span> <span>kjøpte</span>
</div> </div>
<div class="inner-text-container"> <div class="inner-text-container">
<div> <div>{{ color.win }} vinn</div>
{{ color.win }} vinn - <div>{{ color.totalPercentage }}% vinn</div>
<span class="small">{{ color.totalPercentage }}</span>%
</div>
<div>
<span :class="color.name + ' small'">{{ color.percentage }}</span>% vinn
</div>
</div> </div>
</div> </div>
<div class="total-container inner-bought-container"> <div class="inner-bought-container total-ballots">
<div> <div class="total-container">
Totalt&nbsp; Totalt&nbsp;
<span class="total">{{ total }}</span> kjøpt <div>
<span class="total">{{ total }}</span> kjøpte
</div>
<div>{{ totalWin }} vinn</div>
</div> </div>
<div>{{ totalWin }} vinn</div>
</div> </div>
</div> </div>
</div> </div>
@@ -128,12 +125,34 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: flex-start; align-items: center;
}
@include mobile { .ballot-element {
flex-direction: row; width: 140px;
justify-content: unset; height: 150px;
align-items: center; margin: 20px 0;
-webkit-mask-image: url(/../../public/assets/images/lodd.svg);
background-repeat: no-repeat;
mask-image: url(/../../public/assets/images/lodd.svg);
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
color: #333333;
&.green-ballot {
background-color: $light-green;
}
&.blue-ballot {
background-color: $light-blue;
}
&.yellow-ballot {
background-color: $light-yellow;
}
&.red-ballot {
background-color: $light-red;
} }
} }
@@ -148,20 +167,29 @@ export default {
} }
.inner-text-container { .inner-text-container {
padding-left: 5px; display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
// TODO fix styling for displaying in columns // TODO fix styling for displaying in columns
@include mobile { @include mobile {
margin-top: auto;
padding-bottom: 5px;
display: flex;
& div { & div {
padding: 0 5px; padding: 0 5px;
} }
} }
} }
.total-ballots {
width: 150px;
height: 150px;
margin: 20px 0;
}
.total-container {
align-items: flex-start;
}
@include mobile { @include mobile {
.total-container { .total-container {
> div:nth-of-type(2) { > div:nth-of-type(2) {
@@ -179,6 +207,7 @@ export default {
.bought-container { .bought-container {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap;
width: 100%; width: 100%;
padding-bottom: 3rem; padding-bottom: 3rem;
max-width: 1400px; max-width: 1400px;
@@ -191,10 +220,7 @@ export default {
} }
} }
.green, .color-total,
.blue,
.yellow,
.red,
.total { .total {
font-size: 2rem; font-size: 2rem;
font-weight: bold; font-weight: bold;
@@ -206,26 +232,9 @@ export default {
display: inline-block; display: inline-block;
} }
.green {
color: $green;
}
.red {
color: $red;
}
.yellow {
color: $yellow;
}
.blue {
color: $blue;
}
@include mobile { @include mobile {
.bought-container { .bought-container {
flex-wrap: wrap; flex-wrap: wrap;
flex-direction: column;
} }
} }
</style> </style>

View File

@@ -1,15 +1,26 @@
<template> <template>
<div class="vipps-container" @click="openVipps"> <div>
<img src="/public/assets/images/vipps-logo.svg" class="vipps-logo" alt="vipps logo" /> <div class="vipps-container" :class="isMobile ? 'clickable': null" @click="openVipps">
<span> <img src="/public/assets/images/vipps-logo.svg" class="vipps-logo" alt="vipps logo" />
kr. <span v-if="amount * 10 > 10">
<span class="big-money">{{ amount * 10 }},- (10,- pr. lodd)</span> kr.
</span> <span class="big-money">{{ amount * 10 }},-</span>
<ing src="/public/assets/images/vipps-qr.png" class="qr-logo" v-if="qrFailed" /> (10,- pr. lodd)
<canvas v-if="!qrFailed" ref="canvas" class="qr-logo"></canvas> </span>
<span class="phone-number">977 40 427</span> <span v-if="amount * 10 == 10">
<span class="name">Kasper Rynning-Tønnesen</span> kr.
<span class="mark-with">Merk med: Vinlodd/🍾</span> <span class="big-money">{{ amount * 10 }},-</span>
pr. lodd
</span>
<ing src="/public/assets/images/vipps-qr.png" class="qr-logo" v-if="qrFailed" />
<canvas v-if="!qrFailed" ref="canvas" class="qr-logo"></canvas>
<span class="phone-number">977 40 427</span>
<span class="name">Kasper Rynning-Tønnesen</span>
<span class="mark-with">Merk med: Vinlodd/🍾</span>
</div>
<p class="click-to-open-text" v-if="isMobile">
<i>Du kan også klikke QR-koden for å åpne i Vipps</i>
</p>
</div> </div>
</template> </template>
@@ -31,7 +42,6 @@ export default {
}, },
watch: { watch: {
amount: function(price) { amount: function(price) {
console.log("price is updated", price);
this.calculateQr(); this.calculateQr();
} }
}, },
@@ -39,6 +49,9 @@ export default {
this.calculateQr(); this.calculateQr();
}, },
computed: { computed: {
isMobile: function() {
return this.isMobileFunction();
},
price: function() { price: function() {
return this.amount * 1000; return this.amount * 1000;
}, },
@@ -85,7 +98,25 @@ export default {
context.fillText("🍾", centerX, centerY); context.fillText("🍾", centerX, centerY);
}, },
openVipps: function() { openVipps: function() {
if (!this.isMobileFunction()) {
return;
}
window.location.assign(this.vippsUrlBasedOnUserAgent); window.location.assign(this.vippsUrlBasedOnUserAgent);
},
isMobileFunction: function() {
if (
navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/iPod/i) ||
navigator.userAgent.match(/BlackBerry/i) ||
navigator.userAgent.match(/Windows Phone/i)
) {
return true;
} else {
return false;
}
} }
} }
}; };
@@ -96,9 +127,6 @@ export default {
@import "../styles/media-queries.scss"; @import "../styles/media-queries.scss";
.vipps-container { .vipps-container {
font-family: Arial; font-family: Arial;
}
.vipps-container {
border-radius: 10px; border-radius: 10px;
background-color: #ff5b23; background-color: #ff5b23;
display: flex; display: flex;
@@ -108,6 +136,9 @@ export default {
padding: 25px; padding: 25px;
width: 250px; width: 250px;
margin: auto 0; margin: auto 0;
}
.clickable {
cursor: pointer; cursor: pointer;
} }
@@ -143,6 +174,14 @@ export default {
@include mobile { @include mobile {
.vipps-container { .vipps-container {
margin-left: 0px; margin-left: 0px;
margin: auto;
}
.click-to-open-text {
width: 65%;
padding-top: 10px;
margin: auto;
text-align: center;
} }
} }
</style> </style>

View File

@@ -7,16 +7,16 @@
{{ wine.name }} - sett {{ wine.occurences }} ganger, {{ wine.name }} - sett {{ wine.occurences }} ganger,
{{ wine.rating }} i rating {{ wine.rating }} i rating
</span> </span>
<div class="inline-wine-name">
<span class="truncate">{{ wine.name }}</span>
</div>
- {{ wine.occurences }} gang(er)
<a <a
class="wine-link" class="wine-link"
:href="wine.vivinoLink" :href="wine.vivinoLink"
v-if="wine.vivinoLink != '' && wine.vivinoLink != null" v-if="wine.vivinoLink != '' && wine.vivinoLink != null"
@click="wineClick(wine)" @click="wineClick(wine)"
> >Les mer</a>
<span class="truncate">{{ wine.name }}</span>
- {{ wine.rating }} i
rating - {{ wine.occurences }} gang(er)
</a>
</li> </li>
</ol> </ol>
</div> </div>
@@ -54,31 +54,52 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../styles/media-queries.scss";
h3 { h3 {
text-align: left; text-align: left;
} }
div { div {
margin: 15px 0 0 0; margin: 0;
font-family: arial; font-family: arial;
display: inline-flex; display: inline-flex;
flex-direction: column; flex-direction: column;
} }
a { ol {
text-decoration: none; padding-left: 1.375rem !important;
color: #ff5b23; margin-left: 0;
padding: 2.5px 0; margin: 0 0 1.5em;
padding: 0;
counter-reset: item;
& > li {
margin: 0 0 0 -1.25rem;
padding: 0;
list-style-type: none;
counter-increment: item;
&:before {
display: inline-block;
width: 1em;
font-weight: bold;
text-align: right;
content: counter(item) ".";
}
@include mobile {
padding: 5px 0;
}
}
} }
ol { .inline-wine-name {
padding-left: 0; display: inline-flex;
margin-left: 0; padding: 0;
} }
.wine-link { .wine-link {
display: flex; color: #333333;
flex-direction: row; text-decoration: none;
align-items: center; font-weight: bold;
border-bottom: 1px solid #ff5fff;
} }
.truncate { .truncate {