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 { Label } from '@workspace/ui/components/label';
import { Table, TableBody, TableCell, TableRow } from '@workspace/ui/components/table'; import { Table, TableBody, TableCell, TableRow } from '@workspace/ui/components/table';
import { Textarea } from '@workspace/ui/components/textarea'; 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 { EnhancedInput } from '@workspace/ui/custom-components/enhanced-input';
import { UploadImage } from '@workspace/ui/custom-components/upload-image'; import { UploadImage } from '@workspace/ui/custom-components/upload-image';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
@ -130,6 +131,49 @@ export default function Site() {
/> />
</TableCell> </TableCell>
</TableRow> </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> </TableBody>
</Table> </Table>
); );

View File

@ -58,8 +58,21 @@ export default function Page() {
<Switch <Switch
defaultChecked={row.getValue('enable')} defaultChecked={row.getValue('enable')}
onCheckedChange={async (checked) => { 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({ await updateUserBasicInfo({
...row.original, user_id: id,
...rest,
enable: checked, enable: checked,
} as unknown as API.UpdateUserBasiceInfoRequest); } as unknown as API.UpdateUserBasiceInfoRequest);
toast.success(t('updateSuccess')); toast.success(t('updateSuccess'));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,6 +13,8 @@
"title": "Chính sách bảo mật" "title": "Chính sách bảo mật"
}, },
"site": { "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", "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.", "customHtmlDescription": "Mã HTML tùy chỉnh để được chèn vào cuối thẻ body của trang.",
"keywords": "Từ khóa", "keywords": "Từ khóa",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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