Skip to content

Commit 4eade11

Browse files
chore: add apolloClient to one event page
1 parent 367d22d commit 4eade11

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

Diff for: app/(transition)/(root)/events/[id]/page.tsx

+23-1
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
1+
import { gql } from "@apollo/client";
2+
import { getApolloClient } from "@/api/ApolloClient";
13
import { MapPinIcon } from "@heroicons/react/24/outline";
24
import { Attendees } from "@/components/Event/Attendees/Attendees";
35
import { Hero } from "@/components/Event/Hero/Hero";
46
import { Information } from "@/components/Event/Information/Information";
57
import { Location } from "@/components/Event/Location/Location";
68
import { Organizers } from "@/components/Event/Organizers/Organizers";
79
import { Register } from "@/components/Event/Register/Register";
10+
import { FetchExampleEventsQuery } from "@/api/gql/graphql";
811

912
// TODO: Mock data, remove after connect this page with GraphQL service
1013
import { event } from "./fixture";
1114

12-
export default function Event() {
15+
type Props = {
16+
searchParams: { [key: string]: string | string[] | undefined };
17+
};
18+
19+
export default async function Event({ searchParams }: Props) {
20+
const c = getApolloClient();
21+
const { id } = searchParams;
22+
23+
const response = await c.query<FetchExampleEventsQuery>({
24+
query: gql`
25+
{
26+
event(id: "${id}") {
27+
name
28+
}
29+
}
30+
`,
31+
});
32+
33+
console.log({ response });
34+
1335
const {
1436
name,
1537
organizer,

Diff for: src/components/Event/Information/Information.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import Markdown from "react-markdown";
33
import remarkGfm from "remark-gfm";
44
import { InformationTypes } from "./types";
55

6+
const remarkPlugins = [remarkGfm];
7+
68
export const Information: FC<InformationTypes> = ({
79
title,
810
information,
@@ -18,7 +20,7 @@ export const Information: FC<InformationTypes> = ({
1820
</h2>
1921
<Markdown
2022
className="prose prose-sm prose-invert !max-w-full dark:prose lg:prose-base"
21-
remarkPlugins={[remarkGfm]}
23+
remarkPlugins={remarkPlugins}
2224
>
2325
{information}
2426
</Markdown>

Diff for: src/components/ui/sheet.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ const SheetTrigger = SheetPrimitive.Trigger;
1313

1414
const SheetClose = SheetPrimitive.Close;
1515

16-
const SheetPortal = ({
17-
...props
18-
}: SheetPrimitive.DialogPortalProps) => <SheetPrimitive.Portal {...props} />;
16+
const SheetPortal = ({ ...props }: SheetPrimitive.DialogPortalProps) => (
17+
<SheetPrimitive.Portal {...props} />
18+
);
1919
SheetPortal.displayName = SheetPrimitive.Portal.displayName;
2020

2121
const SheetOverlay = React.forwardRef<

0 commit comments

Comments
 (0)