Improve UI of concertListItem and eventListItem

This commit is contained in:
2024-10-10 18:43:38 +02:00
parent 5f8adbaf10
commit ba752fa906
13 changed files with 204 additions and 153 deletions

View File

@@ -1,11 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
defineProps({ defineProps({
/** Image to display on the left side */ /** Image to display on the left side (if prepend slot is not in use) */
image: String, image: String,
/** Title in the top bar */
title: String,
/** Make the CardView click- and hoverable */ /** Make the CardView click- and hoverable */
link: { link: {
type: Boolean, type: Boolean,
@@ -18,7 +15,7 @@ defineProps({
/** Height of the card, default 140px */ /** Height of the card, default 140px */
height: { height: {
type: Number, type: Number,
default: 200 default: 140
}, },
colorHeader: String colorHeader: String
@@ -29,54 +26,68 @@ defineProps({
<v-card <v-card
variant="tonal" variant="tonal"
:link="link" :link="link"
:height="height"
> >
<v-card-title v-if="title" color="primary" class="pa-0"> <v-row
<v-sheet color="primary" class="pl-2 py-1"> no-gutters
{{ title }} >
</v-sheet> <!-- First col for image or prepend text -->
</v-card-title>
<v-row :height="height">
<!-- First col for image -->
<v-col <v-col
cols="3" :cols="!$slots.prepend ? 'auto' : 2"
> >
<v-skeleton-loader <v-skeleton-loader
v-if="!$slots.prepend"
type="image" type="image"
:loading="loading" :loading="loading"
> >
<v-img <v-img
:src="image" :src="image"
:height="height" :height="height"
:width="100" :width="height"
aspect-ratio="1"
cover cover
/> />
</v-skeleton-loader> </v-skeleton-loader>
<v-skeleton-loader
v-else
type="text"
:loading="loading"
>
<v-sheet
:height="height"
width="100%"
class="text-center d-flex justify-center align-center"
>
<slot name="prepend" />
</v-sheet>
</v-skeleton-loader>
</v-col> </v-col>
<v-divider vertical v-if="$slots.prepend" />
<!-- Second col for main content --> <!-- Second col for main content -->
<v-col <v-col
cols="7" class="pl-2"
class="text-h5"
> >
<v-skeleton-loader <v-skeleton-loader
:loading="loading" :loading="loading"
type="sentences" type="sentences"
class="my-2"
> >
<div> <v-sheet
:height="height"
>
<slot name="content" /> <slot name="content" />
</div> </v-sheet>
</v-skeleton-loader> </v-skeleton-loader>
</v-col> </v-col>
<v-divider vertical class="mt-3" /> <v-divider vertical />
<!-- Third col for append content after the divider --> <!-- Third col for append content after the divider -->
<v-col <v-col
cols="2" class="text-center d-flex justify-center align-center"
class="text-center pr-5 text-h5 d-flex justify-center align-center" cols="3"
lg="2"
> >
<slot name="append"></slot> <slot name="append"></slot>
</v-col> </v-col>

View File

@@ -42,7 +42,6 @@ defineProps({
/> />
</template> </template>
</v-img> </v-img>
</v-skeleton-loader> </v-skeleton-loader>
<v-skeleton-loader <v-skeleton-loader
@@ -64,7 +63,7 @@ defineProps({
type="sentences" type="sentences"
:loading="loading" :loading="loading"
> >
<div class="px-4 pb-4" v-if="$slots.default"> <div class="px-4 pb-4 text-disabled" v-if="$slots.default">
<slot></slot> <slot></slot>
</div> </div>
</v-skeleton-loader> </v-skeleton-loader>

View File

@@ -1,62 +1,68 @@
<script setup lang="ts"> <script setup lang="ts">
import cardWithLeftImage from '../basics/cardViewLeftImage.vue'; import cardViewHorizontal from '@/components/basics/cardViewHorizontal.vue';
import { ConcertModel } from '@/data/models/acts/concertModel';
defineProps({ defineProps({
/** Image to print on the left side */ concert: ConcertModel,
image: String, date: String,
title: String, title: String,
loading: Boolean, description: String,
appendIcon: { eventName: String,
type: String, price: Number,
default: "mdi-ticket" loading: Boolean
},
appendIconColor: {
type: String,
default: "secondary"
},
link: {
type: Boolean,
default: true
}
}) })
</script> </script>
<template> <template>
<v-row v-if="!loading"> <card-view-horizontal v-if="!loading">
<v-col> <template #prepend>
<card-with-left-image <div>
:title="title" <div class="text-h4">
:image="'http://localhost:3000/static/' + image" {{ String(new Date(date).getDate()).padStart(2, "0") }}
:link="link" </div>
>
<div class="text-h6">
{{ new Date(date).toLocaleString('default', { month: 'long' }) }}
</div>
<div class="text-h6">
{{ new Date(date).getFullYear() }}
</div>
</div>
</template>
<template #content> <template #content>
<div> <div>
<slot name="content" /> <div class="text-h4 font-weight-black pt-2 h-100">
{{ title }}
</div>
<div class="text-disabled">
<slot name="description" />
</div>
</div> </div>
</template> </template>
<template #append> <template #append>
<div> <div>
<div> <div class="text-secondary font-weight-medium text-body-1 pb-1">
<v-icon {{ $t('from') + ' ' + price.toFixed(2) + ' €' }}
:icon="appendIcon" </div>
:color="appendIconColor"
size="x-large" <div>
/> <v-btn variant="flat" color="secondary">
{{ $t('goToTheConcert') }}
</v-btn>
</div> </div>
<slot name="append-text"></slot>
</div> </div>
</template> </template>
</card-with-left-image> </card-view-horizontal>
</v-col>
</v-row>
<v-row v-else> <card-view-horizontal
<v-col> v-else
<card-with-left-image :loading="loading"> :loading="loading"
>
<v-skeleton-loader <v-skeleton-loader
type="text" /> type="text" />
</card-with-left-image> </card-view-horizontal>
</v-col>
</v-row>
</template> </template>

View File

@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { ConcertModel } from '@/data/models/acts/concertModel'; import { ConcertModel } from '@/data/models/acts/concertModel';
import cardWithLeftImage from '../basics/cardViewLeftImage.vue'; import cardWithLeftImage from '../basics/cardViewHorizontal.vue';
import { dateStringToHumanReadableString, dateToHumanReadableString } from '@/scripts/dateTimeScripts'; import { dateStringToHumanReadableString, dateToHumanReadableString } from '@/scripts/dateTimeScripts';
defineProps({ defineProps({

View File

@@ -20,6 +20,7 @@ export class LocationModel {
date: string date: string
price: number price: number
inStock: number inStock: number
location: string
event: { event: {
name: string name: string
offered: boolean offered: boolean

View File

@@ -143,7 +143,7 @@
"loading": "Lade", "loading": "Lade",
"orderSummary": "Bestellübersicht", "orderSummary": "Bestellübersicht",
"basket": "Warenkorb", "basket": "Warenkorb",
"event": "Event", "event": "Event | Events",
"hello": "Hallo", "hello": "Hallo",
"accountManagement": "Account verwalten", "accountManagement": "Account verwalten",
"accountManagementDescription": "Persönliche Daten, Adressen, Bezahlmethoden", "accountManagementDescription": "Persönliche Daten, Adressen, Bezahlmethoden",
@@ -168,5 +168,6 @@
"resetExerciseProgressConfirm": { "resetExerciseProgressConfirm": {
"title": "Übungsfortschritt zurücksetzen?", "title": "Übungsfortschritt zurücksetzen?",
"description": "Soll der Bearbeitungsfortschritt der Übungen wirklich zurückgesetzt werden? Dies kann nicht rückgänig gemacht werden!" "description": "Soll der Bearbeitungsfortschritt der Übungen wirklich zurückgesetzt werden? Dies kann nicht rückgänig gemacht werden!"
} },
"goToTheConcert": "Zum Konzert"
} }

View File

@@ -143,7 +143,7 @@
"loading": "Loading", "loading": "Loading",
"orderSummary": "Order Summary", "orderSummary": "Order Summary",
"basket": "Basket", "basket": "Basket",
"event": "Event", "event": "Event | Events",
"hello": "Hello", "hello": "Hello",
"accountManagement": "Account Management", "accountManagement": "Account Management",
"accountManagementDescription": "Contact data, Addresses, Payment methods", "accountManagementDescription": "Contact data, Addresses, Payment methods",
@@ -168,5 +168,6 @@
"resetExerciseProgressConfirm": { "resetExerciseProgressConfirm": {
"title": "Reset Exercise progress?", "title": "Reset Exercise progress?",
"description": "Do you really want to reset the exercise progress? This can't be undone!" "description": "Do you really want to reset the exercise progress? This can't be undone!"
} },
"goToTheConcert": "To the concert"
} }

View File

@@ -1,6 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { BandModel } from '@/data/models/acts/bandModel'; import { BandModel } from '@/data/models/acts/bandModel';
import { dateStringToHumanReadableString } from '@/scripts/dateTimeScripts';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useFeedbackStore } from '@/data/stores/feedbackStore'; import { useFeedbackStore } from '@/data/stores/feedbackStore';
import concertListItem from '@/components/pageParts/concertListItem.vue'; import concertListItem from '@/components/pageParts/concertListItem.vue';
@@ -26,43 +25,20 @@ defineProps({
<v-row v-else v-for="concert of band.events[0].concerts"> <v-row v-else v-for="concert of band.events[0].concerts">
<v-col> <v-col>
<concert-list-item <concert-list-item
:title="dateStringToHumanReadableString(concert.date)" :date="concert.date"
:image="concert.location.imageOutdoor" :price="concert.price"
@click="(concert.inStock > 0) && router.push('/concert/' + concert.id)" :title="concert.location.city.name"
:description="concert.location.name"
:link="concert.inStock > 0" :link="concert.inStock > 0"
:append-icon="concert.inStock == 0 ? 'mdi-minus-circle' : 'mdi-ticket'" @click="(concert.inStock > 0) && router.push('/concert/' + concert.id)"
:append-icon-color="concert.inStock > 0 ? 'green' : 'red'"
> >
<template #description> <template #description>
<v-row> <div>
<v-col cols="auto" class="d-flex justify-center align-center px-0">
<v-btn
icon="mdi-map"
variant="text"
size="x-large"
@click="router.push('/locations/' + concert.location.name.replaceAll(' ', '-').toLowerCase())"
/>
</v-col>
<v-col>
<div class="text-h6">
{{ concert.location.name }} {{ concert.location.name }}
</div> </div>
<div class="text-h6"> <div>
{{ concert.location.city.name }} {{ band.name }} - {{ band.events[0].name }}
</div>
</v-col>
</v-row>
</template>
<template #append-text>
<div class="pb-3" v-if="concert.inStock > 0">
{{ concert.price.toFixed(2) }}
</div>
<div v-else>
{{ $t('soldOut') }}
</div> </div>
</template> </template>
</concert-list-item> </concert-list-item>

View File

@@ -0,0 +1,67 @@
<script setup lang="ts">
import { createDateRangeString, lowestTicketPrice } from '@/scripts/concertScripts';
import cardViewHorizontal from '@/components/basics/cardViewHorizontal.vue';
import { EventModel } from '@/data/models/acts/eventModel';
import { useRouter } from 'vue-router';
const router = useRouter()
defineProps({
event: EventModel,
loading: Boolean
})
</script>
<template>
<card-view-horizontal
v-if="!loading"
:image="'http://localhost:3000/static/' + event.image"
@click="router.push('/bands/' + event.band.name.replaceAll(' ', '-').toLowerCase())"
>
<template #content>
<div class="text-h6 font-weight-black pt-1">
{{ event.band.name }} - {{ event.name }}
</div>
<div class="descriptionShort mb-2 pr-4 text-disabled" >
{{ event.band.descriptionDe }}
</div>
<div class="text-disabled">
{{ createDateRangeString(event) }} - {{ event.concerts.length }} {{ $t('concert', event.concerts.length) }}
</div>
</template>
<template #append>
<div>
<div class="text-secondary font-weight-medium text-body-1 pb-1">
{{ $t('from') + ' ' + lowestTicketPrice(event) + ' €' }}
</div>
<div>
<v-btn variant="flat" color="secondary">
{{ event.concerts.length }} {{ $t('concert', event.concerts.length) }}
</v-btn>
</div>
</div>
</template>
</card-view-horizontal>
<card-view-horizontal
:loading="loading"
v-else
>
<v-skeleton-loader
type="text" />
</card-view-horizontal>
</template>
<style scoped>
.descriptionShort {
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2; /* number of lines to show */
line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>

View File

@@ -1,11 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { createDateRangeString, lowestTicketPrice } from '@/scripts/concertScripts';
import filterBar from './filterBar.vue'; import filterBar from './filterBar.vue';
import { useRouter, useRoute } from 'vue-router'; import { useRouter, useRoute } from 'vue-router';
import { useShoppingStore } from '@/data/stores/shoppingStore'; import { useShoppingStore } from '@/data/stores/shoppingStore';
import { useFeedbackStore } from '@/data/stores/feedbackStore'; import { useFeedbackStore } from '@/data/stores/feedbackStore';
import concertListItem from '@/components/pageParts/concertListItem.vue'; import eventListItem from './eventListItem.vue';
import { useTemplateRef } from 'vue';
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
@@ -32,36 +30,22 @@ shoppingStore.getEvents()
</v-col> </v-col>
</v-row> </v-row>
<concert-list-item <event-list-item
v-if="feedbackStore.fetchDataFromServerInProgress" v-if="feedbackStore.fetchDataFromServerInProgress"
v-for="i in 3" v-for="i in 3"
:loading="true" :loading="true"
/> />
<concert-list-item <v-row
v-else-if="shoppingStore.events.length > 0" v-else-if="shoppingStore.events.length > 0"
v-for="event of shoppingStore.events" v-for="event of shoppingStore.events"
:image="event.image"
@click="router.push('/bands/' + event.band.name.replaceAll(' ', '-').toLowerCase())"
> >
<template #content> <v-col>
<div class="text-h4"> <event-list-item
{{ event.band.name + ' - ' + event.name }} :event="event"
</div> />
</v-col>
<div class="text-h5"> </v-row>
{{ createDateRangeString(event) }}
</div>
<div class="text-h5">
{{ event.concerts.length }} {{ $t('concert', event.concerts.length) }}
</div>
</template>
<template #append-text>
{{ $t('from') + ' ' + lowestTicketPrice(event) + ' €' }}
</template>
</concert-list-item>
<v-row v-else> <v-row v-else>
<v-col> <v-col>

View File

@@ -57,18 +57,23 @@ getLocation(String(router.currentRoute.value.params.locationName))
</v-col> </v-col>
</v-row> </v-row>
<concert-list-item <v-row
v-else-if="location.concerts.length > 0" v-else-if="location.concerts.length > 0"
v-for="concert of location.concerts" v-for="concert of location.concerts"
:image="concert.event.image"
:title="concert.event.bandName + ' - ' + concert.event.name"
:description="dateStringToHumanReadableString(concert.date)"
:onClick="() => router.push('/bands/' + concert.event.bandName.replaceAll(' ', '-').toLowerCase())"
> >
<template #append-text> <v-col>
{{ $t('from') + ' ' + concert.price.toFixed(2) + ' €' }} <concert-list-item
:date="concert.date"
:title="concert.event.name"
:price="concert.price"
@click="() => router.push('/bands/' + concert.event.bandName.replaceAll(' ', '-').toLowerCase())"
>
<template #description>
{{ concert.event.bandName }}
</template> </template>
</concert-list-item> </concert-list-item>
</v-col>
</v-row>
<v-row v-else> <v-row v-else>
<v-col> <v-col>

View File

@@ -17,7 +17,7 @@ const vuetify = createVuetify({
dark: true, dark: true,
colors: { colors: {
primary: colors.blue.darken4, primary: colors.blue.darken4,
secondary: colors.blue.lighten2, secondary: colors.blue.lighten1,
sheet: colors.grey.darken4 sheet: colors.grey.darken4
} }
}, },
@@ -25,7 +25,7 @@ const vuetify = createVuetify({
dark: false, dark: false,
colors: { colors: {
primary: colors.blue.darken4, primary: colors.blue.darken4,
secondary: colors.blue.darken2, secondary: colors.blue.darken1,
sheet: colors.grey.lighten3 sheet: colors.grey.lighten3
} }
}, },

View File

@@ -70,7 +70,7 @@ export function createDateRangeString(event: EventModel) {
if (dateArray.length > 1) { if (dateArray.length > 1) {
return dateToHumanReadableString(dateArray[0]) + ' - ' + return dateToHumanReadableString(dateArray[0]) + ' ' +
dateToHumanReadableString(dateArray[dateArray.length - 1]) dateToHumanReadableString(dateArray[dateArray.length - 1])
} else { } else {
return dateToHumanReadableString(dateArray[0]) return dateToHumanReadableString(dateArray[0])