diff --git a/src/components/Settings/SettingsField.tsx b/src/components/Settings/SettingsField.tsx
index c1b0d9d..5245a4a 100644
--- a/src/components/Settings/SettingsField.tsx
+++ b/src/components/Settings/SettingsField.tsx
@@ -1,6 +1,7 @@
import {
SelectUIConfigField,
StringUIConfigField,
+ TextareaUIConfigField,
UIConfigField,
} from '@/lib/config/types';
import { useState } from 'react';
@@ -156,6 +157,82 @@ const SettingsInput = ({
);
};
+const SettingsTextarea = ({
+ field,
+ value,
+ setValue,
+ dataAdd,
+}: {
+ field: TextareaUIConfigField;
+ value?: any;
+ setValue: (value: any) => void;
+ dataAdd: string;
+}) => {
+ const [loading, setLoading] = useState(false);
+
+ const handleSave = async (newValue: any) => {
+ setLoading(true);
+ setValue(newValue);
+ try {
+ if (field.scope === 'client') {
+ localStorage.setItem(field.key, newValue);
+ } else {
+ const res = await fetch('/api/config', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({
+ key: `${dataAdd}.${field.key}`,
+ value: newValue,
+ }),
+ });
+
+ if (!res.ok) {
+ console.error('Failed to save config:', await res.text());
+ throw new Error('Failed to save configuration');
+ }
+ }
+ } catch (error) {
+ console.error('Error saving config:', error);
+ toast.error('Failed to save configuration.');
+ } finally {
+ setTimeout(() => setLoading(false), 150);
+ }
+ };
+
+ return (
+
+ {field.description}
+
+ {field.name}
+
+