diff --git a/src/app/(main)/boards/[boardId]/BoardEditForm.tsx b/src/app/(main)/boards/[boardId]/BoardEditForm.tsx new file mode 100644 index 000000000..dc297239e --- /dev/null +++ b/src/app/(main)/boards/[boardId]/BoardEditForm.tsx @@ -0,0 +1,67 @@ +import { Form, FormField, TextField } from '@umami/react-zen'; +import { Panel } from '@/components/common/Panel'; +import { useBoard, useMessages, useNavigation } from '@/components/hooks'; +import { WebsiteSelect } from '@/components/input/WebsiteSelect'; + +export function BoardEditForm() { + const { board, updateBoard, saveBoard } = useBoard(); + const { t, labels } = useMessages(); + const { teamId } = useNavigation(); + + const handleNameChange = (name: string) => { + updateBoard({ name }); + }; + + const handleDescriptionChange = (description: string) => { + updateBoard({ description }); + }; + + const handleWebsiteChange = (websiteId: string) => { + updateBoard({ + parameters: { + ...board.parameters, + websiteId, + }, + }); + }; + + return ( + +
+ + + + + + + + + +
+
+ ); +} diff --git a/src/app/(main)/boards/[boardId]/BoardEditHeader.tsx b/src/app/(main)/boards/[boardId]/BoardEditHeader.tsx index 48edb269d..9b0e7d7d7 100644 --- a/src/app/(main)/boards/[boardId]/BoardEditHeader.tsx +++ b/src/app/(main)/boards/[boardId]/BoardEditHeader.tsx @@ -1,33 +1,13 @@ -import { - Button, - Column, - Grid, - Heading, - LoadingButton, - Row, - Text, - TextField, -} from '@umami/react-zen'; +import { Button, LoadingButton, Row } from '@umami/react-zen'; +import { PageHeader } from '@/components/common/PageHeader'; import { useBoard, useMessages, useNavigation } from '@/components/hooks'; -import { WebsiteSelect } from '@/components/input/WebsiteSelect'; export function BoardEditHeader() { - const { board, updateBoard, saveBoard, isPending } = useBoard(); + const { board, saveBoard, isPending } = useBoard(); const { t, labels } = useMessages(); - const { router, renderUrl, teamId } = useNavigation(); + const { router, renderUrl } = useNavigation(); const defaultName = t(labels.untitled); - - const handleNameChange = (value: string) => { - updateBoard({ name: value }); - }; - - const handleDescriptionChange = (value: string) => { - updateBoard({ description: value }); - }; - - const handleWebsiteChange = (websiteId: string) => { - updateBoard({ parameters: { ...board.parameters, websiteId } }); - }; + const title = board?.id ? board?.name || defaultName : t(labels.addBoard); const handleSave = async () => { await saveBoard(); @@ -45,59 +25,15 @@ export function BoardEditHeader() { }; return ( - - - - - {board?.name} - - - - - {board?.description} - - - - {t(labels.website)} - - - - - - - - {t(labels.save)} - - - - + + + + + {t(labels.save)} + + + ); } diff --git a/src/app/(main)/boards/[boardId]/BoardEditPage.tsx b/src/app/(main)/boards/[boardId]/BoardEditPage.tsx index 3edd492f4..af736bd0b 100644 --- a/src/app/(main)/boards/[boardId]/BoardEditPage.tsx +++ b/src/app/(main)/boards/[boardId]/BoardEditPage.tsx @@ -4,6 +4,7 @@ import { BoardProvider } from '@/app/(main)/boards/BoardProvider'; import { PageBody } from '@/components/common/PageBody'; import { BoardControls } from './BoardControls'; import { BoardEditBody } from './BoardEditBody'; +import { BoardEditForm } from './BoardEditForm'; import { BoardEditHeader } from './BoardEditHeader'; export function BoardEditPage({ boardId }: { boardId?: string }) { @@ -12,6 +13,7 @@ export function BoardEditPage({ boardId }: { boardId?: string }) { +