diff --git a/@types/nextjs-routes.d.ts b/@types/nextjs-routes.d.ts
index 39b3213..9bf6fbe 100644
--- a/@types/nextjs-routes.d.ts
+++ b/@types/nextjs-routes.d.ts
@@ -12,10 +12,11 @@ declare module "nextjs-routes" {
export type Route =
| StaticRoute<"/">
- | StaticRoute<"/building">
| DynamicRoute<"/event/[slug]/preview", { "slug": string }>
| DynamicRoute<"/event/[slug]/settings", { "slug": string }>
- | StaticRoute<"/rooms">;
+ | 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 }>;
interface StaticRoute {
pathname: Pathname;
diff --git a/next.config.mjs b/next.config.mjs
index 401cd2a..e5d970b 100644
--- a/next.config.mjs
+++ b/next.config.mjs
@@ -6,7 +6,11 @@ const withRoutes = nextRoutes();
const nextConfig = {
reactStrictMode: true,
images: {
- domains: ["cms.solvro.pl"],
+ remotePatterns: [
+ {
+ hostname: "cms.solvro.pl",
+ },
+ ],
},
};
diff --git a/package.json b/package.json
index c5308d1..54e245c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,7 @@
{
"name": "my-app",
"version": "0.1.0",
+ "type": "module",
"private": true,
"scripts": {
"dev": "next dev",
diff --git a/src/components/Block.tsx b/src/components/Block.tsx
new file mode 100644
index 0000000..cb23850
--- /dev/null
+++ b/src/components/Block.tsx
@@ -0,0 +1,20 @@
+import { cva } from "class-variance-authority";
+import React, { type ComponentProps } from "react";
+
+export const blockCardVariants = cva(
+ "flex h-72 w-72 border-spacing-1 rounded-md border border-[#71717A] transition-all duration-300 ease-in-out hover:shadow-md",
+);
+
+export const BlockCard = ({
+ className,
+ ...props
+}: ComponentProps<"button">) => {
+ return (
+
+ );
+};
diff --git a/src/lib/useIsClient.ts b/src/lib/useIsClient.ts
new file mode 100644
index 0000000..5153f69
--- /dev/null
+++ b/src/lib/useIsClient.ts
@@ -0,0 +1,11 @@
+import React from "react";
+
+export const useIsClient = () => {
+ const [isClient, setIsClient] = React.useState(false);
+
+ React.useEffect(() => {
+ setIsClient(true);
+ }, []);
+
+ return isClient;
+};
diff --git a/src/lib/useUserEvent.ts b/src/lib/useUserEvent.ts
new file mode 100644
index 0000000..b7a22ac
--- /dev/null
+++ b/src/lib/useUserEvent.ts
@@ -0,0 +1,31 @@
+import { useQuery } from "@tanstack/react-query";
+
+import { supabase } from "./supabase";
+import type { Tables } from "./types";
+
+export const useUserEvent = (
+ participationSlug: string,
+ initialData?: Tables<"events">,
+) => {
+ const query = useQuery({
+ queryKey: ["event-user", participationSlug],
+ initialData,
+ queryFn: async () => {
+ const event = await supabase
+ .from("events")
+ .select("*")
+ .eq("participantsSlug", participationSlug)
+ .single()
+ .throwOnError();
+
+ if (!event.data) {
+ throw new Error("Event not found");
+ }
+
+ return event.data;
+ },
+ refetchInterval: 1000,
+ });
+
+ return query;
+};
diff --git a/src/pages/building.tsx b/src/pages/building.tsx
deleted file mode 100644
index 4c82bd7..0000000
--- a/src/pages/building.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import Link from "next/link";
-import * as React from "react";
-
-import {
- Card,
- CardContent,
- CardDescription,
- CardFooter,
- CardHeader,
- CardTitle,
-} from "@/components/ui/card";
-
-export default function Building() {
- return (
-
-
- Rajd wiosenny W4
-
-
-
- {[1, 2, 3, 4, 5, 6, 7, 8].map((bulding) => (
-
-
-
- Budynek {bulding}
-
- Kliknij, aby przejść do rezerwacji
-
-
- CardContent
- CardFooter
-
-
- ))}
-
-
- );
-}
diff --git a/src/pages/event/[slug]/preview.tsx b/src/pages/event/[slug]/preview.tsx
index f68dc8c..b22ad40 100644
--- a/src/pages/event/[slug]/preview.tsx
+++ b/src/pages/event/[slug]/preview.tsx
@@ -11,6 +11,7 @@ import React, { type ReactNode, useEffect, useState } from "react";
import { toast } from "sonner";
import { z } from "zod";
+import { BlockCard } from "@/components/Block";
import { ReservationsTable } from "@/components/ContactTable";
import { Layout } from "@/components/Layout";
import { Button } from "@/components/ui/button";
@@ -335,9 +336,9 @@ const Preview = ({
)}
{currentBlocks?.map((block) => (
-
) : null}
-
+
))}
diff --git a/src/pages/event/[slug]/settings.tsx b/src/pages/event/[slug]/settings.tsx
index 5673591..3db57e7 100644
--- a/src/pages/event/[slug]/settings.tsx
+++ b/src/pages/event/[slug]/settings.tsx
@@ -2,7 +2,7 @@ import { CalendarIcon, ReloadIcon } from "@radix-ui/react-icons";
import { useMutation } from "@tanstack/react-query";
import { format } from "date-fns";
import type { InferGetServerSidePropsType } from "next";
-import type { GetServerSidePropsContext } from "nextjs-routes";
+import { type GetServerSidePropsContext, route } from "nextjs-routes";
import { parseAsString, useQueryState } from "nuqs";
import { useEffect } from "react";
import { toast } from "sonner";
@@ -33,6 +33,7 @@ import { supabase } from "@/lib/supabase";
import { createSSRClient } from "@/lib/supabaseSSR";
import type { TablesUpdate } from "@/lib/types";
import { useEvent } from "@/lib/useEvent";
+import { useIsClient } from "@/lib/useIsClient";
import { useZodForm } from "@/lib/useZodForm";
import { cn } from "@/lib/utils";
@@ -96,6 +97,8 @@ export default function Dashboard({
},
});
+ const isClient = useIsClient();
+
return (
-
+ {isClient ? (
+
+ ) : null}