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