From 03966410afc0a105a03689c1141521893e2878db Mon Sep 17 00:00:00 2001 From: Dawid Linek Date: Sun, 8 Sep 2024 18:38:31 +0200 Subject: [PATCH 01/11] fix: refresh block participants list after registration --- @types/nextjs-routes.d.ts | 2 +- .../rejestracja/[participationSlug]/[blockId]/formularz.tsx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/@types/nextjs-routes.d.ts b/@types/nextjs-routes.d.ts index 1ab2b2e..bb26cc6 100644 --- a/@types/nextjs-routes.d.ts +++ b/@types/nextjs-routes.d.ts @@ -14,7 +14,7 @@ declare module "nextjs-routes" { | StaticRoute<"/"> | DynamicRoute<"/event/[slug]/preview", { "slug": string }> | DynamicRoute<"/event/[slug]/settings", { "slug": string }> - | StaticRoute<"/object">; + | StaticRoute<"/object"> | DynamicRoute<"/rejestracja/[participationSlug]", { "participationSlug": string }> | DynamicRoute<"/rejestracja/[participationSlug]/[blockId]/[reservationId]", { "participationSlug": string; "blockId": string; "reservationId": string }> | DynamicRoute<"/rejestracja/[participationSlug]/[blockId]/formularz", { "participationSlug": string; "blockId": string }>; diff --git a/src/pages/rejestracja/[participationSlug]/[blockId]/formularz.tsx b/src/pages/rejestracja/[participationSlug]/[blockId]/formularz.tsx index 1c9cccc..7680697 100644 --- a/src/pages/rejestracja/[participationSlug]/[blockId]/formularz.tsx +++ b/src/pages/rejestracja/[participationSlug]/[blockId]/formularz.tsx @@ -66,6 +66,7 @@ const Submit = ({ reservationId: data.reservationId, }, }); + router.reload() }, }); From 64bba20af55e54c8b2f12d50f50d26040a5ae39b Mon Sep 17 00:00:00 2001 From: Dawid Linek Date: Sun, 8 Sep 2024 18:45:56 +0200 Subject: [PATCH 02/11] fix: can't sign up above the capacity --- src/pages/rejestracja/[participationSlug]/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/rejestracja/[participationSlug]/index.tsx b/src/pages/rejestracja/[participationSlug]/index.tsx index 1788916..095d0f5 100644 --- a/src/pages/rejestracja/[participationSlug]/index.tsx +++ b/src/pages/rejestracja/[participationSlug]/index.tsx @@ -131,7 +131,7 @@ export default function Building({ ))} - Zapisz się - + ) : (

Brak miejsc

)} ) : ( Date: Sun, 8 Sep 2024 19:47:15 +0200 Subject: [PATCH 03/11] feat: export at every subsection --- src/pages/event/[slug]/preview.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/event/[slug]/preview.tsx b/src/pages/event/[slug]/preview.tsx index b22ad40..cc419dc 100644 --- a/src/pages/event/[slug]/preview.tsx +++ b/src/pages/event/[slug]/preview.tsx @@ -39,6 +39,7 @@ import type { Tables, TablesInsert } from "@/lib/types"; import { useEvent } from "@/lib/useEvent"; import { useZodForm } from "@/lib/useZodForm"; import { cn } from "@/lib/utils"; +import Link from "next/link"; const BlockDialog = ({ children, @@ -296,6 +297,7 @@ const Preview = ({
+
{typeof currentBlock?.capacity !== "number" || - typeof blockId !== "string" ? ( + typeof blockId !== "string" ? ( Date: Sun, 8 Sep 2024 20:05:40 +0200 Subject: [PATCH 04/11] feat: copy admin link --- src/pages/event/[slug]/settings.tsx | 48 ++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/src/pages/event/[slug]/settings.tsx b/src/pages/event/[slug]/settings.tsx index 3db57e7..d2a5872 100644 --- a/src/pages/event/[slug]/settings.tsx +++ b/src/pages/event/[slug]/settings.tsx @@ -109,8 +109,8 @@ export default function Dashboard({ Ogólne Udostępnianie - Personalizacja - Inne + {/* Personalizacja */} + {/* Inne */}
@@ -303,8 +303,48 @@ export default function Dashboard({
-
+ +
+ {isClient ? ( + + ) : null} + +
+
+ {/*
*/} + {/*
@@ -332,7 +372,7 @@ export default function Dashboard({ id="people-limit-per-sector" placeholder="2" /> - + */} From b4b7397c55aaee096211316c5f455717d42ceb28 Mon Sep 17 00:00:00 2001 From: Dawid Linek Date: Sun, 8 Sep 2024 20:49:46 +0200 Subject: [PATCH 05/11] feat: implement new designs --- .../rejestracja/[participationSlug]/index.tsx | 151 +++++++++++------- 1 file changed, 90 insertions(+), 61 deletions(-) diff --git a/src/pages/rejestracja/[participationSlug]/index.tsx b/src/pages/rejestracja/[participationSlug]/index.tsx index 095d0f5..92777cd 100644 --- a/src/pages/rejestracja/[participationSlug]/index.tsx +++ b/src/pages/rejestracja/[participationSlug]/index.tsx @@ -7,13 +7,18 @@ import { parseAsString, useQueryState } from "nuqs"; import * as React from "react"; import { FaArrowLeft } from "react-icons/fa6"; import { z } from "zod"; - -import { BlockCard, blockCardVariants } from "@/components/Block"; import { buttonVariants } from "@/components/ui/button"; import { supabase } from "@/lib/supabase"; import { createSSRClient } from "@/lib/supabaseSSR"; import { useUserEvent } from "@/lib/useUserEvent"; import type { Block } from "@/types/Block"; +import { + Card, + CardDescription, + CardHeader, + CardTitle, +} from "@/components/ui/card"; +import { useState } from "react"; function buildBreadcrumbs(blocks: Block[], currentBlockId: string) { const blockMap: { [key: string]: Block } = {}; @@ -79,6 +84,11 @@ export default function Building({ ); const parentId = breadcrumbs?.[breadcrumbs.length - 2]?.blockId; + const [expandedCard, setExpandedCard] = useState(null); + + const toggleCard = (cardId: string) => { + setExpandedCard(expandedCard === cardId ? null : cardId); + }; return (
@@ -110,70 +120,89 @@ export default function Building({ > {currentBlocks?.map((block) => typeof block.capacity === "number" ? ( -
-
-

{block.name}

- {typeof block.capacity === "number" ? ( -

- {block.reservations.length}/{block.capacity} -

- ) : null} -
-
    - {block.reservations.map((reservation) => ( -
  1. - {reservation.firstName} {reservation.lastName} -
  2. - ))} -
- {(block.reservations.length < block.capacity) ? ( { - e.stopPropagation(); - }} - > - Zapisz się - ) : (

Brak miejsc

)} -
- ) : ( - { - void setBlockId(block.blockId); + toggleCard(block.blockId); + }} + onKeyDown={(e) => { + if (e.key === "Enter") { + toggleCard(block.blockId); + } }} + tabIndex={0} + key={block.blockId} - > -
-

{block.name}

- {typeof block.capacity === "number" ? ( + className="flex cursor-pointer aspect-square flex-shrink-0 flex-col items-center justify-center rounded-lg border-black"> + + + {block.name} + +

{typeof block.capacity === "number" ? (

- Liczba miejsc: {block.capacity} + Miejsca: {block.reservations.length}/{block.capacity}

- ) : null} -
-
    - {block.reservations.map((reservation) => ( -
  • - {reservation.firstName} {reservation.lastName} -
  • - ))} -
-
+ ) : null}

+ + {expandedCard !== block.blockId ? "Kliknij w sekcję, aby wyświetlić szczegóły" : "Odklinij, aby wyświetlić mniej szczegółów"} + +
+
+
    + {block.reservations.map((reservation) => ( +
  • + {reservation.firstName} {reservation.lastName} +
  • + ))} +
+
+ + {(block.reservations.length < block.capacity) ? ( { + e.stopPropagation(); + }} + > + Zapisz się + ) : (

Brak miejsc

)} +
+ +
+ + + ) : ( + { + void setBlockId(block.blockId); + }} + key={block.blockId} + className="flex cursor-pointer aspect-square flex-shrink-0 flex-col items-center justify-center rounded-lg border-black"> + + + {block.name} + + + Kliknij w sekcję, aby wyświetlić szczegóły + + + ), )} From d1c683c4199977c3299908b36120af156f1068a3 Mon Sep 17 00:00:00 2001 From: Dawid Linek Date: Sun, 8 Sep 2024 21:01:45 +0200 Subject: [PATCH 06/11] feat: lint and format --- src/pages/event/[slug]/preview.tsx | 14 ++- src/pages/event/[slug]/settings.tsx | 1 - src/pages/object.tsx | 6 +- .../[blockId]/formularz.tsx | 2 +- .../rejestracja/[participationSlug]/index.tsx | 115 ++++++++++-------- 5 files changed, 79 insertions(+), 59 deletions(-) diff --git a/src/pages/event/[slug]/preview.tsx b/src/pages/event/[slug]/preview.tsx index cc419dc..eac647b 100644 --- a/src/pages/event/[slug]/preview.tsx +++ b/src/pages/event/[slug]/preview.tsx @@ -39,7 +39,6 @@ import type { Tables, TablesInsert } from "@/lib/types"; import { useEvent } from "@/lib/useEvent"; import { useZodForm } from "@/lib/useZodForm"; import { cn } from "@/lib/utils"; -import Link from "next/link"; const BlockDialog = ({ children, @@ -297,7 +296,16 @@ const Preview = ({
- +
{typeof currentBlock?.capacity !== "number" || - typeof blockId !== "string" ? ( + typeof blockId !== "string" ? ( {selectedObject === null ? ( <> -
+
Wysiwyg
@@ -65,7 +65,7 @@ export default function Event() { ) : ( <> -
+
{ @@ -133,7 +133,7 @@ export default function Event() {

Odklinij, aby zobaczyć mniej