mirror of
https://github.com/sqlchat/sqlchat.git
synced 2025-09-26 17:45:14 +08:00
chore: update setting i18n items
This commit is contained in:
@ -191,7 +191,7 @@ const ConnectionSidebar = () => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{databaseList.length > 0 && (
|
{databaseList.length > 0 && (
|
||||||
<div className="w-full sticky top-0 z-1 mb-4 mt-2">
|
<div className="w-full sticky top-0 z-1 my-4">
|
||||||
<Select
|
<Select
|
||||||
className="w-full bg-white px-4 py-3"
|
className="w-full bg-white px-4 py-3"
|
||||||
value={currentConnectionCtx?.database?.name}
|
value={currentConnectionCtx?.database?.name}
|
||||||
|
@ -26,7 +26,7 @@ const LocaleSelector = () => {
|
|||||||
settingStore.setLocale(locale);
|
settingStore.setLocale(locale);
|
||||||
};
|
};
|
||||||
|
|
||||||
return <Select className="w-24" value={locale} itemList={localeItemList} onValueChange={handleLocaleChange} />;
|
return <Select className="w-28" value={locale} itemList={localeItemList} onValueChange={handleLocaleChange} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default LocaleSelector;
|
export default LocaleSelector;
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { useDebounce } from "react-use";
|
import { useDebounce } from "react-use";
|
||||||
import { useSettingStore } from "@/store";
|
import { useSettingStore } from "@/store";
|
||||||
import { OpenAIApiConfig } from "@/types";
|
import { OpenAIApiConfig } from "@/types";
|
||||||
|
|
||||||
const OpenAIApiConfigView = () => {
|
const OpenAIApiConfigView = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
const settingStore = useSettingStore();
|
const settingStore = useSettingStore();
|
||||||
const [openAIApiConfig, setOpenAIApiConfig] = useState(settingStore.setting.openAIApiConfig);
|
const [openAIApiConfig, setOpenAIApiConfig] = useState(settingStore.setting.openAIApiConfig);
|
||||||
|
|
||||||
@ -24,7 +26,7 @@ const OpenAIApiConfigView = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h3>OpenAI API configuration</h3>
|
<h3 className="pl-4 text-sm text-gray-500">{t("setting.openai-api-configuration.self")}</h3>
|
||||||
<div className="w-full border border-gray-200 p-4 rounded-lg">
|
<div className="w-full border border-gray-200 p-4 rounded-lg">
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<label htmlFor="openai-api-key">Key</label>
|
<label htmlFor="openai-api-key">Key</label>
|
||||||
|
@ -17,7 +17,7 @@ const SettingModal = (props: Props) => {
|
|||||||
return (
|
return (
|
||||||
<div className={`modal modal-middle ${show && "modal-open"}`}>
|
<div className={`modal modal-middle ${show && "modal-open"}`}>
|
||||||
<div className="modal-box relative">
|
<div className="modal-box relative">
|
||||||
<h3 className="font-bold text-lg">Setting</h3>
|
<h3 className="font-bold text-lg">{t("setting.self")}</h3>
|
||||||
<button className="btn btn-sm btn-circle absolute right-4 top-4" onClick={close}>
|
<button className="btn btn-sm btn-circle absolute right-4 top-4" onClick={close}>
|
||||||
<Icon.IoMdClose className="w-5 h-auto" />
|
<Icon.IoMdClose className="w-5 h-auto" />
|
||||||
</button>
|
</button>
|
||||||
@ -34,19 +34,20 @@ const SettingModal = (props: Props) => {
|
|||||||
<WeChatQRCodeView />
|
<WeChatQRCodeView />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3 className="pl-4 text-sm text-gray-500">{t("setting.basic.self")}</h3>
|
||||||
<div className="w-full border border-gray-200 p-4 rounded-lg">
|
<div className="w-full border border-gray-200 p-4 rounded-lg">
|
||||||
<div className="w-full flex flex-row justify-between items-center gap-2">
|
<div className="w-full flex flex-row justify-between items-center gap-2">
|
||||||
<span>Language</span>
|
<span>{t("setting.basic.language")}</span>
|
||||||
<LocaleSelector />
|
<LocaleSelector />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<OpenAIApiConfigView />
|
<OpenAIApiConfigView />
|
||||||
|
|
||||||
<h3>Danger Zone</h3>
|
<h3 className="pl-4 text-sm text-gray-500">{t("setting.data.self")}</h3>
|
||||||
<div className="w-full border border-red-200 p-4 rounded-lg">
|
<div className="w-full border border-red-200 p-4 rounded-lg">
|
||||||
<div className="w-full flex flex-row justify-between items-center gap-2">
|
<div className="w-full flex flex-row justify-between items-center gap-2">
|
||||||
<span>Clear all data</span>
|
<span>{t("setting.data.clear-all-data")}</span>
|
||||||
<ClearDataButton />
|
<ClearDataButton />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,10 +18,10 @@ const Select = (props: Props) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<SelectUI.Root value={value} onValueChange={onValueChange}>
|
<SelectUI.Root value={value} onValueChange={onValueChange}>
|
||||||
<SelectUI.Trigger className={`${className || ""} flex flex-row justify-between items-center border px-2 py-1 rounded-lg`}>
|
<SelectUI.Trigger className={`${className || ""} flex flex-row justify-between items-center border px-3 py-2 rounded-lg`}>
|
||||||
<SelectUI.Value placeholder={placeholder} />
|
<SelectUI.Value placeholder={placeholder} />
|
||||||
<SelectUI.Icon className="w-5 h-auto">
|
<SelectUI.Icon className="ml-1 w-5 h-auto shrink-0">
|
||||||
<Icon.BiChevronRight className="w-full h-auto opacity-60" />
|
<Icon.BiChevronDown className="w-full h-auto opacity-60" />
|
||||||
</SelectUI.Icon>
|
</SelectUI.Icon>
|
||||||
</SelectUI.Trigger>
|
</SelectUI.Trigger>
|
||||||
<SelectUI.Portal>
|
<SelectUI.Portal>
|
||||||
@ -34,7 +34,7 @@ const Select = (props: Props) => {
|
|||||||
>
|
>
|
||||||
<SelectUI.Viewport className="bg-white border shadow p-1 rounded-lg">
|
<SelectUI.Viewport className="bg-white border shadow p-1 rounded-lg">
|
||||||
<SelectUI.Group>
|
<SelectUI.Group>
|
||||||
{placeholder && <SelectUI.Label className="w-full px-2 py-1 text-sm text-gray-400">{placeholder}</SelectUI.Label>}
|
{placeholder && <SelectUI.Label className="w-full px-3 mt-2 mb-1 text-sm text-gray-400">{placeholder}</SelectUI.Label>}
|
||||||
{itemList.map((item) => (
|
{itemList.map((item) => (
|
||||||
<SelectItem key={item.label} value={item.value}>
|
<SelectItem key={item.label} value={item.value}>
|
||||||
{item.label}
|
{item.label}
|
||||||
@ -50,15 +50,17 @@ const Select = (props: Props) => {
|
|||||||
|
|
||||||
interface SelectItemProps {
|
interface SelectItemProps {
|
||||||
value: string;
|
value: string;
|
||||||
|
children: ReactNode;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
children?: ReactNode;
|
className?: string;
|
||||||
}
|
}
|
||||||
export type Ref = HTMLDivElement;
|
|
||||||
|
|
||||||
const SelectItem = forwardRef<Ref, SelectItemProps>(({ children, ...props }, forwardedRef) => {
|
const SelectItem = forwardRef<HTMLDivElement, SelectItemProps>(({ children, className, ...props }, forwardedRef) => {
|
||||||
return (
|
return (
|
||||||
<SelectUI.Item
|
<SelectUI.Item
|
||||||
className="w-full px-2 py-1 rounded-lg flex flex-row justify-between items-center cursor-pointer hover:bg-gray-100"
|
className={`${
|
||||||
|
className || ""
|
||||||
|
} w-full px-3 py-2 rounded-lg flex flex-row justify-between items-center cursor-pointer hover:bg-gray-100`}
|
||||||
{...props}
|
{...props}
|
||||||
ref={forwardedRef}
|
ref={forwardedRef}
|
||||||
>
|
>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"connection": {
|
"connection": {
|
||||||
"self": "Connection",
|
"self": "Connection",
|
||||||
"new": "Create Connection",
|
"new": "Create Connection",
|
||||||
"select-database": "Select your database:"
|
"select-database": "Select your database"
|
||||||
},
|
},
|
||||||
"execution": {
|
"execution": {
|
||||||
"title": "Execute query",
|
"title": "Execute query",
|
||||||
@ -30,6 +30,20 @@
|
|||||||
"editor": {
|
"editor": {
|
||||||
"placeholder": "Enter your question here..."
|
"placeholder": "Enter your question here..."
|
||||||
},
|
},
|
||||||
|
"setting": {
|
||||||
|
"self": "Setting",
|
||||||
|
"basic": {
|
||||||
|
"self": "Basic",
|
||||||
|
"language": "Language"
|
||||||
|
},
|
||||||
|
"openai-api-configuration": {
|
||||||
|
"self": "OpenAI API configuration"
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"self": "Data",
|
||||||
|
"clear-all-data": "Clear all data"
|
||||||
|
}
|
||||||
|
},
|
||||||
"social": {
|
"social": {
|
||||||
"join-discord-channel": "Join Discord Channel",
|
"join-discord-channel": "Join Discord Channel",
|
||||||
"join-wechat-group": "Join WeChat Group"
|
"join-wechat-group": "Join WeChat Group"
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"connection": {
|
"connection": {
|
||||||
"self": "连接",
|
"self": "连接",
|
||||||
"new": "创建连接",
|
"new": "创建连接",
|
||||||
"select-database": "选择您的数据库:"
|
"select-database": "选择数据库"
|
||||||
},
|
},
|
||||||
"execution": {
|
"execution": {
|
||||||
"title": "执行查询",
|
"title": "执行查询",
|
||||||
@ -30,6 +30,20 @@
|
|||||||
"editor": {
|
"editor": {
|
||||||
"placeholder": "在此输入您的问题..."
|
"placeholder": "在此输入您的问题..."
|
||||||
},
|
},
|
||||||
|
"setting": {
|
||||||
|
"self": "设置",
|
||||||
|
"basic": {
|
||||||
|
"self": "基础",
|
||||||
|
"language": "语言"
|
||||||
|
},
|
||||||
|
"openai-api-configuration": {
|
||||||
|
"self": "OpenAI API 配置"
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"self": "数据",
|
||||||
|
"clear-all-data": "清除所有数据"
|
||||||
|
}
|
||||||
|
},
|
||||||
"social": {
|
"social": {
|
||||||
"join-discord-channel": "加入 Discord 频道",
|
"join-discord-channel": "加入 Discord 频道",
|
||||||
"join-wechat-group": "加入微信群"
|
"join-wechat-group": "加入微信群"
|
||||||
|
Reference in New Issue
Block a user