Skip to content

Commit 150116e

Browse files
authored
🎨 style: standardize dropdown styling & fix z-Index layering (danny-avila#6939)
* fix: Dropdown settings * refactor: classname cleanup * refactor: export modal * fix: Export dropdown
1 parent 52f146d commit 150116e

File tree

8 files changed

+39
-39
lines changed

8 files changed

+39
-39
lines changed

client/src/components/Audio/Voices.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function BrowserVoiceDropdown() {
2929
onChange={handleVoiceChange}
3030
sizeClasses="min-w-[200px] !max-w-[400px] [--anchor-max-width:400px]"
3131
testId="BrowserVoiceDropdown"
32-
className="rounded-xl"
32+
className="z-50"
3333
/>
3434
</div>
3535
);
@@ -58,7 +58,7 @@ export function ExternalVoiceDropdown() {
5858
onChange={handleVoiceChange}
5959
sizeClasses="min-w-[200px] !max-w-[400px] [--anchor-max-width:400px]"
6060
testId="ExternalVoiceDropdown"
61-
className="rounded-xl"
61+
className="z-50"
6262
/>
6363
</div>
6464
);

client/src/components/Nav/ExportConversation/ExportModal.tsx

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
import filenamify from 'filenamify';
2-
import { useEffect, useState } from 'react';
2+
import { useEffect, useState, useMemo, useCallback } from 'react';
33
import type { TConversation } from 'librechat-data-provider';
44
import { OGDialog, Button, Input, Label, Checkbox, Dropdown } from '~/components/ui';
55
import OGDialogTemplate from '~/components/ui/OGDialogTemplate';
66
import { useLocalize, useExportConversation } from '~/hooks';
77

8+
const TYPE_OPTIONS = [
9+
{ value: 'screenshot', label: 'screenshot (.png)' },
10+
{ value: 'text', label: 'text (.txt)' },
11+
{ value: 'markdown', label: 'markdown (.md)' },
12+
{ value: 'json', label: 'json (.json)' },
13+
{ value: 'csv', label: 'csv (.csv)' },
14+
];
15+
816
export default function ExportModal({
917
open,
1018
onOpenChange,
@@ -21,20 +29,12 @@ export default function ExportModal({
2129
const localize = useLocalize();
2230

2331
const [filename, setFileName] = useState('');
24-
const [type, setType] = useState('Select a file type');
32+
const [type, setType] = useState<string>('screenshot');
2533

2634
const [includeOptions, setIncludeOptions] = useState<boolean | 'indeterminate'>(true);
2735
const [exportBranches, setExportBranches] = useState<boolean | 'indeterminate'>(false);
2836
const [recursive, setRecursive] = useState<boolean | 'indeterminate'>(true);
2937

30-
const typeOptions = [
31-
{ value: 'screenshot', label: 'screenshot (.png)' },
32-
{ value: 'text', label: 'text (.txt)' },
33-
{ value: 'markdown', label: 'markdown (.md)' },
34-
{ value: 'json', label: 'json (.json)' },
35-
{ value: 'csv', label: 'csv (.csv)' },
36-
];
37-
3838
useEffect(() => {
3939
if (!open && triggerRef && triggerRef.current) {
4040
triggerRef.current.focus();
@@ -49,17 +49,19 @@ export default function ExportModal({
4949
setRecursive(true);
5050
}, [conversation?.title, open]);
5151

52-
const _setType = (newType: string) => {
53-
const exportBranchesSupport = newType === 'json' || newType === 'csv' || newType === 'webpage';
54-
const exportOptionsSupport = newType !== 'csv' && newType !== 'screenshot';
55-
56-
setExportBranches(exportBranchesSupport);
57-
setIncludeOptions(exportOptionsSupport);
52+
const handleTypeChange = useCallback((newType: string) => {
53+
const branches = newType === 'json' || newType === 'csv' || newType === 'webpage';
54+
const options = newType !== 'csv' && newType !== 'screenshot';
55+
setExportBranches(branches);
56+
setIncludeOptions(options);
5857
setType(newType);
59-
};
58+
}, []);
6059

61-
const exportBranchesSupport = type === 'json' || type === 'csv' || type === 'webpage';
62-
const exportOptionsSupport = type !== 'csv' && type !== 'screenshot';
60+
const exportBranchesSupport = useMemo(
61+
() => type === 'json' || type === 'csv' || type === 'webpage',
62+
[type],
63+
);
64+
const exportOptionsSupport = useMemo(() => type !== 'csv' && type !== 'screenshot', [type]);
6365

6466
const { exportConversation } = useExportConversation({
6567
conversation,
@@ -94,7 +96,13 @@ export default function ExportModal({
9496
<Label htmlFor="type" className="text-left text-sm font-medium">
9597
{localize('com_nav_export_type')}
9698
</Label>
97-
<Dropdown value={type} onChange={_setType} options={typeOptions} portal={false} />
99+
<Dropdown
100+
value={type}
101+
onChange={handleTypeChange}
102+
options={TYPE_OPTIONS}
103+
className="z-50"
104+
portal={false}
105+
/>
98106
</div>
99107
</div>
100108
<div className="grid w-full gap-6 sm:grid-cols-2">
@@ -108,7 +116,6 @@ export default function ExportModal({
108116
id="includeOptions"
109117
disabled={!exportOptionsSupport}
110118
checked={includeOptions}
111-
className="focus:ring-opacity-20 dark:border-gray-500 dark:bg-gray-700 dark:text-gray-50 dark:focus:ring-gray-600 dark:focus:ring-opacity-50 dark:focus:ring-offset-0"
112119
onCheckedChange={setIncludeOptions}
113120
/>
114121
<label
@@ -131,7 +138,6 @@ export default function ExportModal({
131138
id="exportBranches"
132139
disabled={!exportBranchesSupport}
133140
checked={exportBranches}
134-
className="focus:ring-opacity-20 dark:border-gray-500 dark:bg-gray-700 dark:text-gray-50 dark:focus:ring-gray-600 dark:focus:ring-opacity-50 dark:focus:ring-offset-0"
135141
onCheckedChange={setExportBranches}
136142
/>
137143
<label
@@ -150,12 +156,7 @@ export default function ExportModal({
150156
{localize('com_nav_export_recursive_or_sequential')}
151157
</Label>
152158
<div className="flex h-[40px] w-full items-center space-x-3">
153-
<Checkbox
154-
id="recursive"
155-
checked={recursive}
156-
className="focus:ring-opacity-20 dark:border-gray-500 dark:bg-gray-700 dark:text-gray-50 dark:focus:ring-gray-600 dark:focus:ring-opacity-50 dark:focus:ring-offset-0"
157-
onCheckedChange={setRecursive}
158-
/>
159+
<Checkbox id="recursive" checked={recursive} onCheckedChange={setRecursive} />
159160
<label
160161
htmlFor="recursive"
161162
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 dark:text-gray-50"

client/src/components/Nav/SettingsTabs/Chat/FontSizeSelector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default function FontSizeSelector() {
3030
onChange={handleChange}
3131
testId="font-size-selector"
3232
sizeClasses="w-[150px]"
33-
className="rounded-xl"
33+
className="z-50"
3434
/>
3535
</div>
3636
);

client/src/components/Nav/SettingsTabs/General/General.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const ThemeSelector = ({
5959
options={themeOptions}
6060
sizeClasses="w-[180px]"
6161
testId="theme-selector"
62-
className="rounded-xl"
62+
className="z-50"
6363
/>
6464
</div>
6565
);
@@ -113,7 +113,7 @@ export const LangSelector = ({
113113
onChange={onChange}
114114
sizeClasses="[--anchor-max-height:256px]"
115115
options={languageOptions}
116-
className="rounded-xl"
116+
className="z-50"
117117
/>
118118
</div>
119119
);

client/src/components/Nav/SettingsTabs/Speech/STT/EngineSTTDropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const EngineSTTDropdown: React.FC<EngineSTTDropdownProps> = ({ external }) => {
3232
options={endpointOptions}
3333
sizeClasses="w-[180px]"
3434
testId="EngineSTTDropdown"
35-
className="rounded-xl"
35+
className="z-50"
3636
/>
3737
</div>
3838
);

client/src/components/Nav/SettingsTabs/Speech/TTS/EngineTTSDropdown.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ const EngineTTSDropdown: React.FC<EngineTTSDropdownProps> = ({ external }) => {
3131
onChange={handleSelect}
3232
options={endpointOptions}
3333
sizeClasses="w-[180px]"
34-
anchor="bottom start"
3534
testId="EngineTTSDropdown"
36-
className="rounded-xl"
35+
className="z-50"
3736
/>
3837
</div>
3938
);

client/src/components/ui/Dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const Dropdown: React.FC<DropdownProps> = ({
7070
<Select.Select
7171
store={selectProps}
7272
className={cn(
73-
'focus:ring-offset-ring-offset relative inline-flex items-center justify-between rounded-lg border border-input bg-background px-3 py-2 text-sm text-text-primary transition-all duration-200 ease-in-out hover:bg-accent hover:text-accent-foreground focus:ring-ring-primary',
73+
'focus:ring-offset-ring-offset relative inline-flex items-center justify-between rounded-xl border border-input bg-background px-3 py-2 text-sm text-text-primary transition-all duration-200 ease-in-out hover:bg-accent hover:text-accent-foreground focus:ring-ring-primary',
7474
iconOnly ? 'h-full w-10' : 'w-fit gap-2',
7575
className,
7676
)}

client/src/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2518,7 +2518,7 @@ html {
25182518
border-width: 1px;
25192519
border-style: solid;
25202520
border-color: var(--border-light);
2521-
background-color: hsl(var(--background));
2521+
background-color: var(--surface-primary);
25222522
padding: 0.5rem;
25232523
color: var(--text-primary);
25242524
box-shadow:
@@ -2542,7 +2542,7 @@ html {
25422542
}
25432543

25442544
.popover-ui:where(.dark, .dark *) {
2545-
background-color: hsl(var(--secondary));
2545+
background-color: var(--surface-secondary);
25462546
color: var(--text-secondary);
25472547
box-shadow:
25482548
0 10px 15px -3px rgb(0 0 0 / 0.25),

0 commit comments

Comments
 (0)