feat(global): Add custom data

This commit is contained in:
web@ppanel 2025-03-15 15:39:55 +07:00
parent bb3bd7b50c
commit 6dbebd152d
35 changed files with 138 additions and 5 deletions

View File

@ -5,6 +5,7 @@ import { useQuery } from '@tanstack/react-query';
import { Label } from '@workspace/ui/components/label';
import { Table, TableBody, TableCell, TableRow } from '@workspace/ui/components/table';
import { Textarea } from '@workspace/ui/components/textarea';
import { JSONEditor } from '@workspace/ui/custom-components/editor';
import { EnhancedInput } from '@workspace/ui/custom-components/enhanced-input';
import { UploadImage } from '@workspace/ui/custom-components/upload-image';
import { useTranslations } from 'next-intl';
@ -130,6 +131,49 @@ export default function Site() {
/>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Label>{t('customData')}</Label>
<p className='text-muted-foreground text-xs'>{t('customDataDescription')}</p>
</TableCell>
<TableCell className='w-1/2 text-right'>
<JSONEditor
schema={{
type: 'object',
additionalProperties: true,
properties: {
website: { type: 'string', title: 'Website' },
contacts: {
type: 'object',
title: 'Contacts',
additionalProperties: true,
properties: {
email: { type: 'string', title: 'Email' },
telephone: { type: 'string', title: 'Telephone' },
address: { type: 'string', title: 'Address' },
},
},
community: {
type: 'object',
title: 'Community',
additionalProperties: true,
properties: {
telegram: { type: 'string', title: 'Telegram' },
twitter: { type: 'string', title: 'Twitter' },
discord: { type: 'string', title: 'Discord' },
instagram: { type: 'string', title: 'Instagram' },
linkedin: { type: 'string', title: 'Linkedin' },
facebook: { type: 'string', title: 'Facebook' },
github: { type: 'string', title: 'Github' },
},
},
},
}}
value={data?.custom_data}
onBlur={(value) => updateConfig('custom_data', value)}
/>
</TableCell>
</TableRow>
</TableBody>
</Table>
);

View File

