dark mode support

This commit is contained in:
2023-04-09 17:37:35 +02:00
parent 5b8f1c03f7
commit c4abf91aeb
11 changed files with 109 additions and 35 deletions

View File

@@ -13,12 +13,46 @@
</template> </template>
<style> <style>
:root, :root.light {
--primary-color: #2c3e50;
--accent-background: rgb(30, 30, 82);
--secondary-color: white;
--background-color: white;
--accent-color: #42b983;
--hover-color: rgb(165, 165, 165);
--accent-background-hover: #4380a8;
--overlay-color: rgba(37, 37, 37, 0.575);
}
:root.dark {
--primary-color: white;
--accent-background: rgb(100, 100, 190);
--secondary-color: black;
--background-color: rgb(32, 32, 32);
--accent-color: #42b983;
--hover-color: rgb(165, 165, 165);
--accent-background-hover: #4380a8;
}
@media ( prefers-color-scheme: dark ) {
:root {
--primary-color: white;
--accent-background: rgb(100, 100, 190);
--secondary-color: black;
--background-color: rgb(32, 32, 32);
--accent-color: #42b983;
--hover-color: rgb(165, 165, 165);
--accent-background-hover: #4380a8;
}
}
html, html,
body { body {
width: 100%; width: 100%;
height: 100%; height: 100%;
margin: 0; margin: 0;
padding: 0; padding: 0;
background-color: var( --background-color );
} }
#app { #app {
@@ -26,7 +60,7 @@ body {
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
text-align: center; text-align: center;
color: #2c3e50; color: var( --primary-color );
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -38,7 +72,7 @@ nav {
nav a { nav a {
font-weight: bold; font-weight: bold;
color: #2c3e50; color: var( --primary-color );
} }
nav a.router-link-exact-active { nav a.router-link-exact-active {

View File

@@ -5,13 +5,13 @@
<h3>{{ eventInfo.date }}</h3> <h3>{{ eventInfo.date }}</h3>
<h3>{{ eventInfo.location }}</h3> <h3>{{ eventInfo.location }}</h3>
<h3>Selected tickets</h3> <h3>Selected tickets</h3>
<table> <table class="price-table">
<tr v-for="ticket in selectedSeats"> <tr v-for="ticket in selectedSeats">
<td>{{ seating[ ticket[ 1 ] ][ 'content' ][ ticket[ 0 ] ][ 'name' ] }}</td> <td>{{ seating[ ticket[ 1 ] ][ 'content' ][ ticket[ 0 ] ][ 'name' ] }} ({{ eventInfo[ 'ageGroups' ][ ticket[ 2 ] ][ 'name' ] }})</td>
<td>{{ eventInfo[ 'currency' ] }} {{ eventInfo[ 'categories' ][ seating[ ticket[ 1 ] ][ 'content' ][ ticket[ 0 ] ][ 'category' ] ][ 'price' ][ ticket[ 2 ] ] }}</td> <td>{{ eventInfo[ 'currency' ] }} {{ eventInfo[ 'categories' ][ seating[ ticket[ 1 ] ][ 'content' ][ ticket[ 0 ] ][ 'category' ] ][ 'price' ][ ticket[ 2 ] ] }}</td>
</tr> </tr>
</table> </table>
<h3>Total</h3> <h3>Total: {{ eventInfo[ 'currency' ] }} {{ total }}</h3>
<router-link to="/cart">To cart</router-link> <router-link to="/cart">To cart</router-link>
</div> </div>
<div class="seatingPlan"> <div class="seatingPlan">
@@ -63,7 +63,7 @@
<span class="material-symbols-outlined close-button" @click="closePlaceNotAvailablePopup()">close</span> <span class="material-symbols-outlined close-button" @click="closePlaceNotAvailablePopup()">close</span>
</div> </div>
<div class="popup-content-wrapper"> <div class="popup-content-wrapper">
<h3>One or more seat(s) you have previously selected are/is no longer available!</h3> <h3>One or more seat(s) you have previously selected is/are no longer available!</h3>
<p>Please select another one!</p> <p>Please select another one!</p>
<button class="button" @click="closePlaceNotAvailablePopup()">Ok</button> <button class="button" @click="closePlaceNotAvailablePopup()">Ok</button>
</div> </div>
@@ -84,9 +84,10 @@ export default {
data () { data () {
return { return {
seating: { 'r1': { 'name': 'Row 1', 'id': 'r1', 'content':{ 'S1':{ 'name': 'Seat 1', 'id': 'S1', 'available': true, 'selected': false, 'category':'1' } } }, 'r2': { 'name': 'Row 2', 'id': 'r2', 'content':{ 'S1':{ 'name': 'S1', 'id': 'S1', 'available': true, 'selected': false, 'category':'2' } } } }, seating: { 'r1': { 'name': 'Row 1', 'id': 'r1', 'content':{ 'S1':{ 'name': 'Seat 1', 'id': 'S1', 'available': true, 'selected': false, 'category':'1' } } }, 'r2': { 'name': 'Row 2', 'id': 'r2', 'content':{ 'S1':{ 'name': 'S1', 'id': 'S1', 'available': true, 'selected': false, 'category':'2' } } } },
eventInfo: { 'name': 'TestEvent', 'location': 'TestLocation', 'date': 'TestDate', 'RoomName': 'TestRoom', 'currency': 'CHF', 'categories': { '1': { 'price': { '1':25, '2':35 }, 'bg': 'black', 'fg': 'white' }, '2': { 'price': { '1':15, '2':20 }, 'bg': 'green', 'fg': 'white' } }, 'ageGroups': { '1':{ 'id': 1, 'name':'Child', 'age':'0 - 15.99' }, '2':{ 'id': 2, 'name': 'Adult', 'age': null } }, 'stage': true }, eventInfo: { 'name': 'TestEvent', 'location': 'TestLocation', 'date': 'TestDate', 'RoomName': 'TestRoom', 'currency': 'CHF', 'categories': { '1': { 'price': { '1':25, '2':35 }, 'bg': 'black', 'fg': 'white', 'name': 'Category 1' }, '2': { 'price': { '1':15, '2':20 }, 'bg': 'green', 'fg': 'white', 'name': 'Category 1' } }, 'ageGroups': { '1':{ 'id': 1, 'name':'Child', 'age':'0 - 15.99' }, '2':{ 'id': 2, 'name': 'Adult', 'age': null } }, 'ageGroupCount':2, 'stage': true },
selectedSeats: {}, selectedSeats: {},
pricingCurrentlySelected: {} pricingCurrentlySelected: {},
total: 0,
} }
}, },
methods: { methods: {
@@ -116,12 +117,20 @@ export default {
sessionStorage.setItem( 'selectedSeats', JSON.stringify( data ) ); sessionStorage.setItem( 'selectedSeats', JSON.stringify( data ) );
this.selectedSeats = data; this.selectedSeats = data;
this.sumUp();
}, },
sumUp () { sumUp () {
let data = {}; let data = {};
if ( sessionStorage.getItem( 'selectedSeats' ) ) { if ( sessionStorage.getItem( 'selectedSeats' ) ) {
data = JSON.parse( sessionStorage.getItem( 'selectedSeats' ) ); data = JSON.parse( sessionStorage.getItem( 'selectedSeats' ) );
} }
let price = 0;
for ( let i in data ) {
price += this.eventInfo[ 'categories' ][ this.seating[ data[ i ][ 1 ] ][ 'content' ][ data[ i ][ 0 ] ][ 'category' ] ][ 'price' ][ data[ i ][ 2 ] ];
}
this.total = price;
}, },
closePlaceNotAvailablePopup () { closePlaceNotAvailablePopup () {
$( '#placeNotAvailable' ).hide( 300 ); $( '#placeNotAvailable' ).hide( 300 );
@@ -148,8 +157,13 @@ export default {
sessionStorage.setItem( 'arrayIndex', index ); sessionStorage.setItem( 'arrayIndex', index );
sessionStorage.setItem( 'selectedSeats', JSON.stringify( data ) ); sessionStorage.setItem( 'selectedSeats', JSON.stringify( data ) );
this.selectedSeats = data; this.selectedSeats = data;
this.sumUp();
} else { } else {
$( '#overlay' ).show( 200 ); if ( this.eventInfo.ageGroupCount > 1 ) {
$( '#overlay' ).show( 200 );
} else {
this.storeSeat( '1' );
}
} }
this.pricingCurrentlySelected = this.eventInfo[ 'categories' ][ this.seating[ rowID ][ 'content' ][ placeID ][ 'category' ] ][ 'price' ]; this.pricingCurrentlySelected = this.eventInfo[ 'categories' ][ this.seating[ rowID ][ 'content' ][ placeID ][ 'category' ] ][ 'price' ];
@@ -177,6 +191,7 @@ export default {
sessionStorage.setItem( 'selectedSeats', JSON.stringify( data ) ); sessionStorage.setItem( 'selectedSeats', JSON.stringify( data ) );
this.selectedSeats = data; this.selectedSeats = data;
$( '#overlay' ).hide( 200 ); $( '#overlay' ).hide( 200 );
this.sumUp();
} }
}, },
created() { created() {
@@ -203,8 +218,8 @@ export default {
.sidebar { .sidebar {
grid-area: sidebar; grid-area: sidebar;
background-color: rgb(30, 30, 82); background-color: var( --accent-background );
color: white; color: var( --secondary-color );
overflow: scroll; overflow: scroll;
} }
@@ -222,7 +237,7 @@ export default {
} }
.occupied { .occupied {
background-color: rgb(177, 177, 177); background-color: var( --hover-color );
padding: 0.4%; padding: 0.4%;
} }
@@ -233,7 +248,7 @@ export default {
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
background-color: rgba(37, 37, 37, 0.575); background-color: var( --overlay-color );
height: 100%; height: 100%;
width: 100%; width: 100%;
} }
@@ -248,7 +263,7 @@ export default {
} }
.popup-content { .popup-content {
background-color: white; background-color: var( --background-color );
height: 60%; height: 60%;
width: 50%; width: 50%;
display: flex; display: flex;
@@ -283,7 +298,7 @@ export default {
list-style: none; list-style: none;
padding: 7px 15px; padding: 7px 15px;
border-radius: 10px; border-radius: 10px;
border-color: black; border-color: var( --primary-color );
border-style: solid; border-style: solid;
border-width: 1px; border-width: 1px;
margin: 3px 0px; margin: 3px 0px;
@@ -291,7 +306,7 @@ export default {
} }
.stage { .stage {
border-color: black; border-color: var( --primary-color );
border-style: solid; border-style: solid;
width: 80%; width: 80%;
height: 7%; height: 7%;
@@ -302,8 +317,8 @@ export default {
} }
.button { .button {
background-color: rgb(38, 38, 68); background-color: var( --accent-background );
color: white; color: var( --secondary-color );
font-weight: bold; font-weight: bold;
font-size: 110%; font-size: 110%;
border-radius: 20px; border-radius: 20px;
@@ -313,8 +328,12 @@ export default {
} }
.button:hover { .button:hover {
background-color: rgb(74, 74, 138); background-color: var( --accent-background-hover );
transition: 0.3s; transition: 0.3s;
cursor: pointer; cursor: pointer;
} }
.price-table {
width: 100%;
}
</style> </style>

View File

@@ -42,7 +42,7 @@
} }
.login-app { .login-app {
background-color: white; background-color: var( --background-color );
width: 40%; width: 40%;
height: 50%; height: 50%;
display: flex; display: flex;

View File

@@ -2,7 +2,7 @@
<div class="order"> <div class="order">
<h1>Cart</h1> <h1>Cart</h1>
<h3>Your tickets</h3> <h3>Your tickets</h3>
<ul> <ul v-for="ticket in tickets">
<li>Ticket</li> <li>Ticket</li>
</ul> </ul>
<router-link to="/purchase">Purchase now</router-link> <router-link to="/purchase">Purchase now</router-link>
@@ -28,8 +28,8 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
text-decoration: none; text-decoration: none;
color: black; color: var( --primary-color );
border-color: black; border-color: var( --primary-color );
border-width: 1px; border-width: 1px;
height: fit-content; height: fit-content;
border-style: solid; border-style: solid;
@@ -38,7 +38,7 @@
} }
.ticket:hover { .ticket:hover {
background-color: rgb(165, 165, 165); background-color: var( --hover-color );
transition: 0.4s; transition: 0.4s;
} }
@@ -57,3 +57,18 @@
margin-right: auto margin-right: auto
} }
</style> </style>
<script>
export default {
data() {
return {
tickets: {}
}
},
methods: {
loadCart () {
sessionStorage.getItem( 'selectedSeats' );
}
},
}
</script>

View File

@@ -1,5 +1,5 @@
<template> <template>
<initial formData="formData"></initial> <initial :formData="formData"></initial>
</template> </template>
<script> <script>

View File

@@ -30,6 +30,8 @@
</script> </script>
<style scoped> <style scoped>
/* TODO: Update colour to image */
.login { .login {
background-color: green; background-color: green;
width: 100%; width: 100%;
@@ -43,7 +45,7 @@
} }
.login-app { .login-app {
background-color: white; background-color: var( --background-color );
width: 40%; width: 40%;
height: 50%; height: 50%;
display: flex; display: flex;

View File

@@ -41,8 +41,8 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
text-decoration: none; text-decoration: none;
color: black; color: var( --primary-color );
border-color: black; border-color: var( --primary-color );
border-width: 1px; border-width: 1px;
height: fit-content; height: fit-content;
border-style: solid; border-style: solid;
@@ -51,7 +51,7 @@
} }
.ticket:hover { .ticket:hover {
background-color: rgb(165, 165, 165); background-color: var( --hover-color );
transition: 0.4s; transition: 0.4s;
} }

View File

@@ -24,8 +24,8 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
text-decoration: none; text-decoration: none;
color: black; color: var( --primary-color );
border-color: black; border-color: var( --primary-color );
border-width: 1px; border-width: 1px;
height: fit-content; height: fit-content;
border-style: solid; border-style: solid;
@@ -34,7 +34,7 @@
} }
.ticket:hover { .ticket:hover {
background-color: rgb(165, 165, 165); background-color: var( --hover-color );
transition: 0.4s; transition: 0.4s;
} }

View File

@@ -50,6 +50,8 @@
background-color: white; background-color: white;
width: 40%; width: 40%;
height: 50%; height: 50%;
min-height: fit-content;
min-width: fit-content;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;

View File

@@ -58,7 +58,7 @@
height: 100%; height: 100%;
padding: 0; padding: 0;
margin: 0; margin: 0;
background-color: rgb(30, 30, 82); background-color: var( --accent-background );
justify-content: center; justify-content: center;
} }
@@ -72,11 +72,11 @@
} }
nav a.router-link-exact-active { nav a.router-link-exact-active {
background-color: #4380a8; background-color: var( --accent-background-hover );
} }
.admin-menu:hover { .admin-menu:hover {
background-color: #4380a8; background-color: var( --accent-background-hover );
transition: 0.4s; transition: 0.4s;
} }

2
website/src/setup.md Normal file
View File

@@ -0,0 +1,2 @@
# Setup
In this tutorial, you are going to learn how to set up and configure myevent.