Skip to content

Commit

Permalink
chore: add apolloClient to one event page
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigobustamante committed Dec 19, 2023
1 parent 367d22d commit 4eade11
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
24 changes: 23 additions & 1 deletion app/(transition)/(root)/events/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
import { gql } from "@apollo/client";
import { getApolloClient } from "@/api/ApolloClient";
import { MapPinIcon } from "@heroicons/react/24/outline";
import { Attendees } from "@/components/Event/Attendees/Attendees";
import { Hero } from "@/components/Event/Hero/Hero";
import { Information } from "@/components/Event/Information/Information";
import { Location } from "@/components/Event/Location/Location";
import { Organizers } from "@/components/Event/Organizers/Organizers";
import { Register } from "@/components/Event/Register/Register";
import { FetchExampleEventsQuery } from "@/api/gql/graphql";

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

export default function Event() {
type Props = {
searchParams: { [key: string]: string | string[] | undefined };
};

export default async function Event({ searchParams }: Props) {
const c = getApolloClient();
const { id } = searchParams;

const response = await c.query<FetchExampleEventsQuery>({
query: gql`
{
event(id: "${id}") {
name
}
}
`,
});

console.log({ response });

const {
name,
organizer,
Expand Down
4 changes: 3 additions & 1 deletion src/components/Event/Information/Information.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import Markdown from "react-markdown";
import remarkGfm from "remark-gfm";
import { InformationTypes } from "./types";

const remarkPlugins = [remarkGfm];

export const Information: FC<InformationTypes> = ({
title,
information,
Expand All @@ -18,7 +20,7 @@ export const Information: FC<InformationTypes> = ({
</h2>
<Markdown
className="prose prose-sm prose-invert !max-w-full dark:prose lg:prose-base"
remarkPlugins={[remarkGfm]}
remarkPlugins={remarkPlugins}
>
{information}
</Markdown>
Expand Down
6 changes: 3 additions & 3 deletions src/components/ui/sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const SheetTrigger = SheetPrimitive.Trigger;

const SheetClose = SheetPrimitive.Close;

const SheetPortal = ({
...props
}: SheetPrimitive.DialogPortalProps) => <SheetPrimitive.Portal {...props} />;
const SheetPortal = ({ ...props }: SheetPrimitive.DialogPortalProps) => (
<SheetPrimitive.Portal {...props} />
);
SheetPortal.displayName = SheetPrimitive.Portal.displayName;

const SheetOverlay = React.forwardRef<
Expand Down

0 comments on commit 4eade11

Please sign in to comment.