feat: add edit events functionality

This commit is contained in:
Levente Orban
2025-09-02 10:44:37 +02:00
parent bd9796a8d1
commit e20018735e
8 changed files with 510 additions and 47 deletions

View File

@@ -1,6 +1,7 @@
<script lang="ts">
import type { CreateEventData, EventType } from '$lib/types';
import { enhance } from '$app/forms';
import { goto } from '$app/navigation';
export let form;
@@ -37,12 +38,16 @@
};
}
function handleTypeChange(type: EventType) {
const handleTypeChange = (type: EventType) => {
eventData.type = type;
if (type === 'unlimited') {
eventData.attendee_limit = undefined;
}
}
};
const handleCancel = () => {
goto(`/discover`);
};
</script>
<svelte:head>
@@ -248,33 +253,32 @@
</p>
</div>
<!-- Submit Button -->
<button
type="submit"
disabled={isSubmitting}
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"
>
{#if isSubmitting}
<div class="flex items-center justify-center">
<div class="mr-2 h-5 w-5 animate-spin rounded-full border-b-2 border-white"></div>
Creating Event...
</div>
{:else}
Create Event
{/if}
</button>
<div class="flex space-x-3">
<button
type="button"
on:click={handleCancel}
class="flex-1 rounded-sm border-2 border-slate-300 bg-slate-200 px-4 py-3 font-semibold text-slate-700 transition-all duration-200 hover:bg-slate-400 hover:text-slate-200"
>
Cancel
</button>
<!-- Submit Button -->
<button
type="submit"
disabled={isSubmitting}
class="hover:bg-violet-400/70'l 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"
>
{#if isSubmitting}
<div class="flex items-center justify-center">
<div class="mr-2 h-5 w-5 animate-spin rounded-full border-b-2 border-white"></div>
Creating Event...
</div>
{:else}
Create Event
{/if}
</button>
</div>
</form>
</div>
<!-- Info Section -->
<div class="mt-8 p-6 text-center">
<p class="text-dark-100 font-medium">
Share the generated link with others to collect RSVPs.
</p>
<p class="mt-2 text-sm text-violet-300">
No registration required • Mobile optimized • Instant sharing
</p>
</div>
</div>
</div>
</div>