feat(boards): add layout mode selection to new board modal
This commit is contained in:
2 files changed
+42
-9
No files matched your search
@@ -1,4 +1,15 @@
|
|||||||
import { Button, Group, InputWrapper, Slider, Stack, Switch, TextInput } from "@mantine/core";
|
import {
|
||||||
|
Button,
|
||||||
|
Fieldset,
|
||||||
|
Group,
|
||||||
|
InputWrapper,
|
||||||
|
RadioGroup,
|
||||||
|
SimpleGrid,
|
||||||
|
Slider,
|
||||||
|
Stack,
|
||||||
|
Switch,
|
||||||
|
TextInput,
|
||||||
|
} from "@mantine/core";
|
||||||
import { useDebouncedValue } from "@mantine/hooks";
|
import { useDebouncedValue } from "@mantine/hooks";
|
||||||
import { IconAlertTriangle, IconCircleCheck } from "@tabler/icons-react";
|
import { IconAlertTriangle, IconCircleCheck } from "@tabler/icons-react";
|
||||||
|
|
||||||
@@ -8,6 +19,7 @@ import { useZodForm } from "@homarr/form";
|
|||||||
import { createModal } from "@homarr/modals";
|
import { createModal } from "@homarr/modals";
|
||||||
import { showErrorNotification, showSuccessNotification } from "@homarr/notifications";
|
import { showErrorNotification, showSuccessNotification } from "@homarr/notifications";
|
||||||
import { useI18n } from "@homarr/translation/client";
|
import { useI18n } from "@homarr/translation/client";
|
||||||
|
import { CustomRadioCard } from "@homarr/ui";
|
||||||
import { boardColumnCountSchema, boardCreateSchema, boardNameSchema } from "@homarr/validation/board";
|
import { boardColumnCountSchema, boardCreateSchema, boardNameSchema } from "@homarr/validation/board";
|
||||||
|
|
||||||
export const AddBoardModal = createModal(({ actions }) => {
|
export const AddBoardModal = createModal(({ actions }) => {
|
||||||
@@ -64,14 +76,33 @@ export const AddBoardModal = createModal(({ actions }) => {
|
|||||||
) : null
|
) : null
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<InputWrapper label={t("board.field.columnCount.label")} {...form.getInputProps("columnCount")}>
|
|
||||||
<Slider
|
<Fieldset legend="Layout">
|
||||||
min={boardColumnCountSchema.minValue ?? undefined}
|
<Stack gap="sm">
|
||||||
max={boardColumnCountSchema.maxValue ?? undefined}
|
<RadioGroup>
|
||||||
step={1}
|
<SimpleGrid cols={{ sm: 2, xs: 1 }} spacing="md">
|
||||||
{...form.getInputProps("columnCount")}
|
<CustomRadioCard
|
||||||
/>
|
name="Auto"
|
||||||
</InputWrapper>
|
description="Position and size of all layouts are calculated from the base layout."
|
||||||
|
checked
|
||||||
|
/>
|
||||||
|
<CustomRadioCard
|
||||||
|
name="Custom"
|
||||||
|
description="Position and size must be configured for all layouts separately."
|
||||||
|
/>
|
||||||
|
</SimpleGrid>
|
||||||
|
</RadioGroup>
|
||||||
|
|
||||||
|
<InputWrapper label={t("board.field.columnCount.label")} {...form.getInputProps("columnCount")}>
|
||||||
|
<Slider
|
||||||
|
min={boardColumnCountSchema.minValue ?? undefined}
|
||||||
|
max={boardColumnCountSchema.maxValue ?? undefined}
|
||||||
|
step={1}
|
||||||
|
{...form.getInputProps("columnCount")}
|
||||||
|
/>
|
||||||
|
</InputWrapper>
|
||||||
|
</Stack>
|
||||||
|
</Fieldset>
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
label={t("board.field.isPublic.label")}
|
label={t("board.field.isPublic.label")}
|
||||||
@@ -92,6 +123,7 @@ export const AddBoardModal = createModal(({ actions }) => {
|
|||||||
);
|
);
|
||||||
}).withOptions({
|
}).withOptions({
|
||||||
defaultTitle: (t) => t("management.page.board.action.new.label"),
|
defaultTitle: (t) => t("management.page.board.action.new.label"),
|
||||||
|
size: "lg",
|
||||||
});
|
});
|
||||||
|
|
||||||
export const useBoardNameStatus = (name: string) => {
|
export const useBoardNameStatus = (name: string) => {
|
||||||
|
|||||||
@@ -16,3 +16,4 @@ export { MaskedImage } from "./masked-image";
|
|||||||
export { MaskedOrNormalImage } from "./masked-or-normal-image";
|
export { MaskedOrNormalImage } from "./masked-or-normal-image";
|
||||||
export { LanguageIcon } from "./language-icon";
|
export { LanguageIcon } from "./language-icon";
|
||||||
export { Link } from "./link";
|
export { Link } from "./link";
|
||||||
|
export * from "./radio";
|
||||||
Reference in new issue
Block a user