feat: invite only events

This commit is contained in:
Levente Orban
2025-10-26 16:47:51 +01:00
parent c9c78d0ea6
commit 93b0bac48a
8 changed files with 103 additions and 92 deletions

View File

@@ -31,6 +31,7 @@
$: event = data.event;
$: rsvps = data.rsvps;
$: currentUserId = data.userId;
$: isEventCreator = event.user_id === currentUserId;
// Create calendar event object when event data changes
$: if (event && browser) {
@@ -77,7 +78,7 @@
const eventId = $page.params.id || '';
const copyEventLink = () => {
if (browser) {
if (browser && isEventCreator) {
const url = `${$page.url.origin}/event/${eventId}`;
navigator.clipboard.writeText(url).then(() => {
toastType = 'copy';
@@ -442,12 +443,17 @@
<!-- Action Buttons -->
<div class="max-w-2xl space-y-3">
<button
on:click={copyEventLink}
class="hover:bg-violet-400/70' w-full rounded-sm border-2 border-violet-500 bg-violet-400/20 px-4 py-3 py-4 font-bold font-medium font-semibold text-white shadow-lg transition-all duration-200 hover:scale-105"
>
{t('event.copyLinkButton')}
</button>
{#if event.visibility !== 'invite-only'}
<button
on:click={copyEventLink}
disabled={!isEventCreator}
class="w-full rounded-sm border-2 px-4 py-3 py-4 font-bold font-medium font-semibold text-white shadow-lg transition-all duration-200 hover:scale-105 {isEventCreator
? 'border-violet-500 bg-violet-400/20 hover:bg-violet-400/70'
: 'cursor-not-allowed border-gray-500 bg-gray-600/20 hover:bg-gray-600/30'}"
>
{t('event.copyLinkButton')}
</button>
{/if}
<button
on:click={openCalendarModal}
class="hover:bg-violet-400/70' w-full rounded-sm border-2 border-violet-500 bg-violet-400/20 px-4 py-3 py-4 font-bold font-medium font-semibold text-white shadow-lg transition-all duration-200 hover:scale-105"