From 5f026bd2f313b60f557f468d16ba80f0e2433d0f Mon Sep 17 00:00:00 2001 From: diced Date: Sat, 11 Jan 2025 13:22:42 -0800 Subject: [PATCH] feat: loginBackgroundBlur option --- .../migration.sql | 2 + prisma/schema.prisma | 1 + .../parts/ServerSettingsWebsite.tsx | 157 +++++++++++------- src/lib/config/read.ts | 1 + src/lib/config/validate.ts | 1 + src/pages/_app.tsx | 2 +- src/pages/auth/login.tsx | 2 +- src/server/routes/api/server/settings.ts | 1 + 8 files changed, 102 insertions(+), 65 deletions(-) create mode 100644 prisma/migrations/20250110223901_website_login_bg_blur/migration.sql diff --git a/prisma/migrations/20250110223901_website_login_bg_blur/migration.sql b/prisma/migrations/20250110223901_website_login_bg_blur/migration.sql new file mode 100644 index 00000000..7e5e9120 --- /dev/null +++ b/prisma/migrations/20250110223901_website_login_bg_blur/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "Zipline" ADD COLUMN "websiteLoginBackgroundBlur" BOOLEAN NOT NULL DEFAULT true; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index d0285722..c88355a3 100755 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -63,6 +63,7 @@ model Zipline { websiteTitleLogo String? websiteExternalLinks Json @default("[{ \"name\": \"GitHub\", \"url\": \"https://github.com/diced/zipline\"}, { \"name\": \"Documentation\", \"url\": \"https://zipline.diced.sh/\"}]") websiteLoginBackground String? + websiteLoginBackgroundBlur Boolean @default(true) websiteDefaultAvatar String? websiteTos String? diff --git a/src/components/pages/serverSettings/parts/ServerSettingsWebsite.tsx b/src/components/pages/serverSettings/parts/ServerSettingsWebsite.tsx index ffb7ba98..d8867870 100644 --- a/src/components/pages/serverSettings/parts/ServerSettingsWebsite.tsx +++ b/src/components/pages/serverSettings/parts/ServerSettingsWebsite.tsx @@ -1,5 +1,5 @@ import { Response } from '@/lib/api/response'; -import { Button, JsonInput, Paper, SimpleGrid, TextInput, Title } from '@mantine/core'; +import { Button, Grid, JsonInput, Paper, Switch, TextInput, Title } from '@mantine/core'; import { useForm } from '@mantine/form'; import { IconDeviceFloppy } from '@tabler/icons-react'; import { useRouter } from 'next/router'; @@ -29,6 +29,7 @@ export default function ServerSettingsWebsite({ websiteTitleLogo: '', websiteExternalLinks: JSON.stringify(defaultExternalLinks), websiteLoginBackground: '', + websiteLoginBackgroundBlur: true, websiteDefaultAvatar: '', websiteTos: '', @@ -66,6 +67,8 @@ export default function ServerSettingsWebsite({ sendValues.websiteThemeLight = values.websiteThemeLight.trim(); sendValues.websiteTitle = values.websiteTitle.trim(); + sendValues.websiteLoginBackgroundBlur = values.websiteLoginBackgroundBlur; + return settingsOnSubmit(router, form)(sendValues); }; @@ -77,6 +80,7 @@ export default function ServerSettingsWebsite({ websiteTitleLogo: data?.websiteTitleLogo ?? '', websiteExternalLinks: JSON.stringify(data?.websiteExternalLinks ?? defaultExternalLinks, null, 2), websiteLoginBackground: data?.websiteLoginBackground ?? '', + websiteLoginBackgroundBlur: data?.websiteLoginBackgroundBlur ?? true, websiteDefaultAvatar: data?.websiteDefaultAvatar ?? '', websiteTos: data?.websiteTos ?? '', websiteThemeDefault: data?.websiteThemeDefault ?? 'system', @@ -90,76 +94,103 @@ export default function ServerSettingsWebsite({ Website
- - + {/* */} + + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - - + + + + + + + +