mirror of
https://github.com/polaroi8d/cactoide.git
synced 2026-03-22 14:15:28 +00:00
Compare commits
8 Commits
fix/missin
...
fix/edit-e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7692f9d503 | ||
|
|
baf3fcd923 | ||
|
|
5468bc7cb2 | ||
|
|
0afe331cab | ||
|
|
fa9a79192c | ||
|
|
7275084ab9 | ||
|
|
02975a0abd | ||
|
|
aebe477f90 |
@@ -28,6 +28,7 @@
|
|||||||
"public": "Public",
|
"public": "Public",
|
||||||
"private": "Private",
|
"private": "Private",
|
||||||
"inviteOnly": "Invite Only",
|
"inviteOnly": "Invite Only",
|
||||||
|
"invite-only": "Invite Only",
|
||||||
"limited": "Limited",
|
"limited": "Limited",
|
||||||
"unlimited": "Unlimited",
|
"unlimited": "Unlimited",
|
||||||
"capacity": "Capacity",
|
"capacity": "Capacity",
|
||||||
@@ -267,7 +268,7 @@
|
|||||||
"layout": {
|
"layout": {
|
||||||
"defaultTitle": "Cactoide -",
|
"defaultTitle": "Cactoide -",
|
||||||
"defaultDescription": "Create and manage event RSVPs",
|
"defaultDescription": "Create and manage event RSVPs",
|
||||||
"userIdCookieText": "Your UserID storated as a cookie:",
|
"userIdCookieText": "Your UserID stored as a cookie:",
|
||||||
"firstTimeVisiting": "First time visiting. Generating new UserID...",
|
"firstTimeVisiting": "First time visiting. Generating new UserID...",
|
||||||
"copyright": "© 2025 Cactoide"
|
"copyright": "© 2025 Cactoide"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<!-- Error Content -->
|
<!-- Error Content -->
|
||||||
<div class="container mx-auto flex-1 px-4 py-8">
|
<div class="container mx-auto flex-1 px-4 py-8">
|
||||||
<div class="mx-auto max-w-md text-center">
|
<div class="mx-auto max-w-md text-center">
|
||||||
<div class="rounded-sm border border-red-500/30 bg-red-900/20 p-8">
|
<div class="rounded-sm border border-red-500/30 bg-red-900 p-8">
|
||||||
<div class="mb-4 text-6xl text-red-400">🚨</div>
|
<div class="mb-4 text-6xl text-red-400">🚨</div>
|
||||||
<h2 class="mb-4 text-2xl font-bold text-red-400">{t('errors.errorTitle')}</h2>
|
<h2 class="mb-4 text-2xl font-bold text-red-400">{t('errors.errorTitle')}</h2>
|
||||||
|
|
||||||
|
|||||||
@@ -156,7 +156,8 @@
|
|||||||
? 'border-green-300 text-green-400'
|
? 'border-green-300 text-green-400'
|
||||||
: 'border-orange-300 text-orange-400'}"
|
: 'border-orange-300 text-orange-400'}"
|
||||||
>
|
>
|
||||||
{event.visibility === 'public' ? t('common.public') : t('common.private')}
|
<!-- TODO(polaroi8d): replace with something better solution; message.json using this, beacuse of common.invite-only works here -->
|
||||||
|
{t(`common.${event.visibility}`)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center space-x-2"></div>
|
<div class="flex items-center space-x-2"></div>
|
||||||
|
|||||||
@@ -485,19 +485,19 @@
|
|||||||
{#if success}
|
{#if success}
|
||||||
{#if typeToShow === 'add'}
|
{#if typeToShow === 'add'}
|
||||||
<div
|
<div
|
||||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-green-500/30 bg-green-900/20 p-4 text-green-400"
|
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-green-500/30 bg-green-900 p-4 text-green-400"
|
||||||
>
|
>
|
||||||
{success}
|
{success}
|
||||||
</div>
|
</div>
|
||||||
{:else if typeToShow === 'remove'}
|
{:else if typeToShow === 'remove'}
|
||||||
<div
|
<div
|
||||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-yellow-500/30 bg-yellow-900/20 p-4 text-yellow-400"
|
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-yellow-500/30 bg-yellow-900 p-4 text-yellow-400"
|
||||||
>
|
>
|
||||||
{t('event.removedRsvpSuccessfully')}
|
{t('event.removedRsvpSuccessfully')}
|
||||||
</div>
|
</div>
|
||||||
{:else if typeToShow === 'copy'}
|
{:else if typeToShow === 'copy'}
|
||||||
<div
|
<div
|
||||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-yellow-500/30 bg-yellow-900/20 p-4 text-yellow-400"
|
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-yellow-500/30 bg-yellow-900 p-4 text-yellow-400"
|
||||||
>
|
>
|
||||||
{t('event.eventLinkCopied')}
|
{t('event.eventLinkCopied')}
|
||||||
</div>
|
</div>
|
||||||
@@ -508,7 +508,7 @@
|
|||||||
|
|
||||||
{#if error}
|
{#if error}
|
||||||
<div
|
<div
|
||||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-red-500/30 bg-red-900/20 p-4 text-red-400"
|
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-red-500/30 bg-red-900 p-4 text-red-400"
|
||||||
>
|
>
|
||||||
{error}
|
{error}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export const actions: Actions = {
|
|||||||
const date = formData.get('date') as string;
|
const date = formData.get('date') as string;
|
||||||
const time = formData.get('time') as string;
|
const time = formData.get('time') as string;
|
||||||
const location = formData.get('location') as string;
|
const location = formData.get('location') as string;
|
||||||
const locationType = formData.get('location_type') as 'none' | 'text' | 'maps';
|
const locationType = formData.get('locationType') as string;
|
||||||
const locationUrl = formData.get('location_url') as string;
|
const locationUrl = formData.get('location_url') as string;
|
||||||
const type = formData.get('type') as 'limited' | 'unlimited';
|
const type = formData.get('type') as 'limited' | 'unlimited';
|
||||||
const attendeeLimit = formData.get('attendee_limit') as string;
|
const attendeeLimit = formData.get('attendee_limit') as string;
|
||||||
@@ -109,7 +109,7 @@ export const actions: Actions = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if date is in the past using local timezone (but allow editing past events for corrections)
|
// Check if date is in the past using local timezone
|
||||||
const [year, month, day] = date.split('-').map(Number);
|
const [year, month, day] = date.split('-').map(Number);
|
||||||
const eventDate = new Date(year, month - 1, day);
|
const eventDate = new Date(year, month - 1, day);
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
@@ -148,7 +148,6 @@ export const actions: Actions = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the event
|
// Update the event
|
||||||
await database
|
await database
|
||||||
.update(events)
|
.update(events)
|
||||||
@@ -157,7 +156,7 @@ export const actions: Actions = {
|
|||||||
date: date,
|
date: date,
|
||||||
time: time,
|
time: time,
|
||||||
location: location?.trim() || '',
|
location: location?.trim() || '',
|
||||||
locationType: locationType,
|
locationType: locationType as 'none' | 'text' | 'maps',
|
||||||
locationUrl: locationType === 'maps' ? locationUrl?.trim() : null,
|
locationUrl: locationType === 'maps' ? locationUrl?.trim() : null,
|
||||||
type: type,
|
type: type,
|
||||||
attendeeLimit: type === 'limited' ? parseInt(attendeeLimit) : null,
|
attendeeLimit: type === 'limited' ? parseInt(attendeeLimit) : null,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { EventType, LocationType } from '$lib/types';
|
import type { CreateEventData, EventType, LocationType } from '$lib/types';
|
||||||
import { enhance } from '$app/forms';
|
import { enhance } from '$app/forms';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { t } from '$lib/i18n/i18n.js';
|
import { t } from '$lib/i18n/i18n.js';
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
export let data;
|
export let data;
|
||||||
export let form;
|
export let form;
|
||||||
|
|
||||||
let eventData = {
|
let eventData: CreateEventData = {
|
||||||
name: data.event.name,
|
name: data.event.name,
|
||||||
date: data.event.date,
|
date: data.event.date,
|
||||||
time: data.event.time,
|
time: data.event.time,
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
location_type: data.event.locationType || 'none',
|
location_type: data.event.locationType || 'none',
|
||||||
location_url: data.event.locationUrl || '',
|
location_url: data.event.locationUrl || '',
|
||||||
type: data.event.type,
|
type: data.event.type,
|
||||||
attendee_limit: data.event.attendeeLimit,
|
attendee_limit: data.event.attendeeLimit || undefined,
|
||||||
visibility: data.event.visibility
|
visibility: data.event.visibility
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -44,14 +44,14 @@
|
|||||||
attendee_limit: (values as any).attendee_limit
|
attendee_limit: (values as any).attendee_limit
|
||||||
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
parseInt(String((values as any).attendee_limit))
|
parseInt(String((values as any).attendee_limit))
|
||||||
: null
|
: undefined
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleTypeChange = (type: EventType) => {
|
const handleTypeChange = (type: EventType) => {
|
||||||
eventData.type = type;
|
eventData.type = type;
|
||||||
if (type === 'unlimited') {
|
if (type === 'unlimited') {
|
||||||
eventData.attendee_limit = null;
|
eventData.attendee_limit = undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -189,6 +189,9 @@
|
|||||||
|
|
||||||
<!-- Location Type -->
|
<!-- Location Type -->
|
||||||
<div>
|
<div>
|
||||||
|
<!-- Hidden input to submit locationType value -->
|
||||||
|
<input type="hidden" name="locationType" bind:value={eventData.location_type} />
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend class="text-dark-800 mb-3 block text-sm font-semibold">
|
<legend class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||||
{t('create.locationTypeLabel')}
|
{t('create.locationTypeLabel')}
|
||||||
@@ -279,6 +282,9 @@
|
|||||||
|
|
||||||
<!-- Event Type -->
|
<!-- Event Type -->
|
||||||
<div>
|
<div>
|
||||||
|
<!-- Hidden input to submit type value -->
|
||||||
|
<input type="hidden" name="type" bind:value={eventData.type} />
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend class="text-dark-800 mb-3 block text-sm font-semibold">
|
<legend class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||||
{t('common.type')} <span class="text-red-400">{t('common.required')}</span>
|
{t('common.type')} <span class="text-red-400">{t('common.required')}</span>
|
||||||
@@ -333,6 +339,9 @@
|
|||||||
|
|
||||||
<!-- Event Visibility -->
|
<!-- Event Visibility -->
|
||||||
<div>
|
<div>
|
||||||
|
<!-- Hidden input to submit visibility value -->
|
||||||
|
<input type="hidden" name="visibility" bind:value={eventData.visibility} />
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend class="text-dark-800 mb-3 block text-sm font-semibold">
|
<legend class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||||
{t('common.visibility')} <span class="text-red-400">{t('common.required')}</span>
|
{t('common.visibility')} <span class="text-red-400">{t('common.required')}</span>
|
||||||
@@ -444,7 +453,7 @@
|
|||||||
<!-- Invite Link Toast -->
|
<!-- Invite Link Toast -->
|
||||||
{#if showInviteLinkToast}
|
{#if showInviteLinkToast}
|
||||||
<div
|
<div
|
||||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-yellow-500/30 bg-yellow-900/20 p-4 text-yellow-400"
|
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-yellow-500/30 bg-yellow-900 p-4 text-yellow-400"
|
||||||
>
|
>
|
||||||
{t('event.inviteLinkCopied')}
|
{t('event.inviteLinkCopied')}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -450,13 +450,13 @@
|
|||||||
{#if success}
|
{#if success}
|
||||||
{#if form?.type === 'add'}
|
{#if form?.type === 'add'}
|
||||||
<div
|
<div
|
||||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-green-500/30 bg-green-900/20 p-4 text-green-400"
|
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-green-500 bg-green-900 p-4 text-green-400"
|
||||||
>
|
>
|
||||||
{success}
|
{success}
|
||||||
</div>
|
</div>
|
||||||
{:else if form?.type === 'remove'}
|
{:else if form?.type === 'remove'}
|
||||||
<div
|
<div
|
||||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-yellow-500/30 bg-yellow-900/20 p-4 text-yellow-400"
|
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-yellow-500 bg-yellow-900 p-4 text-yellow-400"
|
||||||
>
|
>
|
||||||
{t('event.removedRsvpSuccessfully')}
|
{t('event.removedRsvpSuccessfully')}
|
||||||
</div>
|
</div>
|
||||||
@@ -465,7 +465,7 @@
|
|||||||
|
|
||||||
{#if error}
|
{#if error}
|
||||||
<div
|
<div
|
||||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-red-500/30 bg-red-900/20 p-4 text-red-400"
|
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-red-500 bg-red-900 p-4 text-red-400"
|
||||||
>
|
>
|
||||||
{error}
|
{error}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user