mirror of
https://github.com/polaroi8d/cactoide.git
synced 2026-03-22 14:15:28 +00:00
Compare commits
3 Commits
chore/read
...
0.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69a760d3f1 | ||
|
|
a59bc3601c | ||
|
|
b64d48a933 |
@@ -1,5 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
|
import { browser } from '$app/environment';
|
||||||
import type { Event, RSVP } from '$lib/types';
|
import type { Event, RSVP } from '$lib/types';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { enhance } from '$app/forms';
|
import { enhance } from '$app/forms';
|
||||||
@@ -28,13 +29,13 @@
|
|||||||
$: currentUserId = data.userId;
|
$: currentUserId = data.userId;
|
||||||
|
|
||||||
// Create calendar event object when event data changes
|
// Create calendar event object when event data changes
|
||||||
$: if (event) {
|
$: if (event && browser) {
|
||||||
calendarEvent = {
|
calendarEvent = {
|
||||||
name: event.name,
|
name: event.name,
|
||||||
date: event.date,
|
date: event.date,
|
||||||
time: event.time,
|
time: event.time,
|
||||||
location: event.location,
|
location: event.location,
|
||||||
url: `${window.location.origin}/event/${eventId}`
|
url: `${$page.url.origin}/event/${eventId}`
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,13 +57,15 @@
|
|||||||
const eventId = $page.params.id || '';
|
const eventId = $page.params.id || '';
|
||||||
|
|
||||||
const copyEventLink = () => {
|
const copyEventLink = () => {
|
||||||
const url = `${window.location.origin}/event/${eventId}`;
|
if (browser) {
|
||||||
|
const url = `${$page.url.origin}/event/${eventId}`;
|
||||||
navigator.clipboard.writeText(url).then(() => {
|
navigator.clipboard.writeText(url).then(() => {
|
||||||
success = 'Event link copied to clipboard!';
|
success = 'Event link copied to clipboard!';
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
success = '';
|
success = '';
|
||||||
}, 3000);
|
}, 3000);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const clearMessages = () => {
|
const clearMessages = () => {
|
||||||
@@ -408,12 +411,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Calendar Modal -->
|
<!-- Calendar Modal -->
|
||||||
{#if calendarEvent}
|
{#if calendarEvent && browser}
|
||||||
<CalendarModal
|
<CalendarModal
|
||||||
bind:isOpen={showCalendarModal}
|
bind:isOpen={showCalendarModal}
|
||||||
event={calendarEvent}
|
event={calendarEvent}
|
||||||
{eventId}
|
{eventId}
|
||||||
baseUrl={window.location.origin}
|
baseUrl={$page.url.origin}
|
||||||
on:close={closeCalendarModal}
|
on:close={closeCalendarModal}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user