diff --git a/package.json b/package.json index 3d81e0c49..d0b5945a9 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "test:coverage": "SKIP_ENV_VALIDATION=1 vitest run --coverage", "docker:build": "turbo build && docker build . -t homarr:local-dev", "docker:start": "docker run -p 7575:7575 --name homarr-development homarr:local-dev", - "db:migrate": "dotenv ts-node drizzle/migrate/migrate.ts ./drizzle" + "db:migrate": "dotenv ts-node drizzle/migrate/migrate.ts ./drizzle", + "db:create": "dotenv drizzle-kit push:sqlite" }, "dependencies": { "@auth/drizzle-adapter": "^0.3.2", @@ -234,4 +235,4 @@ ] } } -} \ No newline at end of file +} diff --git a/src/components/Board/BoardCreateModal.tsx b/src/components/Board/BoardCreateModal.tsx index e3a4505d8..d98c1182e 100644 --- a/src/components/Board/BoardCreateModal.tsx +++ b/src/components/Board/BoardCreateModal.tsx @@ -1,7 +1,7 @@ import { ActionIcon, Button, Group, Loader, Stack, Switch, TextInput } from '@mantine/core'; import { useForm, zodResolver } from '@mantine/form'; import { useDebouncedValue } from '@mantine/hooks'; -import { ContextModalProps } from '@mantine/modals'; +import { ContextModalProps, closeModal } from '@mantine/modals'; import { IconAlertTriangle, IconCheck, IconPencil, IconPencilOff } from '@tabler/icons-react'; import { useRouter } from 'next/router'; import { useState } from 'react'; @@ -9,7 +9,7 @@ import { z } from 'zod'; import { api } from '~/utils/api'; import { createBoardSchema } from '~/validations/boards'; -export const CreateBoardModal = ({ id, context }: ContextModalProps>) => { +export const CreateBoardModal = ({ id }: { id: string }) => { const [autoBoardName, setAutoBoardName] = useState(true); const router = useRouter(); const form = useForm({ @@ -34,7 +34,7 @@ export const CreateBoardModal = ({ id, context }: ContextModalProps { await router.push(`/board/${values.boardName}`); - context.closeModal(id); + closeModal(id); utils.boards.checkNameAvailable.invalidate({ boardName: values.boardName }); }, }); @@ -43,55 +43,60 @@ export const CreateBoardModal = ({ id, context }: ContextModalProps - { - form.getInputProps('pageTitle').onChange(e); - if (!autoBoardName) return; - form.setFieldValue( - 'boardName', - e.currentTarget.value - .replace(/([A-z0-9])[^A-z0-9]+([A-z0-9])/g, '$1-$2') - .replace(/([A-z0-9])[^A-z0-9\-]+([A-z0-9])/g, '$1-$2') - .replace(/[^A-z\-0-9]+/g, '') - .replace(/-+/g, '-') - .toLowerCase() - ); - }} - /> - setAutoBoardName((c) => !c)}> - {autoBoardName ? ( - - ) : ( - - )} - - } - icon={ - debouncedRouteName !== form.values.boardName || isFetching ? ( - - ) : boardNameAvailable === true ? ( - - ) : boardNameAvailable === false ? ( - - ) : null - } - /> + + { + form.getInputProps('pageTitle').onChange(e); + if (!autoBoardName) return; + form.setFieldValue( + 'boardName', + e.currentTarget.value + .replace(/([A-z0-9])[^A-z0-9]+([A-z0-9])/g, '$1-$2') + .replace(/([A-z0-9])[^A-z0-9\-]+([A-z0-9])/g, '$1-$2') + .replace(/[^A-z\-0-9]+/g, '') + .replace(/-+/g, '-') + .toLowerCase() + ); + }} + /> + setAutoBoardName((c) => !c)}> + {autoBoardName ? ( + + ) : ( + + )} + + } + icon={ + debouncedRouteName !== form.values.boardName || isFetching ? ( + + ) : boardNameAvailable === true ? ( + + ) : boardNameAvailable === false ? ( + + ) : null + } + /> + - )} + + +