mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37: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
18
package.json
18
package.json
|
|
@ -67,14 +67,14 @@
|
||||||
"@dicebear/core": "^9.2.3",
|
"@dicebear/core": "^9.2.3",
|
||||||
"@fontsource/inter": "^5.2.8",
|
"@fontsource/inter": "^5.2.8",
|
||||||
"@hello-pangea/dnd": "^17.0.0",
|
"@hello-pangea/dnd": "^17.0.0",
|
||||||
"@prisma/adapter-pg": "^6.18.0",
|
"@prisma/adapter-pg": "^7.1.0",
|
||||||
"@prisma/client": "^6.18.0",
|
"@prisma/client": "^7.1.0",
|
||||||
"@prisma/extension-read-replicas": "^0.4.1",
|
"@prisma/extension-read-replicas": "^0.5.0",
|
||||||
"@react-spring/web": "^10.0.3",
|
"@react-spring/web": "^10.0.3",
|
||||||
"@svgr/cli": "^8.1.0",
|
"@svgr/cli": "^8.1.0",
|
||||||
"@tanstack/react-query": "^5.90.11",
|
"@tanstack/react-query": "^5.90.12",
|
||||||
"@umami/react-zen": "^0.211.0",
|
"@umami/react-zen": "^0.216.0",
|
||||||
"@umami/redis-client": "^0.29.0",
|
"@umami/redis-client": "^0.30.0",
|
||||||
"bcryptjs": "^3.0.2",
|
"bcryptjs": "^3.0.2",
|
||||||
"chalk": "^5.6.2",
|
"chalk": "^5.6.2",
|
||||||
"chart.js": "^4.5.1",
|
"chart.js": "^4.5.1",
|
||||||
|
|
@ -97,7 +97,7 @@
|
||||||
"is-docker": "^3.0.0",
|
"is-docker": "^3.0.0",
|
||||||
"is-localhost-ip": "^2.0.0",
|
"is-localhost-ip": "^2.0.0",
|
||||||
"isbot": "^5.1.31",
|
"isbot": "^5.1.31",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.3",
|
||||||
"jszip": "^3.10.1",
|
"jszip": "^3.10.1",
|
||||||
"kafkajs": "^2.1.0",
|
"kafkajs": "^2.1.0",
|
||||||
"lucide-react": "^0.543.0",
|
"lucide-react": "^0.543.0",
|
||||||
|
|
@ -107,7 +107,7 @@
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"papaparse": "^5.5.3",
|
"papaparse": "^5.5.3",
|
||||||
"pg": "^8.16.3",
|
"pg": "^8.16.3",
|
||||||
"prisma": "^6.18.0",
|
"prisma": "^7.1.0",
|
||||||
"pure-rand": "^7.0.1",
|
"pure-rand": "^7.0.1",
|
||||||
"react": "^19.2.1",
|
"react": "^19.2.1",
|
||||||
"react-dom": "^19.2.1",
|
"react-dom": "^19.2.1",
|
||||||
|
|
@ -121,7 +121,7 @@
|
||||||
"serialize-error": "^12.0.0",
|
"serialize-error": "^12.0.0",
|
||||||
"thenby": "^1.3.4",
|
"thenby": "^1.3.4",
|
||||||
"ua-parser-js": "^2.0.6",
|
"ua-parser-js": "^2.0.6",
|
||||||
"uuid": "^11.1.0",
|
"uuid": "^13.0.0",
|
||||||
"zod": "^4.1.13",
|
"zod": "^4.1.13",
|
||||||
"zustand": "^5.0.9"
|
"zustand": "^5.0.9"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
522
pnpm-lock.yaml
generated
522
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
|
@ -6,7 +6,6 @@ generator client {
|
||||||
|
|
||||||
datasource db {
|
datasource db {
|
||||||
provider = "postgresql"
|
provider = "postgresql"
|
||||||
url = env("DATABASE_URL")
|
|
||||||
relationMode = "prisma"
|
relationMode = "prisma"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
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>;
|
||||||
|
}
|
||||||
3
src/app/(main)/boards/[boardId]/BoardBody.tsx
Normal file
3
src/app/(main)/boards/[boardId]/BoardBody.tsx
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
export function BoardBody() {
|
||||||
|
return <h1>i am bored.</h1>;
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import { Button, Column, Grid, InlineEditField, Row } from '@umami/react-zen';
|
import { Button, Column, Grid, Heading, Row, TextField } from '@umami/react-zen';
|
||||||
import { useMessages } from '@/components/hooks';
|
import { useMessages } from '@/components/hooks';
|
||||||
|
|
||||||
export function BoardHeader() {
|
export function BoardHeader() {
|
||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
const defaultName = formatMessage(labels.untitled);
|
const defaultName = formatMessage(labels.untitled);
|
||||||
const name = 'My Board';
|
const name = '';
|
||||||
const description = 'This is my board';
|
const description = '';
|
||||||
|
|
||||||
const handleNameChange = (name: string) => {
|
const handleNameChange = (name: string) => {
|
||||||
//updateReport({ name: name || defaultName });
|
//updateReport({ name: name || defaultName });
|
||||||
|
|
@ -15,29 +15,50 @@ export function BoardHeader() {
|
||||||
//updateReport({ description });
|
//updateReport({ description });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return <h1>asdgfviybiyu8oaero8g9873qrgb875qh0g8</h1>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid columns="1fr 1fr">
|
<Grid
|
||||||
|
columns={{ xs: '1fr', md: '1fr 1fr' }}
|
||||||
|
paddingY="4"
|
||||||
|
marginBottom="6"
|
||||||
|
border="bottom"
|
||||||
|
gapX="6"
|
||||||
|
>
|
||||||
|
asdfasdfds
|
||||||
<Column>
|
<Column>
|
||||||
<Row>
|
<Row>
|
||||||
<InlineEditField
|
<TextField
|
||||||
|
variant="quiet"
|
||||||
name="name"
|
name="name"
|
||||||
value={name}
|
value={name}
|
||||||
|
defaultValue={name}
|
||||||
placeholder={defaultName}
|
placeholder={defaultName}
|
||||||
onCommit={handleNameChange}
|
onChange={handleNameChange}
|
||||||
/>
|
autoComplete="off"
|
||||||
|
style={{ fontSize: '2rem', fontWeight: 700, width: '100%' }}
|
||||||
|
>
|
||||||
|
<Heading size="4">{name}</Heading>
|
||||||
|
</TextField>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<InlineEditField
|
<TextField
|
||||||
|
variant="quiet"
|
||||||
name="description"
|
name="description"
|
||||||
value={description}
|
value={description}
|
||||||
|
defaultValue={description}
|
||||||
placeholder={`+ ${formatMessage(labels.addDescription)}`}
|
placeholder={`+ ${formatMessage(labels.addDescription)}`}
|
||||||
onCommit={handleDescriptionChange}
|
autoComplete="off"
|
||||||
/>
|
onChange={handleDescriptionChange}
|
||||||
|
style={{ width: '100%' }}
|
||||||
|
>
|
||||||
|
{description}
|
||||||
|
</TextField>
|
||||||
</Row>
|
</Row>
|
||||||
</Column>
|
</Column>
|
||||||
<Row justifyContent="flex-end">
|
<Column justifyContent="center" alignItems="flex-end">
|
||||||
<Button variant="primary">{formatMessage(labels.save)}</Button>
|
<Button variant="primary">{formatMessage(labels.save)}</Button>
|
||||||
</Row>
|
</Column>
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
'use client';
|
'use client';
|
||||||
import { Column } from '@umami/react-zen';
|
import { Column } from '@umami/react-zen';
|
||||||
import { BoardHeader } from '@/app/(main)/boards/[boardId]/BoardHeader';
|
import { BoardHeader } from '@/app/(main)/boards/[boardId]/BoardHeader';
|
||||||
|
import { BoardProvider } from '@/app/(main)/boards/BoardProvider';
|
||||||
import { PageBody } from '@/components/common/PageBody';
|
import { PageBody } from '@/components/common/PageBody';
|
||||||
import { useMessages } from '@/components/hooks';
|
|
||||||
|
|
||||||
export function BoardPage() {
|
|
||||||
const { formatMessage, labels } = useMessages();
|
|
||||||
|
|
||||||
|
export function BoardPage({ boardId }: { boardId: string }) {
|
||||||
return (
|
return (
|
||||||
<PageBody>
|
<BoardProvider boardId={boardId}>
|
||||||
<Column margin="2">
|
<PageBody>
|
||||||
<BoardHeader />
|
<Column>
|
||||||
</Column>
|
<BoardHeader />
|
||||||
</PageBody>
|
</Column>
|
||||||
|
</PageBody>
|
||||||
|
</BoardProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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';
|
'use client';
|
||||||
|
|
||||||
// Context hooks
|
// Context hooks
|
||||||
|
export * from './context/useBoard';
|
||||||
export * from './context/useLink';
|
export * from './context/useLink';
|
||||||
export * from './context/usePixel';
|
export * from './context/usePixel';
|
||||||
export * from './context/useTeam';
|
export * from './context/useTeam';
|
||||||
|
|
@ -9,6 +10,7 @@ export * from './context/useWebsite';
|
||||||
|
|
||||||
// Query hooks
|
// Query hooks
|
||||||
export * from './queries/useActiveUsersQuery';
|
export * from './queries/useActiveUsersQuery';
|
||||||
|
export * from './queries/useBoardQuery';
|
||||||
export * from './queries/useBoardsQuery';
|
export * from './queries/useBoardsQuery';
|
||||||
export * from './queries/useDateRangeQuery';
|
export * from './queries/useDateRangeQuery';
|
||||||
export * from './queries/useDeleteQuery';
|
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