@ -58,8 +58,21 @@ export default function Page() {
<Switch
defaultChecked={row.getValue('enable')}
onCheckedChange={async (checked) => {
const {
auth_methods,
user_devices,
enable_balance_notify,
enable_login_notify,
enable_subscribe_notify,
enable_trade_notify,
updated_at,
created_at,
id,
...rest
} = row.original;
await updateUserBasicInfo({
...row.original,
user_id: id,
...rest,
enable: checked,
} as unknown as API.UpdateUserBasiceInfoRequest);
toast.success(t('updateSuccess'));

View File

@ -16,6 +16,7 @@ export const useGlobalStore = create<GlobalStore>((set) => ({
site_logo: '',
keywords: '',
custom_html: '',
custom_data: '',
},
verify: {
turnstile_site_key: '',

View File

@ -13,6 +13,8 @@
"title": "Zásady ochrany osobních údajů"
},
"site": {
"customData": "Vlastní data",
"customDataDescription": "Vlastní data, používaná pro vlastní data webu",
"customHtml": "Vlastní HTML",
"customHtmlDescription": "Vlastní HTML kód, který bude vložen na konec tagu body na stránce.",
"keywords": "Klíčová slova",

View File

@ -13,6 +13,8 @@
"title": "Datenschutzrichtlinie"
},
"site": {
"customData": "Benutzerdefinierte Daten",
"customDataDescription": "Benutzerdefinierte Daten, die für benutzerdefinierte Daten der Website verwendet werden",
"customHtml": "Benutzerdefiniertes HTML",
"customHtmlDescription": "Benutzerdefinierter HTML-Code, der am Ende des body-Tags der Seite eingefügt werden soll.",
"keywords": "Schlüsselwörter",

View File

@ -13,6 +13,8 @@
"title": "Privacy Policy"
},
"site": {
"customData": "Custom Data",
"customDataDescription": "Custom Data, used for custom data of the site",
"customHtml": "Custom HTML",
"customHtmlDescription": "Custom HTML code to be injected into the bottom of the site's body tag.",
"keywords": "Keywords",

View File

@ -13,6 +13,8 @@
"title": "Política de Privacidad"
},
"site": {
"customData": "Datos Personalizados",
"customDataDescription": "Datos Personalizados, utilizados para datos personalizados del sitio",
"customHtml": "HTML personalizado",
"customHtmlDescription": "Código HTML personalizado que se inyectará en la parte inferior de la etiqueta body del sitio.",
"keywords": "Palabras clave",

View File

@ -13,6 +13,8 @@
"title": "Política de Privacidad"
},
"site": {
"customData": "Datos Personalizados",
"customDataDescription": "Datos Personalizados, utilizados para datos personalizados del sitio",
"customHtml": "HTML personalizado",
"customHtmlDescription": "Código HTML personalizado que se inyectará al final de la etiqueta body del sitio.",
"keywords": "Palabras clave",

View File

@ -13,6 +13,8 @@
"title": "سیاست حفظ حریم خصوصی"
},
"site": {
"customData": "داده‌های سفارشی",
"customDataDescription": "داده‌های سفارشی، استفاده شده برای داده‌های سفارشی سایت",
"customHtml": "HTML سفارشی",
"customHtmlDescription": "کد HTML سفارشی که باید در انتهای تگ body سایت وارد شود.",
"keywords": "کلمات کلیدی",

View File

@ -13,6 +13,8 @@
"title": "Tietosuojakäytäntö"
},
"site": {
"customData": "Mukautettu tieto",
"customDataDescription": "Mukautettu tieto, jota käytetään sivuston mukautettuun tietoon",
"customHtml": "Mukautettu HTML",
"customHtmlDescription": "Mukautettu HTML-koodi, joka lisätään sivuston body -tagin loppuun.",
"keywords": "Avainsanat",

View File

@ -13,6 +13,8 @@
"title": "Politique de confidentialité"
},
"site": {
"customData": "Données personnalisées",
"customDataDescription": "Données personnalisées, utilisées pour les données personnalisées du site",
"customHtml": "HTML personnalisé",
"customHtmlDescription": "Code HTML personnalisé à injecter dans le bas de la balise body du site.",
"keywords": "Mots-clés",

View File

@ -13,6 +13,8 @@
"title": "गोपनीयता नीति"
},
"site": {
"customData": "कस्टम डेटा",
"customDataDescription": "कस्टम डेटा, साइट के कस्टम डेटा के लिए उपयोग किया जाता है",
"customHtml": "कस्टम HTML",
"customHtmlDescription": "साइट के bodyैग के नीचे इंजेक्ट करने के लिए कस्टम HTML कोड।",
"keywords": "कीवर्ड",

View File

@ -13,6 +13,8 @@
"title": "Adatvédelmi irányelvek"
},
"site": {
"customData": "Egyedi adatok",
"customDataDescription": "Egyedi adatok, a webhely egyedi adatainak használatára",
"customHtml": "Egyedi HTML",
"customHtmlDescription": "Egyedi HTML kód, amelyet a webhely bodyímkéjének aljára kell beilleszteni.",
"keywords": "Kulcsszavak",

View File

@ -13,6 +13,8 @@
"title": "プライバシーポリシー"
},
"site": {
"customData": "カスタムデータ",
"customDataDescription": "サイトのカスタムデータに使用されるカスタムデータ",
"customHtml": "カスタムHTML",
"customHtmlDescription": "サイトの body タグの下部に挿入されるカスタム HTML コード。",
"keywords": "キーワード",

View File

@ -13,6 +13,8 @@
"title": "개인정보 처리방침"
},
"site": {
"customData": "사용자 정의 데이터",
"customDataDescription": "사이트의 사용자 정의 데이터에 사용되는 사용자 정의 데이터",
"customHtml": "사용자 정의 HTML",
"customHtmlDescription": "사이트의 body그 하단에 삽입될 사용자 정의 HTML 코드입니다.",
"keywords": "키워드",

View File

@ -13,6 +13,8 @@
"title": "Personvernerklæring"
},
"site": {
"customData": "Egendata",
"customDataDescription": "Egendata, brukt for egendata på nettstedet",
"customHtml": "Egendefinert HTML",
"customHtmlDescription": "Egendefinert HTML-kode som skal settes inn i bunnen av nettstedets body-tag.",
"keywords": "Nøkkelord",

View File

@ -13,6 +13,8 @@
"title": "Polityka prywatności"
},
"site": {
"customData": "Dane niestandardowe",
"customDataDescription": "Dane niestandardowe, używane do niestandardowych danych witryny",
"customHtml": "Niestandardowy HTML",
"customHtmlDescription": "Niestandardowy kod HTML, który ma być wstrzyknięty na końcu tagu bodyitryny.",
"keywords": "Słowa kluczowe",

View File

@ -13,6 +13,8 @@
"title": "Política de Privacidade"
},
"site": {
"customData": "Dados Personalizados",
"customDataDescription": "Dados personalizados, usados para dados personalizados do site",
"customHtml": "HTML Personalizado",
"customHtmlDescription": "Código HTML personalizado a ser inserido no final da tag bodyo site.",
"keywords": "Palavras-chave",

View File

@ -13,6 +13,8 @@
"title": "Politica de confidențialitate"
},
"site": {
"customData": "Date personalizate",
"customDataDescription": "Date personalizate, utilizate pentru datele personalizate ale site-ului",
"customHtml": "HTML personalizat",
"customHtmlDescription": "Cod HTML personalizat care va fi injectat în partea de jos a etichetei body a site-ului.",
"keywords": "Cuvinte cheie",

View File

@ -13,6 +13,8 @@
"title": "Политика конфиденциальности"
},
"site": {
"customData": "Пользовательские данные",
"customDataDescription": "Пользовательские данные, используемые для пользовательских данных сайта",
"customHtml": "Пользовательский HTML",
"customHtmlDescription": "Пользовательский HTML-код, который будет вставлен в конец тега body сайта.",
"keywords": "Ключевые слова",

View File

@ -13,6 +13,8 @@
"title": "นโยบายความเป็นส่วนตัว"
},
"site": {
"customData": "ข้อมูลที่กำหนดเอง",
"customDataDescription": "ข้อมูลที่กำหนดเอง ใช้สำหรับข้อมูลที่กำหนดเองของเว็บไซต์",
"customHtml": "HTML ที่กำหนดเอง",
"customHtmlDescription": "รหัส HTML ที่กำหนดเองเพื่อแทรกลงในส่วนล่างของแท็ก body ของเว็บไซต์.",
"keywords": "คำสำคัญ",

View File

@ -13,6 +13,8 @@
"title": "Gizlilik Politikası"
},
"site": {
"customData": "Özel Veri",
"customDataDescription": "Özel Veri, sitenin özel verileri için kullanılır",
"customHtml": "Özel HTML",
"customHtmlDescription": "Site'in body etiketinin altına yerleştirilecek özel HTML kodu.",
"keywords": "Anahtar Kelimeler",

View File

@ -13,6 +13,8 @@
"title": "Політика конфіденційності"
},
"site": {
"customData": "Користувацькі дані",
"customDataDescription": "Користувацькі дані, що використовуються для користувацьких даних сайту",
"customHtml": "Користувацький HTML",
"customHtmlDescription": "Користувацький HTML-код, який буде вставлено в кінець тегу body сайту.",
"keywords": "Ключові слова",

View File

@ -13,6 +13,8 @@
"title": "Chính sách bảo mật"
},
"site": {
"customData": "Dữ liệu tùy chỉnh",
"customDataDescription": "Dữ liệu tùy chỉnh, được sử dụng cho dữ liệu tùy chỉnh của trang web",
"customHtml": "HTML tùy chỉnh",
"customHtmlDescription": "Mã HTML tùy chỉnh để được chèn vào cuối thẻ body của trang.",
"keywords": "Từ khóa",

View File

@ -13,6 +13,8 @@
"title": "隐私政策"
},
"site": {
"customData": "自定义数据",
"customDataDescription": "自定义数据,用于网站的自定义数据",
"customHtml": "自定义HTML",
"customHtmlDescription": "要注入到网站 body 标签底部的自定义 HTML 代码。",
"keywords": "关键词",

View File

@ -13,6 +13,8 @@
"title": "私隱政策"
},
"site": {
"customData": "自定義數據",
"customDataDescription": "自定義數據,用於網站的自定義數據",
"customHtml": "自定義HTML",
"customHtmlDescription": "自定義 HTML 代碼,將注入到網站 body 標籤的底部。",
"keywords": "關鍵字",

View File

@ -1,5 +1,5 @@
// @ts-ignore
// API 更新时间:
// API 唯一标识:
import * as ads from './ads';

View File

@ -1269,6 +1269,13 @@ declare namespace API {
site_logo: string;
keywords: string;
custom_html: string;
custom_data: string;
};
type SiteCustomDataContacts = {
email: string;
telephone: string;
address: string;
};
type SortItem = {

View File

@ -1,5 +1,5 @@
// @ts-ignore
// API 更新时间:
// API 唯一标识:
import * as auth from './auth';

View File

@ -659,6 +659,13 @@ declare namespace API {
site_logo: string;
keywords: string;
custom_html: string;
custom_data: string;
};
type SiteCustomDataContacts = {
email: string;
telephone: string;
address: string;
};
type SortItem = {

View File

@ -22,6 +22,7 @@ export const useGlobalStore = create<GlobalStore>((set, get) => ({
site_logo: '',
keywords: '',
custom_html: '',
custom_data: '',
},
verify: {
turnstile_site_key: '',

View File

@ -1,5 +1,5 @@
// @ts-ignore
// API 更新时间:
// API 唯一标识:
import * as auth from './auth';

View File

@ -659,6 +659,13 @@ declare namespace API {
site_logo: string;
keywords: string;
custom_html: string;
custom_data: string;
};
type SiteCustomDataContacts = {
email: string;
telephone: string;
address: string;
};
type SortItem = {

View File

@ -1,5 +1,5 @@
// @ts-ignore
// API 更新时间:
// API 唯一标识:
import * as announcement from './announcement';

View File

@ -777,6 +777,13 @@ declare namespace API {
site_logo: string;
keywords: string;
custom_html: string;
custom_data: string;
};
type SiteCustomDataContacts = {
email: string;
telephone: string;
address: string;
};
type SortItem = {