Compare commits

...

40 Commits

Author SHA1 Message Date
d0c2c1acd5 Merge branch 'main' into use-baked-playwright-image
Some checks failed
Playwright Tests / test (pull_request) Failing after 2s
Check usage of free licenses / build-static-assets (pull_request) Successful in 28s
Add copyright notice / copyright_notice (pull_request) Successful in 41s
Build Nginx-based docker image / build-static-assets (push) Successful in 5m46s
2025-06-01 21:25:35 +00:00
c649f327e0 Merge pull request 'Update dependency postcss to v8.5.4' (#259) from renovate/postcss-8.x into main
All checks were successful
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Successful in 53s
Build Nginx-based docker image / build-static-assets (push) Successful in 16m11s
Reviewed-on: #259
2025-06-01 20:27:40 +00:00
0c51ef656b Merge pull request 'Update dependency zod to v3.25.45' (#255) from renovate/zod-3.x-lockfile into main
Some checks failed
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Has been cancelled
Build Nginx-based docker image / build-static-assets (push) Has been cancelled
Reviewed-on: #255
2025-06-01 20:24:49 +00:00
9366a6ff15 Merge branch 'main' into renovate/zod-3.x-lockfile
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Add copyright notice / copyright_notice (pull_request) Successful in 2m23s
Check usage of free licenses / build-static-assets (pull_request) Successful in 1m45s
Build Nginx-based docker image / build-static-assets (push) Successful in 13m31s
2025-06-01 20:08:51 +00:00
73b6d9aa67 Merge branch 'main' into renovate/postcss-8.x
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Add copyright notice / copyright_notice (pull_request) Successful in 3m3s
Check usage of free licenses / build-static-assets (pull_request) Successful in 3m50s
Build Nginx-based docker image / build-static-assets (push) Successful in 18m46s
2025-06-01 20:08:36 +00:00
777d0821a0 Merge pull request 'Add a feature to handle invitations' (#261) from feat/invitations into main
All checks were successful
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Successful in 1m3s
Build Nginx-based docker image / build-static-assets (push) Successful in 8m58s
Reviewed-on: #261
2025-06-01 18:09:41 +00:00
10b741cd37 Merge branch 'feat/invitations' of https://gitea.bustikiller.com/bustikiller/wedding-planner-frontend into feat/invitations
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Add copyright notice / copyright_notice (pull_request) Successful in 1m0s
Check usage of free licenses / build-static-assets (pull_request) Successful in 1m0s
Build Nginx-based docker image / build-static-assets (push) Successful in 8m15s
2025-06-01 20:01:17 +02:00
79b7011e37 Merge remote-tracking branch 'origin/main' into feat/invitations 2025-06-01 20:00:19 +02:00
f8a52b9968 Add copyright notice
Some checks failed
Playwright Tests / test (pull_request) Has been skipped
Check usage of free licenses / build-static-assets (pull_request) Successful in 1m9s
Build Nginx-based docker image / build-static-assets (push) Has been cancelled
Add copyright notice / copyright_notice (pull_request) Successful in 1m26s
2025-06-01 17:59:55 +00:00
98d9a2544d Exlude considered guests from the list of invitations
Some checks failed
Playwright Tests / test (pull_request) Has been skipped
Check usage of free licenses / build-static-assets (pull_request) Successful in 50s
Build Nginx-based docker image / build-static-assets (push) Has been cancelled
Add copyright notice / copyright_notice (pull_request) Successful in 1m3s
2025-06-01 19:58:14 +02:00
72691f7070 Add a confirmation dialog 2025-06-01 17:48:47 +02:00
f256e0f9e7 Allow deleting an invitation 2025-06-01 17:47:50 +02:00
e6bb090b66 Update invitation via API when a guest is added 2025-06-01 17:39:02 +02:00
b820bc837a Add newly created invitations to the start of the list 2025-06-01 17:15:39 +02:00
790d75d2ff Fix UI assignment of guests to invitations 2025-06-01 17:07:47 +02:00
fb82695174 Basic drag and drop behavior 2025-06-01 16:31:54 +02:00
ecc2550146 Display empty invitations 2025-06-01 15:35:02 +02:00
16cd9e6175 Display number of guests and invitations 2025-06-01 15:30:30 +02:00
94ff03f617 Use a darker green and 4 columns for the invitations 2025-06-01 14:17:02 +02:00
54da3212cb Add an independent scroll for each column 2025-06-01 14:05:59 +02:00
537c285bd4 Initial draft of the invitations board 2025-06-01 13:29:14 +02:00
879ad14c2a Merge pull request 'Display a toast indicating affinities have been reset' (#260) from feat/notification-affinities-reset into main
All checks were successful
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Successful in 24s
Build Nginx-based docker image / build-static-assets (push) Successful in 3m0s
Reviewed-on: #260
2025-06-01 07:17:02 +00:00
9f0fcf58c4 Display a toast indicating affinities have been reset
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Add copyright notice / copyright_notice (pull_request) Successful in 46s
Check usage of free licenses / build-static-assets (pull_request) Successful in 51s
Build Nginx-based docker image / build-static-assets (push) Successful in 3m52s
2025-06-01 09:13:02 +02:00
Renovate Bot
af955d47f3 Update dependency zod to v3.25.45
Some checks failed
Add copyright notice / copyright_notice (pull_request) Failing after 33s
Playwright Tests / test (pull_request) Has been skipped
Check usage of free licenses / build-static-assets (pull_request) Failing after 41s
Build Nginx-based docker image / build-static-assets (push) Successful in 40m45s
2025-06-01 02:07:54 +00:00
Renovate Bot
b4596176cd Update dependency postcss to v8.5.4
Some checks failed
Add copyright notice / copyright_notice (pull_request) Failing after 15s
Playwright Tests / test (pull_request) Has been skipped
Check usage of free licenses / build-static-assets (pull_request) Failing after 25s
Build Nginx-based docker image / build-static-assets (push) Successful in 40m44s
2025-06-01 02:07:36 +00:00
Renovate Bot
099d336f7f Update dependency @types/node to v22.15.29
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Add copyright notice / copyright_notice (pull_request) Successful in 1m36s
Check usage of free licenses / build-static-assets (pull_request) Successful in 1m26s
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Successful in 4m26s
Build Nginx-based docker image / build-static-assets (push) Successful in 44m34s
2025-05-31 02:06:07 +00:00
Renovate Bot
e97d083912 Update dependency next to v15.3.3
Some checks failed
Playwright Tests / test (pull_request) Has been skipped
Check usage of free licenses / build-static-assets (pull_request) Successful in 2m0s
Add copyright notice / copyright_notice (pull_request) Successful in 2m34s
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Successful in 1m30s
Build Nginx-based docker image / build-static-assets (push) Failing after 49m8s
2025-05-30 02:06:16 +00:00
Renovate Bot
33049c868d Update dependency @types/react to v18.3.23
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Add copyright notice / copyright_notice (pull_request) Successful in 6m21s
Check usage of free licenses / build-static-assets (pull_request) Successful in 6m9s
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Successful in 1m47s
Build Nginx-based docker image / build-static-assets (push) Successful in 1h6m2s
2025-05-28 02:07:19 +00:00
Renovate Bot
8c51314eda Update dependency @types/node to v22.15.19
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Add copyright notice / copyright_notice (pull_request) Successful in 2m31s
Check usage of free licenses / build-static-assets (pull_request) Successful in 3m21s
Check usage of free licenses / build-static-assets (push) Successful in 46s
Playwright Tests / test (push) Has been skipped
Build Nginx-based docker image / build-static-assets (push) Successful in 7m14s
2025-05-19 02:06:05 +00:00
Renovate Bot
4bab405fae Update dependency node to v23.11.1
Some checks failed
Playwright Tests / test (pull_request) Has been skipped
Check usage of free licenses / build-static-assets (pull_request) Successful in 3m38s
Add copyright notice / copyright_notice (pull_request) Successful in 4m38s
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Failing after 6m53s
Build Nginx-based docker image / build-static-assets (push) Failing after 7m58s
2025-05-15 02:08:00 +00:00
Renovate Bot
31f5051e10 Update pnpm to v10.11.0
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Add copyright notice / copyright_notice (pull_request) Successful in 1m52s
Check usage of free licenses / build-static-assets (pull_request) Successful in 3m10s
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Successful in 4m57s
Build Nginx-based docker image / build-static-assets (push) Successful in 59m46s
2025-05-14 02:05:10 +00:00
Renovate Bot
d73ac480f4 Update dependency @types/react to v18.3.21
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Check usage of free licenses / build-static-assets (pull_request) Successful in 1m46s
Add copyright notice / copyright_notice (pull_request) Successful in 2m40s
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Successful in 33s
Build Nginx-based docker image / build-static-assets (push) Successful in 14m23s
2025-05-12 02:04:28 +00:00
Renovate Bot
29c4ad410e Update dependency next-auth to v5.0.0-beta.28
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Add copyright notice / copyright_notice (pull_request) Successful in 2m35s
Check usage of free licenses / build-static-assets (pull_request) Successful in 3m43s
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Successful in 1m20s
Build Nginx-based docker image / build-static-assets (push) Successful in 17m45s
2025-05-11 02:06:28 +00:00
Renovate Bot
d069d5bb26 Update dependency next to v15.3.2
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Add copyright notice / copyright_notice (pull_request) Successful in 3m57s
Check usage of free licenses / build-static-assets (pull_request) Successful in 5m28s
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Successful in 5m18s
Build Nginx-based docker image / build-static-assets (push) Successful in 47m31s
2025-05-10 02:07:11 +00:00
Renovate Bot
a03a67234c Update dependency @types/node to v22.15.17
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Check usage of free licenses / build-static-assets (pull_request) Successful in 3m40s
Add copyright notice / copyright_notice (pull_request) Successful in 3m47s
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Successful in 4m13s
Build Nginx-based docker image / build-static-assets (push) Successful in 1h4m55s
2025-05-09 02:05:04 +00:00
593c019fd3 Merge pull request 'Update dependency zod to v3.24.4' (#245) from renovate/zod-3.x-lockfile into main
All checks were successful
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Successful in 22s
Build Nginx-based docker image / build-static-assets (push) Successful in 3m33s
Reviewed-on: #245
2025-05-05 08:04:59 +00:00
Renovate Bot
c18fbe96bc Update dependency zod to v3.24.4
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Add copyright notice / copyright_notice (pull_request) Successful in 1m16s
Check usage of free licenses / build-static-assets (pull_request) Successful in 1m56s
Build Nginx-based docker image / build-static-assets (push) Successful in 3m43s
2025-05-05 02:03:43 +00:00
Renovate Bot
906477030b Update dependency @types/react-dom to v18.3.7
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Add copyright notice / copyright_notice (pull_request) Successful in 6m32s
Check usage of free licenses / build-static-assets (pull_request) Successful in 3m43s
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Successful in 6m53s
Build Nginx-based docker image / build-static-assets (push) Successful in 42m12s
2025-05-01 02:06:46 +00:00
Renovate Bot
eb8a7a7f85 Update pnpm to v10.10.0
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Add copyright notice / copyright_notice (pull_request) Successful in 6m45s
Check usage of free licenses / build-static-assets (pull_request) Successful in 6m42s
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Successful in 4m28s
Build Nginx-based docker image / build-static-assets (push) Successful in 52m38s
2025-04-30 02:06:51 +00:00
Renovate Bot
a03b957f39 Update dependency @types/node to v22.15.3
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Add copyright notice / copyright_notice (pull_request) Successful in 1m13s
Check usage of free licenses / build-static-assets (pull_request) Successful in 1m8s
Playwright Tests / test (push) Has been skipped
Check usage of free licenses / build-static-assets (push) Successful in 4m35s
Build Nginx-based docker image / build-static-assets (push) Successful in 55m51s
2025-04-29 02:05:26 +00:00
7 changed files with 993 additions and 114 deletions

2
.nvmrc
View File

@ -1 +1 @@
23.11.0 23.11.1

View File

@ -14,10 +14,15 @@ import GroupsTable from '@/app/ui/groups/table';
import SkeletonTable from '@/app/ui/guests/skeleton-row'; import SkeletonTable from '@/app/ui/guests/skeleton-row';
import GuestsTable from '@/app/ui/guests/table'; import GuestsTable from '@/app/ui/guests/table';
import { TabPanel, TabView } from 'primereact/tabview'; import { TabPanel, TabView } from 'primereact/tabview';
import { Suspense, useState } from 'react'; import { Toast } from 'primereact/toast';
import { Suspense, useRef, useState } from 'react';
import InvitationsBoard from '@/app/ui/invitations/board';
import { Invitation, InvitationSerializer } from '@/app/lib/invitation';
export default function Page() { export default function Page() {
const toast = useRef<Toast>(null);
function refreshGuests() { function refreshGuests() {
new AbstractApi<Guest>().getAll(new GuestSerializer(), (objects: Guest[]) => { new AbstractApi<Guest>().getAll(new GuestSerializer(), (objects: Guest[]) => {
setGuests(objects); setGuests(objects);
@ -32,6 +37,13 @@ export default function Page() {
}); });
} }
function refreshInvitations() {
new AbstractApi<Invitation>().getAll(new InvitationSerializer(), (objects: Invitation[]) => {
setInvitations(objects);
setInvitationsLoaded(true);
});
}
function resetAffinities() { function resetAffinities() {
fetch(`/api/${getSlug()}/groups/affinities/reset`, { fetch(`/api/${getSlug()}/groups/affinities/reset`, {
method: 'POST', method: 'POST',
@ -40,6 +52,24 @@ export default function Page() {
'X-CSRF-TOKEN': getCsrfToken(), 'X-CSRF-TOKEN': getCsrfToken(),
} }
}) })
.then(response => {
if (response.ok) {
showAffinitiesResetSuccess();
} else {
console.error('Failed to reset affinities');
}
})
.catch(error => {
console.error('Error resetting affinities:', error);
});
}
function showAffinitiesResetSuccess() {
toast.current?.show({
severity: 'success',
summary: 'Affinities reset',
detail: 'All affinities have been reset to default values.'
});
} }
const [groupsLoaded, setGroupsLoaded] = useState(false); const [groupsLoaded, setGroupsLoaded] = useState(false);
@ -52,8 +82,13 @@ export default function Page() {
const [guests, setGuests] = useState<Array<Guest>>([]); const [guests, setGuests] = useState<Array<Guest>>([]);
const [guestBeingEdited, setGuestBeingEdited] = useState<Guest | undefined>(undefined); const [guestBeingEdited, setGuestBeingEdited] = useState<Guest | undefined>(undefined);
const [invitationsLoaded, setInvitationsLoaded] = useState(false);
const [invitations, setInvitations] = useState<Array<Invitation>>([]);
const [invitationBeingEdited, setInvitationBeingEdited] = useState<Invitation | undefined>(undefined);
!groupsLoaded && refreshGroups(); !groupsLoaded && refreshGroups();
!guestsLoaded && refreshGuests(); !guestsLoaded && refreshGuests();
!invitationsLoaded && refreshInvitations();
return ( return (
<div className="w-full"> <div className="w-full">
@ -82,6 +117,7 @@ export default function Page() {
<div className="flex flex-col w-full items-center justify-between"> <div className="flex flex-col w-full items-center justify-between">
<div> <div>
<Toast ref={toast} />
<button onClick={() => setGroupBeingEdited({})} className={classNames('primary')}>Add new</button> <button onClick={() => setGroupBeingEdited({})} className={classNames('primary')}>Add new</button>
<button onClick={resetAffinities} className={classNames('yellow')}>Reset affinities</button> <button onClick={resetAffinities} className={classNames('yellow')}>Reset affinities</button>
</div> </div>
@ -112,6 +148,9 @@ export default function Page() {
</Suspense> </Suspense>
</div> </div>
</ TabPanel> </ TabPanel>
<TabPanel header="Invitations" leftIcon="pi pi-envelope mx-2">
<InvitationsBoard guests={guests} invitations={invitations}/>
</TabPanel>
</ TabView> </ TabView>
</div> </div>

View File

@ -4,7 +4,7 @@ import { Entity } from '@/app/lib/definitions';
import { getCsrfToken, getSlug } from '@/app/lib/utils'; import { getCsrfToken, getSlug } from '@/app/lib/utils';
export interface Api<T extends Entity> { export interface Api<T extends Entity> {
getAll(serializable: Serializable<T> ,callback: (objets: T[]) => void): void; getAll(serializable: Serializable<T>, callback: (objets: T[]) => void): void;
get(serializable: Serializable<T>, id: string, callback: (object: T) => void): void; get(serializable: Serializable<T>, id: string, callback: (object: T) => void): void;
create(serializable: Serializable<T>, object: T, callback: () => void): void; create(serializable: Serializable<T>, object: T, callback: () => void): void;
update(serializable: Serializable<T>, object: T, callback: () => void): void; update(serializable: Serializable<T>, object: T, callback: () => void): void;
@ -52,7 +52,7 @@ export class AbstractApi<T extends Entity> implements Api<T> {
.catch((error) => console.error(error)); .catch((error) => console.error(error));
} }
create(serializable: Serializable<T>, object: T, callback: () => void): void { create(serializable: Serializable<T>, object: T, callback: (createdObject: T) => void): void {
fetch(`/api/${getSlug()}/${serializable.apiPath()}`, { fetch(`/api/${getSlug()}/${serializable.apiPath()}`, {
method: 'POST', method: 'POST',
body: serializable.toJson(object), body: serializable.toJson(object),
@ -60,7 +60,11 @@ export class AbstractApi<T extends Entity> implements Api<T> {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'X-CSRF-TOKEN': getCsrfToken(), 'X-CSRF-TOKEN': getCsrfToken(),
} }
}).then(callback) })
.then((response) => response.json())
.then((data) => {
callback(serializable.fromJson(data));
})
.catch((error) => console.error(error)); .catch((error) => console.error(error));
} }

28
app/lib/invitation.tsx Normal file
View File

@ -0,0 +1,28 @@
/* Copyright (C) 2024-2025 LibreWeddingPlanner contributors*/
import { Entity } from "./definitions";
import { Guest } from "./guest";
export class Invitation implements Entity {
id?: string;
guests: Array<Guest>;
constructor(id?: string, guests: Array<Guest> = []) {
this.id = id;
this.guests = guests;
}
}
export class InvitationSerializer {
fromJson(data: any): Invitation {
return new Invitation(data.id, (data.guests || []).map((guest: any) => new Guest(guest.id, guest.name, guest.group_name, guest.groupId, guest.color, guest.status, guest.children)));
}
toJson(invitation: Invitation): string {
return JSON.stringify({ invitation: { guest_ids: invitation.guests.map(guest => guest.id) } });
}
apiPath(): string {
return 'invitations';
}
}

View File

@ -0,0 +1,187 @@
/* Copyright (C) 2024-2025 LibreWeddingPlanner contributors*/
'use client';
import { AbstractApi } from "@/app/api/abstract-api";
import { Guest } from "@/app/lib/guest";
import { Invitation, InvitationSerializer } from "@/app/lib/invitation";
import { draggable, dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
import { TrashIcon } from "@heroicons/react/24/outline";
import { useEffect, useRef } from "react";
import { useState } from "react";
function InvitationCard({ invitation, allGuests, onGuestAdded, onDestroy }: {
invitation: Invitation,
allGuests: Guest[],
onGuestAdded: (guest: Guest) => void,
onDestroy: (invitation: Invitation) => void
}
) {
const [guests, setGuests] = useState<Guest[]>(invitation.guests);
const ref = useRef<HTMLDivElement | null>(null);
const api = new AbstractApi<Invitation>();
const serializer = new InvitationSerializer();
useEffect(() => {
if (ref.current) {
return dropTargetForElements({
element: ref.current,
onDrop: (data) => {
const guestId = data.source.element.dataset.guestId;
if (guestId) {
const guestToAdd = allGuests.find((guest) => guest.id === guestId);
if (guestToAdd) {
setGuests((prevGuests) => [...prevGuests, guestToAdd]);
invitation.guests.push(guestToAdd);
api.update(serializer, invitation, () => {
onGuestAdded(guestToAdd);
});
}
}
},
});
}
}, []);
return (
<div
key={invitation.id}
ref={ref}
className="relative flex items-center justify-center w-full bg-green-800 border border-green-900 group"
style={{ aspectRatio: "1.618 / 1" }}
>
<TrashIcon
className="w-5 h-5 text-white absolute top-2 right-2 opacity-0 group-hover:opacity-100 cursor-pointer"
onClick={() => {
if (window.confirm("Are you sure you want to delete this invitation?")) {
api.destroy(serializer, invitation, () => {
onDestroy(invitation);
});
}
}}
/>
{guests.length === 0 ? (
<p className="text-center text-yellow-500 text-lg italic">
(empty invitation)
</p>
) : (
<ul className="text-center text-yellow-500 text-lg">
{guests.map((guest) => (
<li key={guest.id}>{guest.name}</li>
))}
</ul>
)}
</div>
)
}
function GuestCard(guest: Guest) {
const ref = useRef<HTMLDivElement | null>(null);
useEffect(() => {
if (ref.current) {
return draggable({
element: ref.current,
});
}
}, [guest.id]);
return (
<div
key={guest.id}
ref={ref}
className="mb-4 p-4 border border-gray-300 rounded-lg shadow-sm bg-white cursor-move"
draggable="true"
data-guest-id={guest.id}>
<h3 className="text-md font-medium">{guest.name}</h3>
</div>
)
}
export default function InvitationsBoard({ guests, invitations: originalInvitations }: {
guests: Array<Guest>,
invitations: Array<Invitation>
}) {
const api = new AbstractApi<Invitation>();
const serializer = new InvitationSerializer();
const [invitations, setInvitations] = useState<Invitation[]>(originalInvitations);
const [unassignedGuests, setUnassignedGuests] = useState<Guest[]>(
guests.filter(
(guest) =>
guest.status !== 'considered' &&
!invitations.some((invitation) =>
invitation.guests.some((invitedGuest) => invitedGuest.id === guest.id)
)
)
);
// Sort invitations to display those without guests at the top
const sortedInvitations = [...invitations].sort((a, b) => {
if (a.guests.length === 0 && b.guests.length > 0) return -1;
if (a.guests.length > 0 && b.guests.length === 0) return 1;
return 0;
});
function handleCreateInvitation() {
api.create(serializer, new Invitation(), (createdInvitation) => {
setInvitations((prevInvitations) => [createdInvitation, ...prevInvitations]);
});
}
return (
<div className="flex h-screen">
{/* Left Column: Guests */}
<div className="w-1/4 h-full overflow-auto border-r border-gray-300 p-4">
<h2 className="text-lg font-semibold mb-4">{unassignedGuests.length} guests without invitation</h2>
<div>
{unassignedGuests.map((guest) => (
<GuestCard key={guest.id} {...guest} />
))}
</div>
</div>
{/* Right Column: Invitations */}
<div className="w-3/4 h-full overflow-auto p-4">
<h2 className="text-lg font-semibold mb-4">
{invitations.length} invitations
</h2>
<button
onClick={handleCreateInvitation}
className="mb-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600"
>
Create New Invitation
</button>
<div className="grid grid-cols-4 gap-6">
{sortedInvitations.map((invitation) => (
<InvitationCard
key={invitation.id}
invitation={invitation}
allGuests={guests}
onGuestAdded={(guestAdded: Guest) => {
setUnassignedGuests((prevUnassignedGuests) => prevUnassignedGuests.filter(g => g.id !== guestAdded.id));
}}
onDestroy={(invitationToDestroy: Invitation) => {
setInvitations((prevInvitations) => prevInvitations.filter(i => i.id !== invitationToDestroy.id));
setUnassignedGuests((prevUnassignedGuests) => [
...prevUnassignedGuests,
...invitationToDestroy.guests
]);
}}
/>
))}
</div>
</div>
</div>
);
}

View File

@ -6,14 +6,15 @@
"start": "next start" "start": "next start"
}, },
"dependencies": { "dependencies": {
"@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
"@heroicons/react": "^2.1.4", "@heroicons/react": "^2.1.4",
"@tailwindcss/forms": "^0.5.7", "@tailwindcss/forms": "^0.5.7",
"autoprefixer": "10.4.21", "autoprefixer": "10.4.21",
"bcrypt": "^5.1.1", "bcrypt": "^5.1.1",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"next": "15.3.1", "next": "15.3.3",
"next-auth": "5.0.0-beta.27", "next-auth": "5.0.0-beta.28",
"postcss": "8.5.3", "postcss": "8.5.4",
"primeicons": "^7.0.0", "primeicons": "^7.0.0",
"primereact": "^10.8.2", "primereact": "^10.8.2",
"react": "19.0.0-rc-f38c22b244-20240704", "react": "19.0.0-rc-f38c22b244-20240704",
@ -27,12 +28,12 @@
"devDependencies": { "devDependencies": {
"@playwright/test": "^1.46.0", "@playwright/test": "^1.46.0",
"@types/bcrypt": "^5.0.2", "@types/bcrypt": "^5.0.2",
"@types/node": "22.15.2", "@types/node": "22.15.29",
"@types/react": "18.3.20", "@types/react": "18.3.23",
"@types/react-dom": "18.3.6" "@types/react-dom": "18.3.7"
}, },
"engines": { "engines": {
"node": ">=23.0.0" "node": ">=23.0.0"
}, },
"packageManager": "pnpm@10.9.0+sha512.0486e394640d3c1fb3c9d43d49cf92879ff74f8516959c235308f5a8f62e2e19528a65cdc2a3058f587cde71eba3d5b56327c8c33a97e4c4051ca48a10ca2d5f" "packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977"
} }

820
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff