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>
|
2020-06-23 17:19:41 +02:00
|
|
|
<b-field>
|
|
|
|
<b-input ref="eventURLInput" :value="event.url" expanded />
|
|
|
|
<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"
|
|
|
|
/>
|
|
|
|
</b-tooltip>
|
|
|
|
</p>
|
|
|
|
</b-field>
|
2020-06-05 15:20:53 +02:00
|
|
|
<div>
|
|
|
|
<!-- <b-icon icon="mastodon" size="is-large" type="is-primary" />-->
|
|
|
|
|
|
|
|
<a :href="twitterShareUrl" target="_blank" rel="nofollow noopener"
|
|
|
|
><b-icon icon="twitter" size="is-large" type="is-primary"
|
|
|
|
/></a>
|
|
|
|
<a :href="facebookShareUrl" target="_blank" rel="nofollow noopener"
|
|
|
|
><b-icon icon="facebook" size="is-large" type="is-primary"
|
|
|
|
/></a>
|
|
|
|
<a :href="linkedInShareUrl" target="_blank" rel="nofollow noopener"
|
|
|
|
><b-icon icon="linkedin" size="is-large" type="is-primary"
|
|
|
|
/></a>
|
|
|
|
<a :href="diasporaShareUrl" class="diaspora" target="_blank" rel="nofollow noopener">
|
|
|
|
<span data-v-5e15e80a="" class="icon has-text-primary is-large">
|
|
|
|
<DiasporaLogo alt="diaspora-logo" />
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
<a :href="emailShareUrl" target="_blank" rel="nofollow noopener"
|
|
|
|
><b-icon icon="email" size="is-large" type="is-primary"
|
|
|
|
/></a>
|
|
|
|
<!-- TODO: mailto: links are not used anymore, we should provide a popup to redact a message instead -->
|
|
|
|
</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-06-17 15:54:24 +02:00
|
|
|
import { IEvent, EventVisibility, EventStatus } from "../../types/event.model";
|
2020-06-05 15:20:53 +02:00
|
|
|
// @ts-ignore
|
2020-06-15 16:20:58 +02:00
|
|
|
import DiasporaLogo from "../../assets/diaspora-icon.svg?inline";
|
2020-06-05 15:20:53 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
components: {
|
|
|
|
DiasporaLogo,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
export default class ShareEventModal extends Vue {
|
|
|
|
@Prop({ type: Object, required: true }) event!: IEvent;
|
2020-07-09 17:24:28 +02:00
|
|
|
|
2020-06-05 15:20:53 +02: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 {
|
|
|
|
return `https://twitter.com/intent/tweet?url=${encodeURIComponent(this.event.url)}&text=${
|
|
|
|
this.event.title
|
|
|
|
}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
get facebookShareUrl(): string {
|
|
|
|
return `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(this.event.url)}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
get linkedInShareUrl(): string {
|
|
|
|
return `https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(
|
|
|
|
this.event.url
|
|
|
|
)}&title=${this.event.title}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
copyURL() {
|
|
|
|
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>
|
|
|
|
.diaspora span svg {
|
|
|
|
height: 2rem;
|
|
|
|
width: 2rem;
|
|
|
|
}
|
|
|
|
</style>
|