2019-01-21 14:08:22 +00:00
|
|
|
<template>
|
2020-11-30 09:24:11 +00:00
|
|
|
<router-link
|
|
|
|
class="card"
|
|
|
|
:to="{ name: 'Event', params: { uuid: event.uuid } }"
|
|
|
|
>
|
2019-10-14 09:41:57 +00:00
|
|
|
<div class="card-image">
|
2021-06-10 07:41:07 +00:00
|
|
|
<figure class="image is-16by9">
|
|
|
|
<lazy-image-wrapper
|
|
|
|
:picture="event.picture"
|
|
|
|
style="height: 100%; position: absolute; top: 0; left: 0; width: 100%"
|
|
|
|
/>
|
2020-12-01 11:33:17 +00:00
|
|
|
<div
|
|
|
|
class="tag-container"
|
|
|
|
v-if="event.tags || event.status !== EventStatus.CONFIRMED"
|
|
|
|
>
|
|
|
|
<b-tag type="is-info" v-if="event.status === EventStatus.TENTATIVE">
|
|
|
|
{{ $t("Tentative") }}
|
|
|
|
</b-tag>
|
|
|
|
<b-tag type="is-danger" v-if="event.status === EventStatus.CANCELLED">
|
|
|
|
{{ $t("Cancelled") }}
|
|
|
|
</b-tag>
|
2020-07-31 15:52:26 +00:00
|
|
|
<router-link
|
|
|
|
:to="{ name: RouteName.TAG, params: { tag: tag.title } }"
|
2020-12-01 16:34:17 +00:00
|
|
|
v-for="tag in (event.tags || []).slice(0, 3)"
|
2020-07-31 15:52:26 +00:00
|
|
|
:key="tag.slug"
|
|
|
|
>
|
|
|
|
<b-tag type="is-light">{{ tag.title }}</b-tag>
|
|
|
|
</router-link>
|
2019-04-24 18:49:52 +00:00
|
|
|
</div>
|
2019-01-21 14:08:22 +00:00
|
|
|
</figure>
|
|
|
|
</div>
|
2020-02-18 07:47:41 +00:00
|
|
|
<div class="card-content">
|
|
|
|
<div class="media">
|
|
|
|
<div class="media-left">
|
2020-11-30 09:24:11 +00:00
|
|
|
<date-calendar-icon
|
2021-06-10 07:41:07 +00:00
|
|
|
:small="true"
|
2020-11-30 09:24:11 +00:00
|
|
|
v-if="!mergedOptions.hideDate"
|
|
|
|
:date="event.beginsOn"
|
|
|
|
/>
|
2019-01-21 14:08:22 +00:00
|
|
|
</div>
|
2020-02-18 07:47:41 +00:00
|
|
|
<div class="media-content">
|
2021-02-12 17:19:49 +00:00
|
|
|
<p class="event-title" :title="event.title">{{ event.title }}</p>
|
|
|
|
<div
|
|
|
|
class="event-subtitle"
|
|
|
|
v-if="event.physicalAddress"
|
|
|
|
:title="
|
|
|
|
isDescriptionDifferentFromLocality
|
|
|
|
? `${event.physicalAddress.description}, ${event.physicalAddress.locality}`
|
|
|
|
: event.physicalAddress.description
|
|
|
|
"
|
|
|
|
>
|
2020-02-18 07:57:00 +00:00
|
|
|
<!-- <p>{{ $t('By @{username}', { username: actor.preferredUsername }) }}</p>-->
|
2021-02-12 17:19:49 +00:00
|
|
|
<span v-if="isDescriptionDifferentFromLocality">
|
2020-11-30 09:24:11 +00:00
|
|
|
{{ event.physicalAddress.description }},
|
|
|
|
{{ event.physicalAddress.locality }}
|
2020-02-18 07:47:41 +00:00
|
|
|
</span>
|
2021-02-12 17:19:49 +00:00
|
|
|
<span v-else>
|
|
|
|
{{ event.physicalAddress.description }}
|
|
|
|
</span>
|
2020-02-18 07:47:41 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-01-21 14:08:22 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-02-18 07:57:00 +00:00
|
|
|
<!-- <div class="date-and-title">-->
|
|
|
|
<!-- <div class="date-component">-->
|
|
|
|
<!-- <date-calendar-icon v-if="!mergedOptions.hideDate" :date="event.beginsOn" />-->
|
|
|
|
<!-- </div>-->
|
|
|
|
<!-- <div class="title-wrapper">-->
|
|
|
|
<!-- <h4>{{ event.title }}</h4>-->
|
|
|
|
<!-- <div class="organizer-place-wrapper has-text-grey">-->
|
|
|
|
<!-- <span>{{ $t('By @{username}', { username: actor.preferredUsername }) }}</span>-->
|
|
|
|
<!-- ·-->
|
|
|
|
<!-- <span v-if="event.physicalAddress">-->
|
|
|
|
<!-- {{ event.physicalAddress.description }}, {{ event.physicalAddress.locality }}-->
|
|
|
|
<!-- </span>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
<!-- <div v-if="!mergedOptions.hideDetails" class="details">-->
|
|
|
|
<!-- <div v-if="event.participants.length > 0 &&-->
|
|
|
|
<!-- mergedOptions.loggedPerson &&-->
|
|
|
|
<!-- event.participants[0].actor.id === mergedOptions.loggedPerson.id">-->
|
|
|
|
<!-- <b-tag type="is-info"><translate>Organizer</translate></b-tag>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
<!-- <div v-else-if="event.participants.length === 1">-->
|
|
|
|
<!-- <translate-->
|
|
|
|
<!-- :translate-params="{name: event.participants[0].actor.preferredUsername}"-->
|
|
|
|
<!-- >{name} organizes this event</translate>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
<!-- <div v-else>-->
|
|
|
|
<!-- <span v-for="participant in event.participants" :key="participant.actor.uuid">-->
|
|
|
|
<!-- {{ participant.actor.preferredUsername }}-->
|
|
|
|
<!-- <span v-if="participant.role === ParticipantRole.CREATOR">(organizer)</span>,-->
|
|
|
|
<!-- <!– <translate-->
|
|
|
|
<!-- :translate-params="{name: participant.actor.preferredUsername}"-->
|
|
|
|
<!-- > {name} is in,</translate>–>-->
|
|
|
|
<!-- </span>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
</router-link>
|
2019-01-21 14:08:22 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-11-06 10:34:32 +00:00
|
|
|
import { IEvent, IEventCardOptions } from "@/types/event.model";
|
2020-02-18 07:57:00 +00:00
|
|
|
import { Component, Prop, Vue } from "vue-property-decorator";
|
|
|
|
import DateCalendarIcon from "@/components/Event/DateCalendarIcon.vue";
|
2021-06-10 07:41:07 +00:00
|
|
|
import LazyImageWrapper from "@/components/Image/LazyImageWrapper.vue";
|
2020-02-18 07:57:00 +00:00
|
|
|
import { Actor, Person } from "@/types/actor";
|
2020-12-01 11:33:17 +00:00
|
|
|
import { EventStatus, ParticipantRole } from "@/types/enums";
|
2020-07-31 15:52:26 +00:00
|
|
|
import RouteName from "../../router/name";
|
2019-01-21 14:08:22 +00:00
|
|
|
|
2019-03-21 19:23:42 +00:00
|
|
|
@Component({
|
|
|
|
components: {
|
2019-04-03 15:29:03 +00:00
|
|
|
DateCalendarIcon,
|
2021-06-10 07:41:07 +00:00
|
|
|
LazyImageWrapper,
|
2019-03-21 19:23:42 +00:00
|
|
|
},
|
|
|
|
})
|
2019-01-21 14:08:22 +00:00
|
|
|
export default class EventCard extends Vue {
|
|
|
|
@Prop({ required: true }) event!: IEvent;
|
2020-02-18 07:57:00 +00:00
|
|
|
|
2019-04-03 15:29:03 +00:00
|
|
|
@Prop({ required: false }) options!: IEventCardOptions;
|
|
|
|
|
|
|
|
ParticipantRole = ParticipantRole;
|
|
|
|
|
2020-12-01 11:33:17 +00:00
|
|
|
EventStatus = EventStatus;
|
|
|
|
|
2020-07-31 15:52:26 +00:00
|
|
|
RouteName = RouteName;
|
|
|
|
|
2019-04-03 15:29:03 +00:00
|
|
|
defaultOptions: IEventCardOptions = {
|
|
|
|
hideDate: false,
|
|
|
|
loggedPerson: false,
|
|
|
|
hideDetails: false,
|
|
|
|
organizerActor: null,
|
2020-10-01 14:13:07 +00:00
|
|
|
memberofGroup: false,
|
2019-04-03 15:29:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
get mergedOptions(): IEventCardOptions {
|
|
|
|
return { ...this.defaultOptions, ...this.options };
|
|
|
|
}
|
2019-02-07 15:37:40 +00:00
|
|
|
|
2020-02-18 07:47:41 +00:00
|
|
|
get actor(): Actor {
|
2020-02-18 07:57:00 +00:00
|
|
|
return Object.assign(
|
|
|
|
new Person(),
|
|
|
|
this.event.organizerActor || this.mergedOptions.organizerActor
|
|
|
|
);
|
2019-02-07 15:37:40 +00:00
|
|
|
}
|
2021-02-12 17:19:49 +00:00
|
|
|
|
|
|
|
get isDescriptionDifferentFromLocality(): boolean {
|
|
|
|
return (
|
|
|
|
this.event?.physicalAddress?.description !==
|
|
|
|
this.event?.physicalAddress?.locality &&
|
|
|
|
this.event?.physicalAddress?.description !== undefined
|
|
|
|
);
|
|
|
|
}
|
2019-01-21 14:08:22 +00:00
|
|
|
}
|
|
|
|
</script>
|
2019-04-03 15:29:03 +00:00
|
|
|
|
2019-11-15 17:36:47 +00:00
|
|
|
<style lang="scss" scoped>
|
2020-02-18 07:57:00 +00:00
|
|
|
a.card {
|
|
|
|
display: block;
|
|
|
|
background: $secondary;
|
2020-06-17 13:54:24 +00:00
|
|
|
color: #3c376e;
|
2019-04-03 15:29:03 +00:00
|
|
|
|
2020-02-18 07:57:00 +00:00
|
|
|
&:hover {
|
|
|
|
// box-shadow: 0 0 5px 0 rgba(0, 0, 0, 1);
|
|
|
|
transform: scale(1.01, 1.01);
|
|
|
|
&:after {
|
|
|
|
opacity: 1;
|
2019-10-07 14:48:13 +00:00
|
|
|
}
|
2020-02-18 07:57:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
border-radius: 5px;
|
|
|
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
|
|
transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
|
2019-10-07 14:48:13 +00:00
|
|
|
|
2020-02-18 07:57:00 +00:00
|
|
|
&:after {
|
|
|
|
content: "";
|
2019-10-07 14:48:13 +00:00
|
|
|
border-radius: 5px;
|
2020-02-18 07:57:00 +00:00
|
|
|
position: absolute;
|
|
|
|
z-index: -1;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
|
|
|
|
opacity: 0;
|
2019-10-07 14:48:13 +00:00
|
|
|
transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
|
2020-02-18 07:57:00 +00:00
|
|
|
}
|
2019-10-07 14:48:13 +00:00
|
|
|
|
2020-02-18 07:57:00 +00:00
|
|
|
div.tag-container {
|
|
|
|
position: absolute;
|
|
|
|
top: 10px;
|
|
|
|
right: 0;
|
|
|
|
margin-right: -3px;
|
|
|
|
z-index: 10;
|
|
|
|
max-width: 40%;
|
|
|
|
|
2020-07-31 15:52:26 +00:00
|
|
|
a {
|
|
|
|
text-decoration: none;
|
|
|
|
|
|
|
|
span.tag {
|
|
|
|
margin: 5px auto;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
|
|
|
display: block;
|
|
|
|
font-size: 0.9em;
|
|
|
|
line-height: 1.75em;
|
|
|
|
background-color: #e6e4f4;
|
|
|
|
color: #3c376e;
|
|
|
|
}
|
2019-10-07 14:48:13 +00:00
|
|
|
}
|
2020-02-18 07:57:00 +00:00
|
|
|
}
|
2019-10-07 14:48:13 +00:00
|
|
|
|
2020-02-18 07:57:00 +00:00
|
|
|
div.card-image {
|
|
|
|
background: $secondary;
|
2019-04-24 18:49:52 +00:00
|
|
|
|
2020-02-18 07:57:00 +00:00
|
|
|
figure.image {
|
|
|
|
background-size: cover;
|
|
|
|
background-position: center;
|
2019-04-24 18:49:52 +00:00
|
|
|
}
|
2020-02-18 07:57:00 +00:00
|
|
|
}
|
2019-04-24 18:49:52 +00:00
|
|
|
|
2020-02-18 07:57:00 +00:00
|
|
|
.card-content {
|
|
|
|
padding: 0.5rem;
|
|
|
|
|
2021-06-10 07:41:07 +00:00
|
|
|
& > .media {
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
& > .media-left {
|
|
|
|
margin-top: -15px;
|
|
|
|
height: 0;
|
|
|
|
display: flex;
|
|
|
|
align-items: flex-end;
|
|
|
|
align-self: flex-start;
|
|
|
|
margin-bottom: 15px;
|
|
|
|
margin-left: 0rem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-18 07:57:00 +00:00
|
|
|
.event-title {
|
2020-06-17 13:54:24 +00:00
|
|
|
font-size: 1.2rem;
|
2020-02-18 07:57:00 +00:00
|
|
|
line-height: 1.25rem;
|
|
|
|
display: -webkit-box;
|
|
|
|
-webkit-line-clamp: 2;
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
overflow: hidden;
|
|
|
|
min-height: 2.4rem;
|
2020-06-17 13:54:24 +00:00
|
|
|
font-weight: bold;
|
2019-04-03 15:29:03 +00:00
|
|
|
}
|
|
|
|
|
2020-02-18 07:57:00 +00:00
|
|
|
.event-subtitle {
|
|
|
|
font-size: 0.85rem;
|
|
|
|
display: inline-flex;
|
|
|
|
flex-wrap: wrap;
|
2020-06-17 13:54:24 +00:00
|
|
|
color: #3c376e;
|
2019-10-10 11:48:03 +00:00
|
|
|
|
2020-02-18 07:57:00 +00:00
|
|
|
span {
|
2020-06-23 13:15:31 +00:00
|
|
|
width: 14rem;
|
2020-02-18 07:57:00 +00:00
|
|
|
display: block;
|
|
|
|
overflow: hidden;
|
2019-10-02 15:59:07 +00:00
|
|
|
|
2020-02-18 07:57:00 +00:00
|
|
|
flex-grow: 1;
|
2019-10-14 11:03:48 +00:00
|
|
|
|
2020-02-18 07:57:00 +00:00
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
2019-04-03 15:29:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-02-18 07:57:00 +00:00
|
|
|
}
|
2019-04-03 15:29:03 +00:00
|
|
|
</style>
|