2021-08-09 14:26:11 +02:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<event-metadata-block
|
2021-10-15 15:59:49 +02:00
|
|
|
v-if="!event.options.isOnline"
|
2021-08-09 14:26:11 +02:00
|
|
|
:title="$t('Location')"
|
|
|
|
:icon="physicalAddress ? physicalAddress.poiInfos.poiIcon.icon : 'earth'"
|
|
|
|
>
|
|
|
|
<div class="address-wrapper">
|
|
|
|
<span v-if="!physicalAddress">{{ $t("No address defined") }}</span>
|
|
|
|
<div class="address" v-if="physicalAddress">
|
2021-10-10 16:24:12 +02:00
|
|
|
<address-info :address="physicalAddress" />
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-button
|
2021-10-10 16:24:12 +02:00
|
|
|
type="is-text"
|
2021-08-09 14:26:11 +02:00
|
|
|
class="map-show-button"
|
2021-10-10 16:25:50 +02:00
|
|
|
@click="$emit('showMapModal', true)"
|
2021-08-09 14:26:11 +02:00
|
|
|
v-if="physicalAddress.geom"
|
|
|
|
>
|
2021-10-10 16:24:12 +02:00
|
|
|
{{ $t("Show map") }}
|
2022-07-12 10:55:28 +02:00
|
|
|
</o-button>
|
2021-08-09 14:26:11 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</event-metadata-block>
|
|
|
|
<event-metadata-block :title="$t('Date and time')" icon="calendar">
|
|
|
|
<event-full-date
|
2022-07-12 10:55:28 +02:00
|
|
|
:beginsOn="event.beginsOn.toString()"
|
2021-08-09 14:26:11 +02:00
|
|
|
:show-start-time="event.options.showStartTime"
|
|
|
|
:show-end-time="event.options.showEndTime"
|
2022-07-12 10:55:28 +02:00
|
|
|
:timezone="event.options.timezone ?? undefined"
|
2021-10-10 16:25:50 +02:00
|
|
|
:userTimezone="userTimezone"
|
2022-07-12 10:55:28 +02:00
|
|
|
:endsOn="event.endsOn?.toString()"
|
2021-08-09 14:26:11 +02:00
|
|
|
/>
|
|
|
|
</event-metadata-block>
|
|
|
|
<event-metadata-block
|
|
|
|
class="metadata-organized-by"
|
|
|
|
:title="$t('Organized by')"
|
|
|
|
>
|
|
|
|
<router-link
|
|
|
|
v-if="event.attributedTo"
|
2022-04-06 18:16:14 +02:00
|
|
|
class="hover:underline"
|
2021-08-09 14:26:11 +02:00
|
|
|
:to="{
|
|
|
|
name: RouteName.GROUP,
|
|
|
|
params: {
|
|
|
|
preferredUsername: usernameWithDomain(event.attributedTo),
|
|
|
|
},
|
|
|
|
}"
|
|
|
|
>
|
2022-01-13 15:04:43 +01:00
|
|
|
<actor-card
|
2021-08-09 14:26:11 +02:00
|
|
|
v-if="
|
|
|
|
!event.attributedTo || !event.options.hideOrganizerWhenGroupEvent
|
|
|
|
"
|
2022-01-13 15:04:43 +01:00
|
|
|
:actor="event.attributedTo"
|
2022-03-23 12:33:27 +01:00
|
|
|
:inline="true"
|
2022-01-13 15:04:43 +01:00
|
|
|
/>
|
2021-08-09 14:26:11 +02:00
|
|
|
</router-link>
|
2022-07-12 10:55:28 +02:00
|
|
|
<actor-card
|
|
|
|
v-else-if="event.organizerActor"
|
|
|
|
:actor="event.organizerActor"
|
|
|
|
:inline="true"
|
|
|
|
/>
|
2022-01-13 15:04:43 +01:00
|
|
|
<actor-card
|
2022-04-06 18:16:14 +02:00
|
|
|
:inline="true"
|
2021-08-09 14:26:11 +02:00
|
|
|
:actor="contact"
|
|
|
|
v-for="contact in event.contacts"
|
|
|
|
:key="contact.id"
|
2022-01-13 15:04:43 +01:00
|
|
|
/>
|
2021-08-09 14:26:11 +02:00
|
|
|
</event-metadata-block>
|
|
|
|
<event-metadata-block
|
|
|
|
v-if="event.onlineAddress && urlToHostname(event.onlineAddress)"
|
|
|
|
icon="link"
|
|
|
|
:title="$t('Website')"
|
|
|
|
>
|
|
|
|
<a
|
|
|
|
target="_blank"
|
2022-04-06 18:01:38 +02:00
|
|
|
class="hover:underline"
|
2021-08-09 14:26:11 +02:00
|
|
|
rel="noopener noreferrer ugc"
|
|
|
|
:href="event.onlineAddress"
|
|
|
|
:title="
|
|
|
|
$t('View page on {hostname} (in a new window)', {
|
|
|
|
hostname: urlToHostname(event.onlineAddress),
|
|
|
|
})
|
|
|
|
"
|
|
|
|
>{{ simpleURL(event.onlineAddress) }}</a
|
|
|
|
>
|
|
|
|
</event-metadata-block>
|
|
|
|
<event-metadata-block
|
|
|
|
v-for="extra in extraMetadata"
|
|
|
|
:title="extra.title || extra.label"
|
|
|
|
:icon="extra.icon"
|
|
|
|
:key="extra.key"
|
|
|
|
>
|
|
|
|
<span
|
|
|
|
v-if="
|
|
|
|
((extra.type == EventMetadataType.STRING &&
|
|
|
|
extra.keyType == EventMetadataKeyType.CHOICE) ||
|
|
|
|
extra.type === EventMetadataType.BOOLEAN) &&
|
|
|
|
extra.choices &&
|
|
|
|
extra.choices[extra.value]
|
|
|
|
"
|
|
|
|
>
|
|
|
|
{{ extra.choices[extra.value] }}
|
|
|
|
</span>
|
|
|
|
<a
|
|
|
|
v-else-if="
|
|
|
|
extra.type == EventMetadataType.STRING &&
|
|
|
|
extra.keyType == EventMetadataKeyType.URL
|
|
|
|
"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer ugc"
|
|
|
|
:href="extra.value"
|
|
|
|
:title="
|
|
|
|
$t('View page on {hostname} (in a new window)', {
|
|
|
|
hostname: urlToHostname(extra.value),
|
|
|
|
})
|
|
|
|
"
|
|
|
|
>{{ simpleURL(extra.value) }}</a
|
|
|
|
>
|
|
|
|
<a
|
|
|
|
v-else-if="
|
|
|
|
extra.type == EventMetadataType.STRING &&
|
|
|
|
extra.keyType == EventMetadataKeyType.HANDLE
|
|
|
|
"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer ugc"
|
|
|
|
:href="accountURL(extra)"
|
|
|
|
:title="
|
|
|
|
$t('View account on {hostname} (in a new window)', {
|
|
|
|
hostname: urlToHostname(accountURL(extra)),
|
|
|
|
})
|
|
|
|
"
|
|
|
|
>{{ extra.value }}</a
|
|
|
|
>
|
|
|
|
<span v-else>{{ extra.value }}</span>
|
|
|
|
</event-metadata-block>
|
|
|
|
</div>
|
|
|
|
</template>
|
2022-07-12 10:55:28 +02:00
|
|
|
<script lang="ts" setup>
|
2021-08-09 14:26:11 +02:00
|
|
|
import { Address } from "@/types/address.model";
|
2021-10-10 16:25:50 +02:00
|
|
|
import { EventMetadataKeyType, EventMetadataType } from "@/types/enums";
|
2021-08-09 14:26:11 +02:00
|
|
|
import { IEvent } from "@/types/event.model";
|
2022-07-12 10:55:28 +02:00
|
|
|
import { computed } from "vue";
|
2021-08-09 14:26:11 +02:00
|
|
|
import RouteName from "../../router/name";
|
|
|
|
import { usernameWithDomain } from "../../types/actor";
|
|
|
|
import EventMetadataBlock from "./EventMetadataBlock.vue";
|
|
|
|
import EventFullDate from "./EventFullDate.vue";
|
|
|
|
import ActorCard from "../../components/Account/ActorCard.vue";
|
2021-10-10 16:25:50 +02:00
|
|
|
import AddressInfo from "../../components/Address/AddressInfo.vue";
|
2022-07-12 10:55:28 +02:00
|
|
|
import { IEventMetadataDescription } from "@/types/event-metadata";
|
2021-08-09 14:26:11 +02:00
|
|
|
import { eventMetaDataList } from "../../services/EventMetadata";
|
2021-10-10 16:25:50 +02:00
|
|
|
import { IUser } from "@/types/current-user.model";
|
2021-08-09 14:26:11 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const props = withDefaults(
|
|
|
|
defineProps<{
|
|
|
|
event: IEvent;
|
|
|
|
user: IUser | undefined;
|
|
|
|
showMap?: boolean;
|
|
|
|
}>(),
|
|
|
|
{ showMap: false }
|
|
|
|
);
|
|
|
|
|
|
|
|
const physicalAddress = computed((): Address | null => {
|
|
|
|
if (!props.event.physicalAddress) return null;
|
|
|
|
|
|
|
|
return new Address(props.event.physicalAddress);
|
|
|
|
});
|
|
|
|
|
|
|
|
const extraMetadata = computed((): IEventMetadataDescription[] => {
|
|
|
|
return props.event.metadata.map((val) => {
|
|
|
|
const def = eventMetaDataList.find((dat) => dat.key === val.key);
|
|
|
|
return {
|
|
|
|
...def,
|
|
|
|
...val,
|
|
|
|
};
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
const urlToHostname = (url: string | undefined): string | null => {
|
|
|
|
if (!url) return null;
|
|
|
|
try {
|
|
|
|
return new URL(url).hostname;
|
|
|
|
} catch (e) {
|
|
|
|
return null;
|
2021-08-09 14:26:11 +02:00
|
|
|
}
|
2022-07-12 10:55:28 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const simpleURL = (url: string): string | null => {
|
|
|
|
try {
|
|
|
|
const uri = new URL(url);
|
|
|
|
return `${removeWWW(uri.hostname)}${uri.pathname}${uri.search}${uri.hash}`;
|
|
|
|
} catch (e) {
|
|
|
|
return null;
|
2021-08-09 14:26:11 +02:00
|
|
|
}
|
2022-07-12 10:55:28 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const removeWWW = (string: string): string => {
|
|
|
|
return string.replace(/^www./, "");
|
|
|
|
};
|
|
|
|
|
|
|
|
const accountURL = (extra: IEventMetadataDescription): string | undefined => {
|
|
|
|
switch (extra.key) {
|
|
|
|
case "mz:social:twitter:account": {
|
|
|
|
const handle =
|
|
|
|
extra.value[0] === "@" ? extra.value.slice(1) : extra.value;
|
|
|
|
return `https://twitter.com/${handle}`;
|
2021-08-09 14:26:11 +02:00
|
|
|
}
|
|
|
|
}
|
2022-07-12 10:55:28 +02:00
|
|
|
};
|
2021-08-09 14:26:11 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const userTimezone = computed((): string | undefined => {
|
|
|
|
return props.user?.settings?.timezone;
|
|
|
|
});
|
2021-08-09 14:26:11 +02:00
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
2022-07-12 10:55:28 +02:00
|
|
|
:deep(.metadata-organized-by) {
|
2021-08-09 14:26:11 +02:00
|
|
|
.v-popover.popover .trigger {
|
|
|
|
width: 100%;
|
|
|
|
.media-content {
|
|
|
|
width: calc(100% - 32px - 1rem);
|
|
|
|
max-width: 80vw;
|
|
|
|
|
|
|
|
p.has-text-grey-dark {
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
div.address-wrapper {
|
|
|
|
display: flex;
|
|
|
|
flex: 1;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
|
|
div.address {
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
.map-show-button {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|