2019-01-21 15:08:22 +01:00
|
|
|
<template>
|
2022-08-26 16:08:58 +02:00
|
|
|
<LinkOrRouterLink
|
|
|
|
class="mbz-card snap-center dark:bg-mbz-purple"
|
|
|
|
:class="{
|
|
|
|
'sm:flex sm:items-start': mode === 'row',
|
|
|
|
'max-w-xs w-[18rem] shrink-0 flex flex-col': mode === 'column',
|
|
|
|
}"
|
|
|
|
:to="to"
|
|
|
|
:isInternal="isInternal"
|
2020-11-30 10:24:11 +01:00
|
|
|
>
|
2022-08-26 16:08:58 +02:00
|
|
|
<div
|
|
|
|
class="bg-secondary rounded-lg"
|
|
|
|
:class="{ 'sm:w-full sm:max-w-[20rem]': mode === 'row' }"
|
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<figure class="block relative pt-40">
|
2021-06-10 09:41:07 +02:00
|
|
|
<lazy-image-wrapper
|
|
|
|
:picture="event.picture"
|
|
|
|
style="height: 100%; position: absolute; top: 0; left: 0; width: 100%"
|
|
|
|
/>
|
2020-12-01 12:33:17 +01:00
|
|
|
<div
|
2022-08-26 16:08:58 +02:00
|
|
|
class="absolute top-3 right-0 ltr:-mr-1 rtl:-ml-1 z-10 max-w-xs no-underline flex flex-col gap-1 items-end"
|
|
|
|
v-show="mode === 'column'"
|
2020-12-01 12:33:17 +01:00
|
|
|
v-if="event.tags || event.status !== EventStatus.CONFIRMED"
|
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<mobilizon-tag
|
|
|
|
variant="info"
|
|
|
|
v-if="event.status === EventStatus.TENTATIVE"
|
|
|
|
>
|
2020-12-01 12:33:17 +01:00
|
|
|
{{ $t("Tentative") }}
|
2022-07-12 10:55:28 +02:00
|
|
|
</mobilizon-tag>
|
|
|
|
<mobilizon-tag
|
|
|
|
variant="danger"
|
|
|
|
v-if="event.status === EventStatus.CANCELLED"
|
|
|
|
>
|
2020-12-01 12:33:17 +01:00
|
|
|
{{ $t("Cancelled") }}
|
2022-07-12 10:55:28 +02:00
|
|
|
</mobilizon-tag>
|
2020-07-31 17:52:26 +02:00
|
|
|
<router-link
|
|
|
|
:to="{ name: RouteName.TAG, params: { tag: tag.title } }"
|
2020-12-01 17:34:17 +01:00
|
|
|
v-for="tag in (event.tags || []).slice(0, 3)"
|
2020-07-31 17:52:26 +02:00
|
|
|
:key="tag.slug"
|
|
|
|
>
|
2022-08-26 16:08:58 +02:00
|
|
|
<mobilizon-tag dir="auto" :with-hash-tag="true">{{
|
|
|
|
tag.title
|
|
|
|
}}</mobilizon-tag>
|
2020-07-31 17:52:26 +02:00
|
|
|
</router-link>
|
2019-04-24 20:49:52 +02:00
|
|
|
</div>
|
2019-01-21 15:08:22 +01:00
|
|
|
</figure>
|
|
|
|
</div>
|
2022-08-26 16:08:58 +02:00
|
|
|
<div class="p-2 flex-auto" :class="{ 'sm:flex-1': mode === 'row' }">
|
2022-07-12 10:55:28 +02:00
|
|
|
<div class="relative flex flex-col h-full">
|
2022-08-26 16:08:58 +02:00
|
|
|
<div
|
|
|
|
class="-mt-3 h-0 flex mb-3 ltr:ml-0 rtl:mr-0 items-end self-start"
|
|
|
|
:class="{ 'sm:hidden': mode === 'row' }"
|
|
|
|
>
|
2020-11-30 10:24:11 +01:00
|
|
|
<date-calendar-icon
|
2021-06-10 09:41:07 +02:00
|
|
|
:small="true"
|
2020-11-30 10:24:11 +01:00
|
|
|
v-if="!mergedOptions.hideDate"
|
2022-07-12 10:55:28 +02:00
|
|
|
:date="event.beginsOn.toString()"
|
2020-11-30 10:24:11 +01:00
|
|
|
/>
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
2022-08-26 16:08:58 +02:00
|
|
|
<span
|
|
|
|
class="text-gray-700 dark:text-white font-semibold hidden"
|
|
|
|
:class="{ 'sm:block': mode === 'row' }"
|
|
|
|
>{{ formatDateTimeWithCurrentLocale }}</span
|
|
|
|
>
|
|
|
|
<div class="w-full flex flex-col justify-between h-full">
|
|
|
|
<h2
|
|
|
|
class="mt-0 mb-2 text-2xl line-clamp-3 font-bold text-violet-3 dark:text-white"
|
2021-11-13 15:58:54 +01:00
|
|
|
dir="auto"
|
|
|
|
:lang="event.language"
|
|
|
|
>
|
2021-11-07 14:59:20 +01:00
|
|
|
{{ event.title }}
|
2022-08-26 16:08:58 +02:00
|
|
|
</h2>
|
|
|
|
<div class="">
|
2022-08-12 16:46:44 +02:00
|
|
|
<div
|
|
|
|
class="flex items-center text-violet-3 dark:text-white"
|
|
|
|
dir="auto"
|
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<figure class="" v-if="actorAvatarURL">
|
2021-11-06 14:37:02 +01:00
|
|
|
<img
|
2022-07-12 10:55:28 +02:00
|
|
|
class="rounded-xl"
|
|
|
|
:src="actorAvatarURL"
|
2021-11-06 14:37:02 +01:00
|
|
|
alt=""
|
2022-07-12 10:55:28 +02:00
|
|
|
width="24"
|
|
|
|
height="24"
|
2021-11-06 14:37:02 +01:00
|
|
|
/>
|
|
|
|
</figure>
|
2022-07-12 10:55:28 +02:00
|
|
|
<account-circle v-else />
|
2022-08-26 16:08:58 +02:00
|
|
|
<span class="font-semibold ltr:pl-2 rtl:pr-2">
|
2021-11-06 14:37:02 +01:00
|
|
|
{{ organizerDisplayName(event) }}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<inline-address
|
|
|
|
v-if="event.physicalAddress"
|
|
|
|
:physical-address="event.physicalAddress"
|
|
|
|
/>
|
|
|
|
<div
|
2022-07-12 10:55:28 +02:00
|
|
|
class="flex items-center text-sm"
|
2021-11-07 14:59:20 +01:00
|
|
|
dir="auto"
|
2021-11-06 14:37:02 +01:00
|
|
|
v-else-if="event.options && event.options.isOnline"
|
2021-10-29 10:54:35 +02:00
|
|
|
>
|
2022-08-12 16:46:44 +02:00
|
|
|
<Video />
|
2022-07-12 10:55:28 +02:00
|
|
|
<span class="ltr:pl-2 rtl:pr-2">{{ $t("Online") }}</span>
|
2021-11-06 14:37:02 +01:00
|
|
|
</div>
|
2022-08-26 16:08:58 +02:00
|
|
|
<div
|
|
|
|
class="mt-1 no-underline gap-1 items-center hidden"
|
|
|
|
:class="{ 'sm:flex': mode === 'row' }"
|
|
|
|
v-if="event.tags || event.status !== EventStatus.CONFIRMED"
|
|
|
|
>
|
|
|
|
<mobilizon-tag
|
|
|
|
variant="info"
|
|
|
|
v-if="event.status === EventStatus.TENTATIVE"
|
|
|
|
>
|
|
|
|
{{ $t("Tentative") }}
|
|
|
|
</mobilizon-tag>
|
|
|
|
<mobilizon-tag
|
|
|
|
variant="danger"
|
|
|
|
v-if="event.status === EventStatus.CANCELLED"
|
|
|
|
>
|
|
|
|
{{ $t("Cancelled") }}
|
|
|
|
</mobilizon-tag>
|
|
|
|
<router-link
|
|
|
|
:to="{ name: RouteName.TAG, params: { tag: tag.title } }"
|
|
|
|
v-for="tag in (event.tags || []).slice(0, 3)"
|
|
|
|
:key="tag.slug"
|
|
|
|
>
|
|
|
|
<mobilizon-tag :with-hash-tag="true" dir="auto">{{
|
|
|
|
tag.title
|
|
|
|
}}</mobilizon-tag>
|
|
|
|
</router-link>
|
|
|
|
</div>
|
2021-10-29 10:54:35 +02:00
|
|
|
</div>
|
2020-02-18 08:47:41 +01:00
|
|
|
</div>
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-08-26 16:08:58 +02:00
|
|
|
</LinkOrRouterLink>
|
2019-01-21 15:08:22 +01:00
|
|
|
</template>
|
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
<script lang="ts" setup>
|
2021-10-29 10:54:35 +02:00
|
|
|
import {
|
|
|
|
IEvent,
|
|
|
|
IEventCardOptions,
|
|
|
|
organizerDisplayName,
|
2022-07-12 10:55:28 +02:00
|
|
|
organizerAvatarUrl,
|
2021-10-29 10:54:35 +02:00
|
|
|
} from "@/types/event.model";
|
2020-02-18 08:57:00 +01:00
|
|
|
import DateCalendarIcon from "@/components/Event/DateCalendarIcon.vue";
|
2021-06-10 09:41:07 +02:00
|
|
|
import LazyImageWrapper from "@/components/Image/LazyImageWrapper.vue";
|
2022-07-12 10:55:28 +02:00
|
|
|
import { EventStatus } from "@/types/enums";
|
2020-07-31 17:52:26 +02:00
|
|
|
import RouteName from "../../router/name";
|
2021-11-06 11:15:16 +01:00
|
|
|
import InlineAddress from "@/components/Address/InlineAddress.vue";
|
2019-01-21 15:08:22 +01:00
|
|
|
|
2022-08-26 16:08:58 +02:00
|
|
|
import { computed, inject } from "vue";
|
|
|
|
import MobilizonTag from "@/components/Tag.vue";
|
2022-07-12 10:55:28 +02:00
|
|
|
import AccountCircle from "vue-material-design-icons/AccountCircle.vue";
|
2022-08-12 16:46:44 +02:00
|
|
|
import Video from "vue-material-design-icons/Video.vue";
|
2022-08-26 16:08:58 +02:00
|
|
|
import { formatDateTimeForEvent } from "@/utils/datetime";
|
|
|
|
import type { Locale } from "date-fns";
|
|
|
|
import LinkOrRouterLink from "../core/LinkOrRouterLink.vue";
|
2022-07-12 10:55:28 +02:00
|
|
|
|
2022-08-26 16:08:58 +02:00
|
|
|
const props = withDefaults(
|
|
|
|
defineProps<{
|
|
|
|
event: IEvent;
|
|
|
|
options?: IEventCardOptions;
|
|
|
|
mode?: "row" | "column";
|
|
|
|
}>(),
|
|
|
|
{ mode: "column" }
|
|
|
|
);
|
2022-07-12 10:55:28 +02:00
|
|
|
const defaultOptions: IEventCardOptions = {
|
|
|
|
hideDate: false,
|
|
|
|
loggedPerson: false,
|
|
|
|
hideDetails: false,
|
|
|
|
organizerActor: null,
|
2022-08-26 16:08:58 +02:00
|
|
|
isRemoteEvent: false,
|
|
|
|
isLoggedIn: true,
|
2022-07-12 10:55:28 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const mergedOptions = computed<IEventCardOptions>(() => ({
|
|
|
|
...defaultOptions,
|
|
|
|
...props.options,
|
|
|
|
}));
|
|
|
|
|
|
|
|
// const actor = computed<Actor>(() => {
|
|
|
|
// return Object.assign(
|
|
|
|
// new Person(),
|
|
|
|
// props.event.organizerActor ?? mergedOptions.value.organizerActor
|
|
|
|
// );
|
|
|
|
// });
|
|
|
|
|
|
|
|
const actorAvatarURL = computed<string | null>(() =>
|
|
|
|
organizerAvatarUrl(props.event)
|
|
|
|
);
|
2022-08-26 16:08:58 +02:00
|
|
|
|
|
|
|
const dateFnsLocale = inject<Locale>("dateFnsLocale");
|
|
|
|
|
|
|
|
const formatDateTimeWithCurrentLocale = computed(() => {
|
|
|
|
if (!dateFnsLocale) return;
|
|
|
|
return formatDateTimeForEvent(new Date(props.event.beginsOn), dateFnsLocale);
|
|
|
|
});
|
|
|
|
|
|
|
|
const isInternal = computed(() => {
|
|
|
|
return (
|
|
|
|
mergedOptions.value.isRemoteEvent &&
|
|
|
|
mergedOptions.value.isLoggedIn === false
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
const to = computed(() => {
|
|
|
|
if (mergedOptions.value.isRemoteEvent) {
|
|
|
|
if (mergedOptions.value.isLoggedIn === false) {
|
|
|
|
return props.event.url;
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
name: RouteName.INTERACT,
|
|
|
|
query: { uri: encodeURI(props.event.url) },
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return { name: RouteName.EVENT, params: { uuid: props.event.uuid } };
|
|
|
|
});
|
2019-01-21 15:08:22 +01:00
|
|
|
</script>
|