2020-06-05 15:20:53 +02:00
|
|
|
<template>
|
|
|
|
<div class="modal-card">
|
|
|
|
<header class="modal-card-head">
|
|
|
|
<p class="modal-card-title">{{ $t("Share this event") }}</p>
|
|
|
|
</header>
|
|
|
|
|
|
|
|
<section class="modal-card-body is-flex" v-if="event">
|
|
|
|
<div class="container has-text-centered">
|
2020-06-17 15:54:24 +02:00
|
|
|
<b-notification
|
|
|
|
type="is-warning"
|
|
|
|
v-if="event.visibility !== EventVisibility.PUBLIC"
|
|
|
|
:closable="false"
|
|
|
|
>
|
|
|
|
{{
|
|
|
|
$t(
|
|
|
|
"This event is accessible only through it's link. Be careful where you post this link."
|
|
|
|
)
|
|
|
|
}}
|
|
|
|
</b-notification>
|
|
|
|
<b-notification
|
|
|
|
type="is-danger"
|
|
|
|
v-if="event.status === EventStatus.CANCELLED"
|
|
|
|
:closable="false"
|
|
|
|
>
|
|
|
|
{{ $t("This event has been cancelled.") }}
|
|
|
|
</b-notification>
|
2020-06-05 15:20:53 +02:00
|
|
|
<small class="maximumNumberOfPlacesWarning" v-if="!eventCapacityOK">
|
|
|
|
{{ $t("All the places have already been taken") }}
|
|
|
|
</small>
|
2021-06-29 10:41:40 +02:00
|
|
|
<b-field :label="$t('Event URL')" label-for="event-url-text">
|
|
|
|
<b-input
|
|
|
|
id="event-url-text"
|
|
|
|
ref="eventURLInput"
|
|
|
|
:value="event.url"
|
|
|
|
expanded
|
|
|
|
/>
|
2020-06-23 17:19:41 +02:00
|
|
|
<p class="control">
|
|
|
|
<b-tooltip
|
|
|
|
:label="$t('URL copied to clipboard')"
|
|
|
|
:active="showCopiedTooltip"
|
|
|
|
always
|
|
|
|
type="is-success"
|
|
|
|
position="is-left"
|
|
|
|
>
|
|
|
|
<b-button
|
|
|
|
type="is-primary"
|
|
|
|
icon-right="content-paste"
|
|
|
|
native-type="button"
|
|
|
|
@click="copyURL"
|
|
|
|
@keyup.enter="copyURL"
|
2021-06-29 10:41:40 +02:00
|
|
|
:title="$t('Copy URL to clipboard')"
|
2020-06-23 17:19:41 +02:00
|
|
|
/>
|
|
|
|
</b-tooltip>
|
|
|
|
</p>
|
|
|
|
</b-field>
|
2020-06-05 15:20:53 +02:00
|
|
|
<div>
|
2021-06-29 10:41:40 +02:00
|
|
|
<a
|
|
|
|
:href="twitterShareUrl"
|
|
|
|
target="_blank"
|
|
|
|
rel="nofollow noopener"
|
|
|
|
title="Twitter"
|
2020-06-05 15:20:53 +02:00
|
|
|
><b-icon icon="twitter" size="is-large" type="is-primary"
|
|
|
|
/></a>
|
2021-06-29 10:26:12 +02:00
|
|
|
<a
|
|
|
|
:href="mastodonShareUrl"
|
|
|
|
class="mastodon"
|
|
|
|
target="_blank"
|
|
|
|
rel="nofollow noopener"
|
2021-06-29 10:41:40 +02:00
|
|
|
title="Mastodon"
|
2021-06-29 10:26:12 +02:00
|
|
|
>
|
|
|
|
<mastodon-logo />
|
|
|
|
</a>
|
2021-06-29 10:41:40 +02:00
|
|
|
<a
|
|
|
|
:href="facebookShareUrl"
|
|
|
|
target="_blank"
|
|
|
|
rel="nofollow noopener"
|
|
|
|
title="Facebook"
|
2020-06-05 15:20:53 +02:00
|
|
|
><b-icon icon="facebook" size="is-large" type="is-primary"
|
|
|
|
/></a>
|
2021-06-29 10:41:40 +02:00
|
|
|
<a
|
|
|
|
:href="whatsAppShareUrl"
|
|
|
|
target="_blank"
|
|
|
|
rel="nofollow noopener"
|
|
|
|
title="WhatsApp"
|
2021-06-29 10:26:31 +02:00
|
|
|
><b-icon icon="whatsapp" size="is-large" type="is-primary"
|
|
|
|
/></a>
|
2021-06-29 10:41:40 +02:00
|
|
|
<a
|
|
|
|
:href="telegramShareUrl"
|
2021-09-29 19:11:23 +02:00
|
|
|
class="telegram"
|
2021-06-29 10:41:40 +02:00
|
|
|
target="_blank"
|
|
|
|
rel="nofollow noopener"
|
|
|
|
title="Telegram"
|
2021-09-29 19:11:23 +02:00
|
|
|
>
|
|
|
|
<telegram-logo />
|
|
|
|
</a>
|
2021-06-29 10:41:40 +02:00
|
|
|
<a
|
|
|
|
:href="linkedInShareUrl"
|
|
|
|
target="_blank"
|
|
|
|
rel="nofollow noopener"
|
|
|
|
title="LinkedIn"
|
2020-06-05 15:20:53 +02:00
|
|
|
><b-icon icon="linkedin" size="is-large" type="is-primary"
|
|
|
|
/></a>
|
2020-11-30 10:24:11 +01:00
|
|
|
<a
|
|
|
|
:href="diasporaShareUrl"
|
|
|
|
class="diaspora"
|
|
|
|
target="_blank"
|
|
|
|
rel="nofollow noopener"
|
2021-06-29 10:41:40 +02:00
|
|
|
title="Diaspora"
|
2020-11-30 10:24:11 +01:00
|
|
|
>
|
2021-06-29 09:57:46 +02:00
|
|
|
<diaspora-logo />
|
2020-06-05 15:20:53 +02:00
|
|
|
</a>
|
2021-06-29 10:41:40 +02:00
|
|
|
<a
|
|
|
|
:href="emailShareUrl"
|
|
|
|
target="_blank"
|
|
|
|
rel="nofollow noopener"
|
|
|
|
title="Email"
|
2020-06-05 15:20:53 +02:00
|
|
|
><b-icon icon="email" size="is-large" type="is-primary"
|
|
|
|
/></a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-06-23 17:19:41 +02:00
|
|
|
import { Component, Prop, Vue, Ref } from "vue-property-decorator";
|
2020-11-27 19:27:44 +01:00
|
|
|
import { EventStatus, EventVisibility } from "@/types/enums";
|
|
|
|
import { IEvent } from "../../types/event.model";
|
2021-06-29 09:57:46 +02:00
|
|
|
import DiasporaLogo from "../Share/DiasporaLogo.vue";
|
2021-06-29 10:26:12 +02:00
|
|
|
import MastodonLogo from "../Share/MastodonLogo.vue";
|
2021-09-29 19:11:23 +02:00
|
|
|
import TelegramLogo from "../Share/TelegramLogo.vue";
|
2020-06-05 15:20:53 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
components: {
|
|
|
|
DiasporaLogo,
|
2021-06-29 10:26:12 +02:00
|
|
|
MastodonLogo,
|
2021-09-29 19:11:23 +02:00
|
|
|
TelegramLogo,
|
2020-06-05 15:20:53 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
export default class ShareEventModal extends Vue {
|
|
|
|
@Prop({ type: Object, required: true }) event!: IEvent;
|
2020-07-09 17:24:28 +02:00
|
|
|
|
2020-11-30 10:24:11 +01:00
|
|
|
@Prop({ type: Boolean, required: false, default: true })
|
|
|
|
eventCapacityOK!: boolean;
|
2020-07-09 17:24:28 +02:00
|
|
|
|
2020-06-23 17:19:41 +02:00
|
|
|
@Ref("eventURLInput") readonly eventURLInput!: any;
|
2020-06-17 15:54:24 +02:00
|
|
|
|
|
|
|
EventVisibility = EventVisibility;
|
2020-07-09 17:24:28 +02:00
|
|
|
|
2020-06-17 15:54:24 +02:00
|
|
|
EventStatus = EventStatus;
|
|
|
|
|
2020-07-09 17:24:28 +02:00
|
|
|
showCopiedTooltip = false;
|
2020-06-23 17:19:41 +02:00
|
|
|
|
2020-06-05 15:20:53 +02:00
|
|
|
get twitterShareUrl(): string {
|
2020-11-30 10:24:11 +01:00
|
|
|
return `https://twitter.com/intent/tweet?url=${encodeURIComponent(
|
|
|
|
this.event.url
|
|
|
|
)}&text=${this.event.title}`;
|
2020-06-05 15:20:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
get facebookShareUrl(): string {
|
2020-11-30 10:24:11 +01:00
|
|
|
return `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(
|
|
|
|
this.event.url
|
|
|
|
)}`;
|
2020-06-05 15:20:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
get linkedInShareUrl(): string {
|
|
|
|
return `https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(
|
|
|
|
this.event.url
|
|
|
|
)}&title=${this.event.title}`;
|
|
|
|
}
|
|
|
|
|
2021-06-29 10:26:31 +02:00
|
|
|
get whatsAppShareUrl(): string {
|
|
|
|
return `https://wa.me/?text=${encodeURIComponent(this.basicTextToEncode)}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
get telegramShareUrl(): string {
|
|
|
|
return `https://t.me/share/url?url=${encodeURIComponent(
|
|
|
|
this.event.url
|
|
|
|
)}&text=${encodeURIComponent(this.event.title)}`;
|
|
|
|
}
|
|
|
|
|
2020-06-05 15:20:53 +02:00
|
|
|
get emailShareUrl(): string {
|
2020-06-16 16:21:08 +02:00
|
|
|
return `mailto:?to=&body=${this.event.url}&subject=${this.event.title}`;
|
2020-06-05 15:20:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
get diasporaShareUrl(): string {
|
|
|
|
return `https://share.diasporafoundation.org/?title=${encodeURIComponent(
|
|
|
|
this.event.title
|
|
|
|
)}&url=${encodeURIComponent(this.event.url)}`;
|
|
|
|
}
|
2020-06-23 17:19:41 +02:00
|
|
|
|
2021-06-29 10:26:12 +02:00
|
|
|
get mastodonShareUrl(): string {
|
2022-04-19 17:35:34 +02:00
|
|
|
return `https://toot.kytta.dev/?text=${encodeURIComponent(
|
2021-06-29 10:26:12 +02:00
|
|
|
this.basicTextToEncode
|
|
|
|
)}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
get basicTextToEncode(): string {
|
|
|
|
return `${this.event.title}\r\n${this.event.url}`;
|
|
|
|
}
|
|
|
|
|
2020-11-27 19:27:44 +01:00
|
|
|
copyURL(): void {
|
2020-06-23 17:19:41 +02:00
|
|
|
this.eventURLInput.$refs.input.select();
|
|
|
|
document.execCommand("copy");
|
|
|
|
this.showCopiedTooltip = true;
|
|
|
|
setTimeout(() => {
|
|
|
|
this.showCopiedTooltip = false;
|
|
|
|
}, 2000);
|
|
|
|
}
|
2020-06-05 15:20:53 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
2021-06-29 10:26:12 +02:00
|
|
|
.diaspora,
|
2021-09-29 19:11:23 +02:00
|
|
|
.mastodon,
|
|
|
|
.telegram {
|
2021-06-29 10:26:12 +02:00
|
|
|
::v-deep span svg {
|
|
|
|
width: 2.25rem;
|
|
|
|
}
|
2020-06-05 15:20:53 +02:00
|
|
|
}
|
|
|
|
</style>
|