Fixed theme and settings
This commit is contained in:
+4
-2
@@ -1,8 +1,9 @@
|
|||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import { Geist, Geist_Mono } from "next/font/google";
|
import { Geist, Geist_Mono } from "next/font/google";
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
import { getClientSettings } from "@/lib/clientSettings";
|
import { parseClientSettings } from "@/lib/clientSettings";
|
||||||
import { Toaster } from "@/components/ui/sonner";
|
import { Toaster } from "@/components/ui/sonner";
|
||||||
|
import { cookies } from "next/headers";
|
||||||
|
|
||||||
const geistSans = Geist({
|
const geistSans = Geist({
|
||||||
variable: "--font-geist-sans",
|
variable: "--font-geist-sans",
|
||||||
@@ -33,7 +34,8 @@ export default async function RootLayout({
|
|||||||
}: Readonly<{
|
}: Readonly<{
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}>) {
|
}>) {
|
||||||
const settings = getClientSettings();
|
const c = await cookies();
|
||||||
|
const settings = parseClientSettings(c.get("settings")?.value);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ export default function SettingSchema<T>({
|
|||||||
if (!regexSetting.pattern.test(value)) {
|
if (!regexSetting.pattern.test(value)) {
|
||||||
setFeedback({
|
setFeedback({
|
||||||
kind: "error",
|
kind: "error",
|
||||||
message: `Value does not match the pattern!`,
|
message: `Value does not match the pattern`,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setFeedback(undefined);
|
setFeedback(undefined);
|
||||||
@@ -124,7 +124,7 @@ export default function SettingSchema<T>({
|
|||||||
<>
|
<>
|
||||||
{Object.entries(schema).map(([key, type]) => (
|
{Object.entries(schema).map(([key, type]) => (
|
||||||
<div key={key} className="flex items-center justify-between space-x-4">
|
<div key={key} className="flex items-center justify-between space-x-4">
|
||||||
<label className="capitalize">{key}</label>
|
<label className="capitalize">{key.replaceAll("_", "_")}</label>
|
||||||
{renderInput(key, type)}
|
{renderInput(key, type)}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export default function SettingsDialog({
|
|||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<Settings tab={tab} profileSettings={profile} />
|
{profile && <Settings tab={tab} profileSettings={profile} />}
|
||||||
</div>
|
</div>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export const PROFILE_SCHEMA: SettingsSchema = {
|
|||||||
display_name: "string",
|
display_name: "string",
|
||||||
avatar_url: "string",
|
avatar_url: "string",
|
||||||
node_address: new RegexSetting(
|
node_address: new RegexSetting(
|
||||||
"node2.axiom.org",
|
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
|
||||||
/^(?:(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}|(?:\d{1,3}\.){3}\d{1,3})$/
|
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user