Skip to content

Commit 2831b21

Browse files
committed
Improve chatbot setting style
1 parent 7fc6844 commit 2831b21

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

src/app/pages/SettingPage.tsx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useCallback, useEffect, useState } from 'react'
1+
import { FC, PropsWithChildren, useCallback, useEffect, useState } from 'react'
22
import toast, { Toaster } from 'react-hot-toast'
33
import { useTranslation } from 'react-i18next'
44
import { BiExport, BiImport } from 'react-icons/bi'
@@ -36,6 +36,15 @@ const BING_STYLE_OPTIONS = [
3636
{ name: 'Creative', value: BingConversationStyle.Creative },
3737
]
3838

39+
const ChatBotSettingPanel: FC<PropsWithChildren<{ title: string }>> = (props) => {
40+
return (
41+
<div className="flex flex-col gap-1 border border-primary-border px-5 py-4 rounded-lg max-w-[650px] shadow-sm">
42+
<p className="font-bold text-md">{props.title}</p>
43+
{props.children}
44+
</div>
45+
)
46+
}
47+
3948
function SettingPage() {
4049
const { t } = useTranslation()
4150
const [shortcuts, setShortcuts] = useState<string[]>([])
@@ -132,8 +141,7 @@ function SettingPage() {
132141
<p className="font-bold text-lg">{t('Chatbots')}</p>
133142
<EnabledBotsSettings userConfig={userConfig} updateConfigValue={updateConfigValue} />
134143
</div>
135-
<div className="flex flex-col gap-1">
136-
<p className="font-bold text-lg">ChatGPT</p>
144+
<ChatBotSettingPanel title="ChatGPT">
137145
<RadioGroup
138146
options={Object.entries(ChatGPTMode).map(([k, v]) => ({ label: `${k} ${t('Mode')}`, value: v }))}
139147
value={userConfig.chatgptMode}
@@ -150,9 +158,8 @@ function SettingPage() {
150158
) : (
151159
<ChatGPWebSettings userConfig={userConfig} updateConfigValue={updateConfigValue} />
152160
)}
153-
</div>
154-
<div className="flex flex-col gap-1">
155-
<p className="font-bold text-lg">Claude</p>
161+
</ChatBotSettingPanel>
162+
<ChatBotSettingPanel title="Claude">
156163
<RadioGroup
157164
options={Object.entries(ClaudeMode).map(([k, v]) => ({ label: `${k} ${t('Mode')}`, value: v }))}
158165
value={userConfig.claudeMode}
@@ -167,9 +174,8 @@ function SettingPage() {
167174
) : (
168175
<ClaudePoeSettings userConfig={userConfig} updateConfigValue={updateConfigValue} />
169176
)}
170-
</div>
171-
<div className="flex flex-col gap-1">
172-
<p className="font-bold text-lg">Bing</p>
177+
</ChatBotSettingPanel>
178+
<ChatBotSettingPanel title="Bing">
173179
<div className="flex flex-row gap-3 items-center justify-between w-[250px]">
174180
<p className="font-medium text-base">{t('Chat style')}</p>
175181
<div className="w-[150px]">
@@ -180,7 +186,7 @@ function SettingPage() {
180186
/>
181187
</div>
182188
</div>
183-
</div>
189+
</ChatBotSettingPanel>
184190
</div>
185191
<Button color={dirty ? 'primary' : 'flat'} text={t('Save')} className="w-fit my-8" onClick={save} />
186192
<Toaster position="top-right" />

0 commit comments

Comments
 (0)