2
0
forked from jmug/cactoide

feat(tmp): invite link feature

This commit is contained in:
Levente Orban
2025-10-15 10:00:26 +02:00
parent f6b51232a7
commit c9c78d0ea6
18 changed files with 1199 additions and 164 deletions

View File

@@ -1,15 +1,15 @@
import { database } from '$lib/database/db';
import { eq, desc } from 'drizzle-orm';
import { desc, inArray } from 'drizzle-orm';
import type { PageServerLoad } from './$types';
import { events } from '$lib/database/schema';
export const load: PageServerLoad = async () => {
try {
// Fetch all public events ordered by creation date (newest first)
// Fetch all non-private events (public and invite-only) ordered by creation date (newest first)
const publicEvents = await database
.select()
.from(events)
.where(eq(events.visibility, 'public'))
.where(inArray(events.visibility, ['public', 'invite-only']))
.orderBy(desc(events.createdAt));
// Transform the database events to match the expected Event interface

View File

@@ -324,6 +324,16 @@
{event.type === 'limited' ? t('common.limited') : t('common.unlimited')}
</span>
</div>
<div class="flex items-center space-x-2">
<span
class="rounded-sm border px-2 py-1 text-xs font-medium {event.visibility ===
'public'
? 'border-teal-500 text-teal-500'
: 'border-amber-600 text-amber-600'}"
>
{event.visibility === 'public' ? t('common.public') : t('common.inviteOnly')}
</span>
</div>
</div>
</div>