mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 00:27:11 +01:00
Progress check-in.
Some checks failed
Node.js CI / build (postgresql, 18.18, 10) (push) Has been cancelled
Some checks failed
Node.js CI / build (postgresql, 18.18, 10) (push) Has been cancelled
This commit is contained in:
parent
5ce1b40330
commit
d227bc369f
11 changed files with 519 additions and 143 deletions
21
src/app/(main)/boards/BoardProvider.tsx
Normal file
21
src/app/(main)/boards/BoardProvider.tsx
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
'use client';
|
||||
import { Loading } from '@umami/react-zen';
|
||||
import { createContext, type ReactNode } from 'react';
|
||||
import { useBoardQuery } from '@/components/hooks/queries/useBoardQuery';
|
||||
import type { Board } from '@/generated/prisma/client';
|
||||
|
||||
export const BoardContext = createContext<Board>(null);
|
||||
|
||||
export function BoardProvider({ boardId, children }: { boardId: string; children: ReactNode }) {
|
||||
const { data: board, isFetching, isLoading } = useBoardQuery(boardId);
|
||||
|
||||
if (isFetching && isLoading) {
|
||||
return <Loading placement="absolute" />;
|
||||
}
|
||||
|
||||
if (!board) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <BoardContext.Provider value={board}>{children}</BoardContext.Provider>;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue