diff --git a/apps/frontend/src/components/ThemeToggle.tsx b/apps/frontend/src/components/ThemeToggle.tsx index 667aeac..9d510dd 100644 --- a/apps/frontend/src/components/ThemeToggle.tsx +++ b/apps/frontend/src/components/ThemeToggle.tsx @@ -46,7 +46,7 @@ export default function ThemeToggle() { onClick={toggleMode} aria-label={label} title={label} - className="rounded-full bg-[var(--cream-dark)] px-3 py-1.5 text-sm font-semibold text-[var(--stout-black)] shadow-[0_8px_22px_rgba(30,90,72,0.08)] transition hover:-translate-y-0.5" + className="rounded-full bg-(--cream-dark) px-3 py-1.5 text-sm font-semibold text-(--stout-black) shadow-[0_8px_22px_rgba(30,90,72,0.08)] transition hover:-translate-y-0.5" > {mode === 'dark' ? 'Dark' : 'Light'} diff --git a/apps/frontend/src/components/ViewVenue.tsx b/apps/frontend/src/components/ViewVenue.tsx index c310dec..fb67c63 100644 --- a/apps/frontend/src/components/ViewVenue.tsx +++ b/apps/frontend/src/components/ViewVenue.tsx @@ -1,27 +1,46 @@ import type { venue } from '#/types/venue' +import { useQuery } from '@tanstack/react-query' +import { graphqlFetch } from '#/graphql/client' -export default function ViewVenue(Current: venue) { +const GET_VENUE = ` + query GetVenues { + venue { + id + name + address + city { + id + name + } + openingHours { + days + opening + closing + } + } + } +` + +export function ViewVenue(Current: venue) { const fmt = (iso: string) => iso.slice(11, 16) return ( -
-

+

+

{Current.city.name}

{Current.name}

-

- {Current.address} -

+

{Current.address}

Opening hours

) } + +export default function VenueLoader() { + const { data, isPending, isError } = useQuery({ + queryKey: ['venues'], + queryFn: () => graphqlFetch<{ venue: venue[] }>(GET_VENUE), + }) + + if (isPending) return

Loading venue…

+ if (isError) return
error
+ // Hardcoded: show first venue for now + if (data.venue.length == 0) return
No venues found
+ const first = data.venue[0] + return +} diff --git a/apps/frontend/src/routes/__root.tsx b/apps/frontend/src/routes/__root.tsx index dcd8b3b..c12db02 100644 --- a/apps/frontend/src/routes/__root.tsx +++ b/apps/frontend/src/routes/__root.tsx @@ -13,10 +13,6 @@ import TanStackQueryDevtools from '../integrations/tanstack-query/devtools' import appCss from '../styles.css?url' import type { QueryClient } from '@tanstack/react-query' -import { useQuery } from '@tanstack/react-query' -import ViewVenue from '#/components/ViewVenue' -import { graphqlFetch } from '#/graphql/client' -import type { venue } from '#/types/venue' interface MyRouterContext { queryClient: QueryClient @@ -48,39 +44,6 @@ export const Route = createRootRouteWithContext()({ shellComponent: RootDocument, }) -const GET_VENUE = ` - query GetVenues { - venue { - id - name - address - city { - id - name - } - openingHours { - days - opening - closing - } - } - } -` - -function VenueLoader() { - const { data, isPending, isError } = useQuery({ - queryKey: ['venues'], - queryFn: () => graphqlFetch<{ venue: venue[] }>(GET_VENUE), - }) - - if (isPending) return

Loading venue…

- if (isError) return
error
- // Hardcoded: show first venue for now - if (data.venue.length == 0) return
No venues found
- const first = data.venue[0] - return -} - function RootDocument({ children }: { children: React.ReactNode }) { return ( @@ -94,10 +57,10 @@ function RootDocument({ children }: { children: React.ReactNode }) { /> - +
{children} - +