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

View File

@@ -42,7 +42,6 @@ defineProps({
/>
</template>
</v-img>
</v-skeleton-loader>
<v-skeleton-loader
@@ -64,7 +63,7 @@ defineProps({
type="sentences"
: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>
</div>
</v-skeleton-loader>

View File

@@ -1,62 +1,68 @@
<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({
/** Image to print on the left side */
image: String,
concert: ConcertModel,
date: String,
title: String,
loading: Boolean,
appendIcon: {
type: String,
default: "mdi-ticket"
},
appendIconColor: {
type: String,
default: "secondary"
},
link: {
type: Boolean,
default: true
}
description: String,
eventName: String,
price: Number,
loading: Boolean
})
</script>
<template>
<v-row v-if="!loading">
<v-col>
<card-with-left-image
:title="title"
:image="'http://localhost:3000/static/' + image"
:link="link"
>
<card-view-horizontal v-if="!loading">
<template #prepend>
<div>
<div class="text-h4">
{{ String(new Date(date).getDate()).padStart(2, "0") }}
</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>
<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>
</template>
<template #append>
<div>
<div>
<v-icon
:icon="appendIcon"
:color="appendIconColor"
size="x-large"
/>
<div class="text-secondary font-weight-medium text-body-1 pb-1">
{{ $t('from') + ' ' + price.toFixed(2) + ' €' }}
</div>
<div>
<v-btn variant="flat" color="secondary">
{{ $t('goToTheConcert') }}
</v-btn>
</div>
<slot name="append-text"></slot>
</div>
</template>
</card-with-left-image>
</v-col>
</v-row>
</card-view-horizontal>
<v-row v-else>
<v-col>
<card-with-left-image :loading="loading">
<card-view-horizontal
v-else
:loading="loading"
>
<v-skeleton-loader
type="text" />
</card-with-left-image>
</v-col>
</v-row>
</card-view-horizontal>
</template>

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
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';
defineProps({

View File

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

View File

@@ -143,7 +143,7 @@
"loading": "Lade",
"orderSummary": "Bestellübersicht",
"basket": "Warenkorb",
"event": "Event",
"event": "Event | Events",
"hello": "Hallo",
"accountManagement": "Account verwalten",
"accountManagementDescription": "Persönliche Daten, Adressen, Bezahlmethoden",
@@ -168,5 +168,6 @@
"resetExerciseProgressConfirm": {
"title": "Übungsfortschritt zurücksetzen?",
"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",
"orderSummary": "Order Summary",
"basket": "Basket",
"event": "Event",
"event": "Event | Events",
"hello": "Hello",
"accountManagement": "Account Management",
"accountManagementDescription": "Contact data, Addresses, Payment methods",
@@ -168,5 +168,6 @@
"resetExerciseProgressConfirm": {
"title": "Reset Exercise progress?",
"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">
import { BandModel } from '@/data/models/acts/bandModel';
import { dateStringToHumanReadableString } from '@/scripts/dateTimeScripts';
import { useRouter } from 'vue-router';
import { useFeedbackStore } from '@/data/stores/feedbackStore';
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-col>
<concert-list-item
:title="dateStringToHumanReadableString(concert.date)"
:image="concert.location.imageOutdoor"
@click="(concert.inStock > 0) && router.push('/concert/' + concert.id)"
:date="concert.date"
:price="concert.price"
:title="concert.location.city.name"
:description="concert.location.name"
:link="concert.inStock > 0"
:append-icon="concert.inStock == 0 ? 'mdi-minus-circle' : 'mdi-ticket'"
:append-icon-color="concert.inStock > 0 ? 'green' : 'red'"
@click="(concert.inStock > 0) && router.push('/concert/' + concert.id)"
>
<template #description>
<v-row>
<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">
<div>
{{ concert.location.name }}
</div>
<div class="text-h6">
{{ concert.location.city.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>
{{ band.name }} - {{ band.events[0].name }}
</div>
</template>
</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">
import { createDateRangeString, lowestTicketPrice } from '@/scripts/concertScripts';
import filterBar from './filterBar.vue';
import { useRouter, useRoute } from 'vue-router';
import { useShoppingStore } from '@/data/stores/shoppingStore';
import { useFeedbackStore } from '@/data/stores/feedbackStore';
import concertListItem from '@/components/pageParts/concertListItem.vue';
import { useTemplateRef } from 'vue';
import eventListItem from './eventListItem.vue';
const route = useRoute()
const router = useRouter()
@@ -32,36 +30,22 @@ shoppingStore.getEvents()
</v-col>
</v-row>
<concert-list-item
<event-list-item
v-if="feedbackStore.fetchDataFromServerInProgress"
v-for="i in 3"
:loading="true"
/>
<concert-list-item
<v-row
v-else-if="shoppingStore.events.length > 0"
v-for="event of shoppingStore.events"
:image="event.image"
@click="router.push('/bands/' + event.band.name.replaceAll(' ', '-').toLowerCase())"
>
<template #content>
<div class="text-h4">
{{ event.band.name + ' - ' + event.name }}
</div>
<div class="text-h5">
{{ 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-col>
<event-list-item
:event="event"
/>
</v-col>
</v-row>
<v-row v-else>
<v-col>

View File

@@ -57,18 +57,23 @@ getLocation(String(router.currentRoute.value.params.locationName))
</v-col>
</v-row>
<concert-list-item
<v-row
v-else-if="location.concerts.length > 0"
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>
{{ $t('from') + ' ' + concert.price.toFixed(2) + ' €' }}
<v-col>
<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>
</concert-list-item>
</v-col>
</v-row>
<v-row v-else>
<v-col>

View File

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

View File

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