Skip to content

Commit 7269c82

Browse files
authored
Merge pull request #600 from thecodacus/update-setting-modal-styles
refactor(SettingWindow):Updated Settings Tab Styling
2 parents ba29e59 + 6323681 commit 7269c82

File tree

9 files changed

+497
-417
lines changed

9 files changed

+497
-417
lines changed

app/styles/components/Settings.scss renamed to app/components/settings/Settings.module.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
border-radius: 0.5rem;
4646
padding: 1rem;
4747
margin-bottom: 1rem;
48+
border-style: solid;
49+
border-color: var(--bolt-elements-button-danger-backgroundHover) ;
50+
border-width: thin;
4851

4952
button {
5053
background-color: var(--bolt-elements-button-danger-background);

app/components/ui/Settings.tsx renamed to app/components/settings/SettingsWindow.tsx

Lines changed: 76 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@ import * as RadixDialog from '@radix-ui/react-dialog';
22
import { motion } from 'framer-motion';
33
import { useState } from 'react';
44
import { classNames } from '~/utils/classNames';
5-
import { DialogTitle, dialogVariants, dialogBackdropVariants } from './Dialog';
6-
import { IconButton } from './IconButton';
5+
import { DialogTitle, dialogVariants, dialogBackdropVariants } from '~/components/ui/Dialog';
6+
import { IconButton } from '~/components/ui/IconButton';
77
import { providersList } from '~/lib/stores/settings';
88
import { db, getAll, deleteById } from '~/lib/persistence';
99
import { toast } from 'react-toastify';
1010
import { useNavigate } from '@remix-run/react';
1111
import commit from '~/commit.json';
1212
import Cookies from 'js-cookie';
13-
import { SettingsSlider } from './SettingsSlider';
14-
import '~/styles/components/SettingsSlider.scss';
15-
import '~/styles/components/Settings.scss';
13+
import styles from './Settings.module.scss';
14+
import { Switch } from '~/components/ui/Switch';
1615

1716
interface SettingsProps {
1817
open: boolean;
@@ -24,7 +23,7 @@ type TabType = 'chat-history' | 'providers' | 'features' | 'debug';
2423
// Providers that support base URL configuration
2524
const URL_CONFIGURABLE_PROVIDERS = ['Ollama', 'LMStudio', 'OpenAILike'];
2625

27-
export const Settings = ({ open, onClose }: SettingsProps) => {
26+
export const SettingsWindow = ({ open, onClose }: SettingsProps) => {
2827
const navigate = useNavigate();
2928
const [activeTab, setActiveTab] = useState<TabType>('chat-history');
3029
const [isDebugEnabled, setIsDebugEnabled] = useState(false);
@@ -93,10 +92,10 @@ export const Settings = ({ open, onClose }: SettingsProps) => {
9392
return providersList;
9493
});
9594

96-
const handleToggleProvider = (providerName: string) => {
95+
const handleToggleProvider = (providerName: string, enabled: boolean) => {
9796
setProviders((prevProviders) => {
9897
const newProviders = prevProviders.map((provider) =>
99-
provider.name === providerName ? { ...provider, isEnabled: !provider.isEnabled } : provider,
98+
provider.name === providerName ? { ...provider, isEnabled: enabled } : provider,
10099
);
101100

102101
// Save to cookies
@@ -196,9 +195,9 @@ export const Settings = ({ open, onClose }: SettingsProps) => {
196195
return (
197196
<RadixDialog.Root open={open}>
198197
<RadixDialog.Portal>
199-
<RadixDialog.Overlay asChild>
198+
<RadixDialog.Overlay asChild onClick={onClose}>
200199
<motion.div
201-
className="bg-black/50 fixed inset-0 z-max"
200+
className="bg-black/50 fixed inset-0 z-max backdrop-blur-sm"
202201
initial="closed"
203202
animate="open"
204203
exit="closed"
@@ -214,14 +213,20 @@ export const Settings = ({ open, onClose }: SettingsProps) => {
214213
variants={dialogVariants}
215214
>
216215
<div className="flex h-full">
217-
<div className="w-48 border-r border-bolt-elements-borderColor bg-white dark:bg-gray-900 p-4 flex flex-col justify-between settings-tabs">
216+
<div
217+
className={classNames(
218+
'w-48 border-r border-bolt-elements-borderColor bg-bolt-elements-background-depth-1 p-4 flex flex-col justify-between',
219+
styles['settings-tabs'],
220+
)}
221+
>
222+
<DialogTitle className="flex-shrink-0 text-lg font-semibold text-bolt-elements-textPrimary mb-2">
223+
Settings
224+
</DialogTitle>
218225
{tabs.map((tab) => (
219226
<button
220227
key={tab.id}
221228
onClick={() => setActiveTab(tab.id)}
222-
className={classNames(
223-
activeTab === tab.id ? 'active' : ''
224-
)}
229+
className={classNames(activeTab === tab.id ? styles.active : '')}
225230
>
226231
<div className={tab.icon} />
227232
{tab.label}
@@ -232,7 +237,7 @@ export const Settings = ({ open, onClose }: SettingsProps) => {
232237
href="https://github.com/coleam00/bolt.new-any-llm"
233238
target="_blank"
234239
rel="noopener noreferrer"
235-
className="settings-button flex items-center gap-2"
240+
className={classNames(styles['settings-button'], 'flex items-center gap-2')}
236241
>
237242
<div className="i-ph:github-logo" />
238243
GitHub
@@ -241,36 +246,49 @@ export const Settings = ({ open, onClose }: SettingsProps) => {
241246
href="https://coleam00.github.io/bolt.new-any-llm"
242247
target="_blank"
243248
rel="noopener noreferrer"
244-
className="settings-button flex items-center gap-2"
249+
className={classNames(styles['settings-button'], 'flex items-center gap-2')}
245250
>
246251
<div className="i-ph:book" />
247252
Docs
248253
</a>
249254
</div>
250255
</div>
251256

252-
<div className="flex-1 flex flex-col p-8 bg-gray-50 dark:bg-gray-800">
253-
<DialogTitle className="flex-shrink-0 text-lg font-semibold text-bolt-elements-textPrimary">Settings</DialogTitle>
257+
<div className="flex-1 flex flex-col p-8 pt-10 bg-bolt-elements-background-depth-2">
254258
<div className="flex-1 overflow-y-auto">
255259
{activeTab === 'chat-history' && (
256260
<div className="p-4">
257261
<h3 className="text-lg font-medium text-bolt-elements-textPrimary mb-4">Chat History</h3>
258262
<button
259263
onClick={handleExportAllChats}
260-
className="bg-blue-500 text-white rounded-lg px-4 py-2 hover:bg-blue-600 mb-4 transition-colors duration-200"
264+
className={classNames(
265+
'bg-bolt-elements-button-primary-background',
266+
'rounded-lg px-4 py-2 mb-4 transition-colors duration-200',
267+
'hover:bg-bolt-elements-button-primary-backgroundHover',
268+
'text-bolt-elements-button-primary-text',
269+
)}
261270
>
262271
Export All Chats
263272
</button>
264273

265-
<div className="text-bolt-elements-textPrimary rounded-lg p-4 mb-4 settings-danger-area">
274+
<div
275+
className={classNames(
276+
'text-bolt-elements-textPrimary rounded-lg py-4 mb-4',
277+
styles['settings-danger-area'],
278+
)}
279+
>
266280
<h4 className="font-semibold">Danger Area</h4>
267281
<p className="mb-2">This action cannot be undone!</p>
268282
<button
269283
onClick={handleDeleteAllChats}
270284
disabled={isDeleting}
271285
className={classNames(
272-
'bg-red-700 text-white rounded-lg px-4 py-2 transition-colors duration-200',
273-
isDeleting ? 'opacity-50 cursor-not-allowed' : 'hover:bg-red-800',
286+
'bg-bolt-elements-button-danger-background',
287+
'rounded-lg px-4 py-2 transition-colors duration-200',
288+
isDeleting
289+
? 'opacity-50 cursor-not-allowed'
290+
: 'hover:bg-bolt-elements-button-danger-backgroundHover',
291+
'text-bolt-elements-button-danger-text',
274292
)}
275293
>
276294
{isDeleting ? 'Deleting...' : 'Delete All Chats'}
@@ -280,39 +298,27 @@ export const Settings = ({ open, onClose }: SettingsProps) => {
280298
)}
281299
{activeTab === 'providers' && (
282300
<div className="p-4">
283-
<div className="flex items-center justify-between mb-4">
284-
<h3 className="text-lg font-medium text-bolt-elements-textPrimary">Providers</h3>
301+
<div className="flex mb-4">
285302
<input
286303
type="text"
287304
placeholder="Search providers..."
288305
value={searchTerm}
289306
onChange={(e) => setSearchTerm(e.target.value)}
290-
className="mb-4 p-2 rounded border border-gray-300"
307+
className="w-full bg-white dark:bg-bolt-elements-background-depth-4 relative px-2 py-1.5 rounded-md focus:outline-none placeholder-bolt-elements-textTertiary text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary border border-bolt-elements-borderColor"
291308
/>
292309
</div>
293310
{filteredProviders.map((provider) => (
294311
<div
295312
key={provider.name}
296-
className="flex flex-col mb-6 provider-item hover:bg-bolt-elements-bg-depth-3 p-4 rounded-lg"
313+
className="flex flex-col mb-2 provider-item hover:bg-bolt-elements-bg-depth-3 p-4 rounded-lg border border-bolt-elements-borderColor "
297314
>
298315
<div className="flex items-center justify-between mb-2">
299316
<span className="text-bolt-elements-textPrimary">{provider.name}</span>
300-
<label className="relative inline-flex items-center cursor-pointer">
301-
<input
302-
type="checkbox"
303-
className="sr-only"
304-
checked={provider.isEnabled}
305-
onChange={() => handleToggleProvider(provider.name)}
306-
/>
307-
<div className={classNames(
308-
'settings-toggle__track',
309-
provider.isEnabled ? 'settings-toggle__track--enabled' : 'settings-toggle__track--disabled'
310-
)}></div>
311-
<div className={classNames(
312-
'settings-toggle__thumb',
313-
provider.isEnabled ? 'settings-toggle__thumb--enabled' : ''
314-
)}></div>
315-
</label>
317+
<Switch
318+
className="ml-auto"
319+
checked={provider.isEnabled}
320+
onCheckedChange={(enabled) => handleToggleProvider(provider.name, enabled)}
321+
/>
316322
</div>
317323
{/* Base URL input for configurable providers */}
318324
{URL_CONFIGURABLE_PROVIDERS.includes(provider.name) && provider.isEnabled && (
@@ -323,7 +329,7 @@ export const Settings = ({ open, onClose }: SettingsProps) => {
323329
value={baseUrls[provider.name]}
324330
onChange={(e) => handleBaseUrlChange(provider.name, e.target.value)}
325331
placeholder={`Enter ${provider.name} base URL`}
326-
className="w-full p-2 rounded border border-bolt-elements-borderColor bg-bolt-elements-bg-depth-2 text-bolt-elements-textPrimary text-sm"
332+
className="w-full bg-white dark:bg-bolt-elements-background-depth-4 relative px-2 py-1.5 rounded-md focus:outline-none placeholder-bolt-elements-textTertiary text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary border border-bolt-elements-borderColor"
327333
/>
328334
</div>
329335
)}
@@ -343,14 +349,18 @@ export const Settings = ({ open, onClose }: SettingsProps) => {
343349
checked={isDebugEnabled}
344350
onChange={() => setIsDebugEnabled(!isDebugEnabled)}
345351
/>
346-
<div className={classNames(
347-
'settings-toggle__track',
348-
isDebugEnabled ? 'settings-toggle__track--enabled' : 'settings-toggle__track--disabled'
349-
)}></div>
350-
<div className={classNames(
351-
'settings-toggle__thumb',
352-
isDebugEnabled ? 'settings-toggle__thumb--enabled' : ''
353-
)}></div>
352+
<div
353+
className={classNames(
354+
'settings-toggle__track',
355+
isDebugEnabled ? 'settings-toggle__track--enabled' : 'settings-toggle__track--disabled',
356+
)}
357+
></div>
358+
<div
359+
className={classNames(
360+
'settings-toggle__thumb',
361+
isDebugEnabled ? 'settings-toggle__thumb--enabled' : '',
362+
)}
363+
></div>
354364
</label>
355365
</div>
356366
</div>
@@ -367,14 +377,18 @@ export const Settings = ({ open, onClose }: SettingsProps) => {
367377
checked={isJustSayEnabled}
368378
onChange={() => setIsJustSayEnabled(!isJustSayEnabled)}
369379
/>
370-
<div className={classNames(
371-
'settings-toggle__track',
372-
isJustSayEnabled ? 'settings-toggle__track--enabled' : 'settings-toggle__track--disabled'
373-
)}></div>
374-
<div className={classNames(
375-
'settings-toggle__thumb',
376-
isJustSayEnabled ? 'settings-toggle__thumb--enabled' : ''
377-
)}></div>
380+
<div
381+
className={classNames(
382+
'settings-toggle__track',
383+
isJustSayEnabled ? 'settings-toggle__track--enabled' : 'settings-toggle__track--disabled',
384+
)}
385+
></div>
386+
<div
387+
className={classNames(
388+
'settings-toggle__thumb',
389+
isJustSayEnabled ? 'settings-toggle__thumb--enabled' : '',
390+
)}
391+
></div>
378392
</label>
379393
</div>
380394
</div>
@@ -408,7 +422,9 @@ export const Settings = ({ open, onClose }: SettingsProps) => {
408422
<ul>
409423
<li className="text-bolt-elements-textSecondary">Ollama: {process.env.REACT_APP_OLLAMA_URL}</li>
410424
<li className="text-bolt-elements-textSecondary">OpenAI: {process.env.REACT_APP_OPENAI_URL}</li>
411-
<li className="text-bolt-elements-textSecondary">LM Studio: {process.env.REACT_APP_LM_STUDIO_URL}</li>
425+
<li className="text-bolt-elements-textSecondary">
426+
LM Studio: {process.env.REACT_APP_LM_STUDIO_URL}
427+
</li>
412428
</ul>
413429

414430
<h4 className="text-md font-medium text-bolt-elements-textPrimary mt-4">Version Information</h4>

app/components/sidebar/Menu.client.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
33
import { toast } from 'react-toastify';
44
import { Dialog, DialogButton, DialogDescription, DialogRoot, DialogTitle } from '~/components/ui/Dialog';
55
import { ThemeSwitch } from '~/components/ui/ThemeSwitch';
6-
import { Settings } from '~/components/ui/Settings';
6+
import { SettingsWindow } from '~/components/settings/SettingsWindow';
77
import { SettingsButton } from '~/components/ui/SettingsButton';
88
import { db, deleteById, getAll, chatId, type ChatHistoryItem, useChatHistory } from '~/lib/persistence';
99
import { cubicEasingFn } from '~/utils/easings';
@@ -208,7 +208,7 @@ export const Menu = () => {
208208
<ThemeSwitch />
209209
</div>
210210
</div>
211-
<Settings open={isSettingsOpen} onClose={() => setIsSettingsOpen(false)} />
211+
<SettingsWindow open={isSettingsOpen} onClose={() => setIsSettingsOpen(false)} />
212212
</motion.div>
213213
);
214214
};

app/components/ui/SettingsButton.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { memo } from 'react';
2-
import { IconButton } from './IconButton';
3-
2+
import { IconButton } from '~/components/ui/IconButton';
43
interface SettingsButtonProps {
54
onClick: () => void;
65
}

app/components/ui/SettingsSlider.tsx

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)