Compare commits
1 Commits
492dd30829
...
ec185ba1c8
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ec185ba1c8 |
@ -3,7 +3,6 @@
|
||||
import { Entity } from '@/app/lib/definitions';
|
||||
import { getCsrfToken, getSlug } from '@/app/lib/utils';
|
||||
|
||||
|
||||
export interface Api<T extends Entity> {
|
||||
getAll(serializable: Serializable<T>, callback: (objets: T[]) => void): void;
|
||||
get(serializable: Serializable<T>, id: string, callback: (object: T) => void): void;
|
||||
@ -31,18 +30,6 @@ export class AbstractApi<T extends Entity> implements Api<T> {
|
||||
});
|
||||
}
|
||||
|
||||
getAllPdf(serializable: Serializable<T>, callback: () => void): void {
|
||||
fetch(`/api/${getSlug()}/${serializable.apiPath()}`, {
|
||||
headers: {
|
||||
'Accept': 'application/pdf',
|
||||
}
|
||||
}).then(res => res.blob())
|
||||
.then(blob => {
|
||||
var file = window.URL.createObjectURL(blob);
|
||||
window.location.assign(file);
|
||||
});
|
||||
}
|
||||
|
||||
get(serializable: Serializable<T>, id: (string | undefined), callback: (object: T) => void): void {
|
||||
const endpoint = id ? `/api/${getSlug()}/${serializable.apiPath()}/${id}` : `/api/${getSlug()}/${serializable.apiPath()}`;
|
||||
fetch(endpoint)
|
||||
|
@ -5,7 +5,7 @@ import clsx from "clsx";
|
||||
type ButtonColor = 'primary' | 'blue' | 'green' | 'red' | 'yellow' | 'gray';
|
||||
|
||||
export function classNames(type: ButtonColor) {
|
||||
return (clsx("text-white py-1 px-2 m-2 rounded disabled:opacity-50 disabled:cursor-not-allowed", {
|
||||
return (clsx("text-white py-1 px-2 mx-1 rounded disabled:opacity-50 disabled:cursor-not-allowed", {
|
||||
'bg-blue-400 hover:bg-blue-600': type === 'primary' || type === 'blue',
|
||||
'bg-green-500 hover:bg-green-600': type === 'green',
|
||||
'bg-red-500 hover:bg-red-600': type === 'red',
|
||||
|
@ -10,7 +10,6 @@ import { draggable, dropTargetForElements } from '@atlaskit/pragmatic-drag-and-d
|
||||
import { LinkIcon, TrashIcon } from "@heroicons/react/24/outline";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { useState } from "react";
|
||||
import { classNames } from "../components/button";
|
||||
|
||||
function InvitationCard({ invitation, allGuests, onGuestAdded, onDestroy }: {
|
||||
invitation: Invitation,
|
||||
@ -145,12 +144,6 @@ export default function InvitationsBoard({ guests, invitations: originalInvitati
|
||||
});
|
||||
}
|
||||
|
||||
function handleDownloadQrCodes() {
|
||||
api.getAllPdf(serializer, () => {
|
||||
console.log("QR codes downloaded");
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex h-screen">
|
||||
{/* Left Column: Guests */}
|
||||
@ -171,18 +164,11 @@ export default function InvitationsBoard({ guests, invitations: originalInvitati
|
||||
|
||||
<button
|
||||
onClick={handleCreateInvitation}
|
||||
className={classNames('primary')}
|
||||
className="mb-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600"
|
||||
>
|
||||
Create New Invitation
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={handleDownloadQrCodes}
|
||||
className={classNames('primary')}
|
||||
>
|
||||
Download QR codes
|
||||
</button>
|
||||
|
||||
|
||||
<div className="grid grid-cols-4 gap-6">
|
||||
|
||||
|
24
pnpm-lock.yaml
generated
24
pnpm-lock.yaml
generated
@ -22,7 +22,7 @@ importers:
|
||||
version: 2.23.0
|
||||
'@tiptap/react':
|
||||
specifier: ^2.14.0
|
||||
version: 2.24.0(@tiptap/core@2.14.0(@tiptap/pm@2.23.0))(@tiptap/pm@2.23.0)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
version: 2.23.1(@tiptap/core@2.14.0(@tiptap/pm@2.23.0))(@tiptap/pm@2.23.0)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
'@tiptap/starter-kit':
|
||||
specifier: ^2.14.0
|
||||
version: 2.14.0
|
||||
@ -383,8 +383,8 @@ packages:
|
||||
peerDependencies:
|
||||
'@tiptap/core': ^2.7.0
|
||||
|
||||
'@tiptap/extension-bubble-menu@2.24.0':
|
||||
resolution: {integrity: sha512-/YEayojvKC4571g/eQTkqJiXHlTpL3mRmg7E0ulnW8TuEVDbc+V64nit4xI4fgTUR5NppPEoSzVuy2XHORg6rg==}
|
||||
'@tiptap/extension-bubble-menu@2.23.1':
|
||||
resolution: {integrity: sha512-tupuvrlZMTziVZXJuCVjLwllUnux/an9BtTYHpoRyLX9Hg0v7Kh39k9x58zJaoW8Q/Oc/qxPhbJpyOqhE1rLeg==}
|
||||
peerDependencies:
|
||||
'@tiptap/core': ^2.7.0
|
||||
'@tiptap/pm': ^2.7.0
|
||||
@ -416,8 +416,8 @@ packages:
|
||||
'@tiptap/core': ^2.7.0
|
||||
'@tiptap/pm': ^2.7.0
|
||||
|
||||
'@tiptap/extension-floating-menu@2.24.0':
|
||||
resolution: {integrity: sha512-08T7cA6ILk9byvI0IMHv7MgINNx4fMUjn+1h4mX7k06rUR9P3nXEVQDQWcRZdqQ9orMdL44NtW8e+hGBZRHDQA==}
|
||||
'@tiptap/extension-floating-menu@2.23.1':
|
||||
resolution: {integrity: sha512-GMWkpH+p/OUOk1Y5UGOnKuHSDEVBN7DhYIJiWt5g9LK/mpPeuqoCmQg3RQDgjtZXb74SlxLK2pS/3YcAnemdfQ==}
|
||||
peerDependencies:
|
||||
'@tiptap/core': ^2.7.0
|
||||
'@tiptap/pm': ^2.7.0
|
||||
@ -488,8 +488,8 @@ packages:
|
||||
'@tiptap/pm@2.23.0':
|
||||
resolution: {integrity: sha512-PQFi8H+OrcaNXNGxbXSjJmZFh1wxiFMbUg25LjOX148d7i+21uWKy6avsr5rsBQNBAKIIMB6PQY61Lhv5r61uA==}
|
||||
|
||||
'@tiptap/react@2.24.0':
|
||||
resolution: {integrity: sha512-SHSfVPF3GvquImHNJGRk2bUppxAe8jSd1cUmUdc3s6eGGtU7hy4YjwF/aD6azGDT00K7bP/6/hbaMVe9fp5btg==}
|
||||
'@tiptap/react@2.23.1':
|
||||
resolution: {integrity: sha512-eP8jksq9rY1PBIYKNUgG5c92gCTNK40bmzno+cEAu8RMYs5M6BSXwMaZSjjqHM53Juvj6ake90+7kLOM8XlXfA==}
|
||||
peerDependencies:
|
||||
'@tiptap/core': ^2.7.0
|
||||
'@tiptap/pm': ^2.7.0
|
||||
@ -1604,7 +1604,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@tiptap/core': 2.14.0(@tiptap/pm@2.23.0)
|
||||
|
||||
'@tiptap/extension-bubble-menu@2.24.0(@tiptap/core@2.14.0(@tiptap/pm@2.23.0))(@tiptap/pm@2.23.0)':
|
||||
'@tiptap/extension-bubble-menu@2.23.1(@tiptap/core@2.14.0(@tiptap/pm@2.23.0))(@tiptap/pm@2.23.0)':
|
||||
dependencies:
|
||||
'@tiptap/core': 2.14.0(@tiptap/pm@2.23.0)
|
||||
'@tiptap/pm': 2.23.0
|
||||
@ -1632,7 +1632,7 @@ snapshots:
|
||||
'@tiptap/core': 2.14.0(@tiptap/pm@2.23.0)
|
||||
'@tiptap/pm': 2.23.0
|
||||
|
||||
'@tiptap/extension-floating-menu@2.24.0(@tiptap/core@2.14.0(@tiptap/pm@2.23.0))(@tiptap/pm@2.23.0)':
|
||||
'@tiptap/extension-floating-menu@2.23.1(@tiptap/core@2.14.0(@tiptap/pm@2.23.0))(@tiptap/pm@2.23.0)':
|
||||
dependencies:
|
||||
'@tiptap/core': 2.14.0(@tiptap/pm@2.23.0)
|
||||
'@tiptap/pm': 2.23.0
|
||||
@ -1710,11 +1710,11 @@ snapshots:
|
||||
prosemirror-transform: 1.10.4
|
||||
prosemirror-view: 1.40.0
|
||||
|
||||
'@tiptap/react@2.24.0(@tiptap/core@2.14.0(@tiptap/pm@2.23.0))(@tiptap/pm@2.23.0)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)':
|
||||
'@tiptap/react@2.23.1(@tiptap/core@2.14.0(@tiptap/pm@2.23.0))(@tiptap/pm@2.23.0)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)':
|
||||
dependencies:
|
||||
'@tiptap/core': 2.14.0(@tiptap/pm@2.23.0)
|
||||
'@tiptap/extension-bubble-menu': 2.24.0(@tiptap/core@2.14.0(@tiptap/pm@2.23.0))(@tiptap/pm@2.23.0)
|
||||
'@tiptap/extension-floating-menu': 2.24.0(@tiptap/core@2.14.0(@tiptap/pm@2.23.0))(@tiptap/pm@2.23.0)
|
||||
'@tiptap/extension-bubble-menu': 2.23.1(@tiptap/core@2.14.0(@tiptap/pm@2.23.0))(@tiptap/pm@2.23.0)
|
||||
'@tiptap/extension-floating-menu': 2.23.1(@tiptap/core@2.14.0(@tiptap/pm@2.23.0))(@tiptap/pm@2.23.0)
|
||||
'@tiptap/pm': 2.23.0
|
||||
'@types/use-sync-external-store': 0.0.6
|
||||
fast-deep-equal: 3.1.3
|
||||
|
Loading…
x
Reference in New Issue
Block a user