Add 17 features: My Work view, card copy/numbering, calendar, bulk ops, custom fields, automations, webhooks, invites, import/export, and more
Features implemented across 6 batches: - Batch A: Fix ColorPicker gradient sync, tenant custom logo, unarchive cards, board backgrounds - Batch B: My Work view, card copy/duplicate, card numbering (BOARD-123) - Batch C: Due date reminders (cron), card watching with notifications - Batch D: Bulk card operations, column sorting, calendar view - Batch E: Invite by link, board import/export (Pounce + Trello JSON) - Batch F: Webhooks with HMAC signing, custom fields, automation rules engine Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { error } from '@sveltejs/kit';
|
||||
import type { PageServerLoad } from './$types.js';
|
||||
import { prisma } from '$lib/server/db.js';
|
||||
|
||||
export const load: PageServerLoad = async ({ params, locals }) => {
|
||||
const invite = await prisma.tenantInvite.findUnique({
|
||||
where: { code: params.code },
|
||||
include: {
|
||||
tenant: { select: { name: true } }
|
||||
}
|
||||
});
|
||||
|
||||
if (!invite) throw error(404, 'Invite not found');
|
||||
|
||||
if (invite.expiresAt < new Date()) {
|
||||
throw error(410, 'This invite has expired');
|
||||
}
|
||||
|
||||
if (invite.maxUses !== null && invite.usedCount >= invite.maxUses) {
|
||||
throw error(410, 'This invite has reached its maximum number of uses');
|
||||
}
|
||||
|
||||
return {
|
||||
invite: {
|
||||
code: invite.code,
|
||||
role: invite.role,
|
||||
tenantName: invite.tenant.name,
|
||||
expiresAt: invite.expiresAt.toISOString()
|
||||
},
|
||||
user: locals.user
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,93 @@
|
||||
<script lang="ts">
|
||||
let { data } = $props();
|
||||
let loading = $state(false);
|
||||
let errorMsg = $state('');
|
||||
let accepted = $state(false);
|
||||
|
||||
async function acceptInvite() {
|
||||
loading = true;
|
||||
errorMsg = '';
|
||||
|
||||
try {
|
||||
const res = await fetch(`/api/invite/${data.invite.code}`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
});
|
||||
|
||||
const result = await res.json();
|
||||
if (!res.ok) {
|
||||
errorMsg = result.error || 'Failed to accept invite';
|
||||
return;
|
||||
}
|
||||
|
||||
accepted = true;
|
||||
} catch {
|
||||
errorMsg = 'Network error. Please try again.';
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Invite to {data.invite.tenantName}</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="flex min-h-[calc(100vh-3.5rem)] items-center justify-center px-4">
|
||||
<div class="w-full max-w-sm">
|
||||
<div class="rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 p-6 shadow-sm">
|
||||
<h1 class="text-2xl font-bold text-gray-900 dark:text-gray-100 mb-2 text-center">
|
||||
You've been invited
|
||||
</h1>
|
||||
<p class="text-center text-gray-600 dark:text-gray-400 mb-6">
|
||||
Join <span class="font-semibold text-gray-900 dark:text-gray-100">{data.invite.tenantName}</span>
|
||||
as <span class="font-semibold text-gray-900 dark:text-gray-100">{data.invite.role === 'ADMIN' ? 'an Admin' : 'a Member'}</span>
|
||||
</p>
|
||||
|
||||
{#if errorMsg}
|
||||
<div class="mb-4 rounded-lg bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 p-3 text-sm text-red-700 dark:text-red-400">
|
||||
{errorMsg}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if accepted}
|
||||
<div class="rounded-lg bg-green-50 dark:bg-green-900/30 border border-green-200 dark:border-green-800 p-4 text-center">
|
||||
<p class="text-sm font-medium text-green-700 dark:text-green-400 mb-2">Invite accepted!</p>
|
||||
<a
|
||||
href="/boards"
|
||||
class="inline-block rounded-lg bg-[var(--color-primary)] px-4 py-2 text-sm font-medium text-white hover:bg-[var(--color-primary-hover)] transition"
|
||||
>
|
||||
Go to Boards
|
||||
</a>
|
||||
</div>
|
||||
{:else if data.user}
|
||||
<button
|
||||
onclick={acceptInvite}
|
||||
disabled={loading}
|
||||
class="w-full rounded-lg bg-[var(--color-primary)] px-4 py-2.5 text-sm font-medium text-white hover:bg-[var(--color-primary-hover)] transition disabled:opacity-50"
|
||||
>
|
||||
{loading ? 'Accepting...' : 'Accept Invite'}
|
||||
</button>
|
||||
{:else}
|
||||
<div class="space-y-3">
|
||||
<a
|
||||
href="/auth/register?invite={data.invite.code}"
|
||||
class="block w-full rounded-lg bg-[var(--color-primary)] px-4 py-2.5 text-sm font-medium text-white text-center hover:bg-[var(--color-primary-hover)] transition"
|
||||
>
|
||||
Create an account
|
||||
</a>
|
||||
<a
|
||||
href="/auth/login?invite={data.invite.code}"
|
||||
class="block w-full rounded-lg border border-gray-300 dark:border-gray-600 px-4 py-2.5 text-sm font-medium text-gray-700 dark:text-gray-300 text-center hover:bg-gray-50 dark:hover:bg-gray-700 transition"
|
||||
>
|
||||
Log in
|
||||
</a>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<p class="mt-4 text-center text-xs text-gray-400 dark:text-gray-500">
|
||||
This invite expires on {new Date(data.invite.expiresAt).toLocaleDateString()}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user