mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 23:57:12 +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
|
|
@ -1,9 +0,0 @@
|
|||
import { Column } from '@umami/react-zen';
|
||||
|
||||
export interface BoardProps {
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
export function Board({ children }: BoardProps) {
|
||||
return <Column>{children}</Column>;
|
||||
}
|
||||
6
src/components/hooks/context/useBoard.ts
Normal file
6
src/components/hooks/context/useBoard.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import { useContext } from 'react';
|
||||
import { BoardContext } from '@/app/(main)/boards/BoardProvider';
|
||||
|
||||
export function useBoard() {
|
||||
return useContext(BoardContext);
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
'use client';
|
||||
|
||||
// Context hooks
|
||||
export * from './context/useBoard';
|
||||
export * from './context/useLink';
|
||||
export * from './context/usePixel';
|
||||
export * from './context/useTeam';
|
||||
|
|
@ -9,6 +10,7 @@ export * from './context/useWebsite';
|
|||
|
||||
// Query hooks
|
||||
export * from './queries/useActiveUsersQuery';
|
||||
export * from './queries/useBoardQuery';
|
||||
export * from './queries/useBoardsQuery';
|
||||
export * from './queries/useDateRangeQuery';
|
||||
export * from './queries/useDeleteQuery';
|
||||
|
|
|
|||
17
src/components/hooks/queries/useBoardQuery.ts
Normal file
17
src/components/hooks/queries/useBoardQuery.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { keepPreviousData } from '@tanstack/react-query';
|
||||
import type { ReactQueryOptions } from '@/lib/types';
|
||||
import { useApi } from '../useApi';
|
||||
import { useModified } from '../useModified';
|
||||
|
||||
export function useBoardQuery(boardId: string, options?: ReactQueryOptions) {
|
||||
const { get, useQuery } = useApi();
|
||||
const { modified } = useModified(`board:${boardId}`);
|
||||
|
||||
return useQuery({
|
||||
queryKey: ['boards', { boardId, modified }],
|
||||
queryFn: () => get(`/boards/${boardId}`),
|
||||
enabled: !!boardId && boardId !== 'create',
|
||||
placeholderData: keepPreviousData,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue