Skip to content

Commit c603b6e

Browse files
authored
refactor(tarko-agent-ui): deduplicate muiTheme definitions (#1523)
1 parent 879e758 commit c603b6e

3 files changed

Lines changed: 157 additions & 183 deletions

File tree

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
import { createTheme } from '@mui/material';
2+
3+
/**
4+
* Creates a basic MUI theme with just dark/light mode
5+
*/
6+
export const createBasicMuiTheme = (isDarkMode: boolean) => {
7+
return createTheme({
8+
palette: {
9+
mode: isDarkMode ? 'dark' : 'light',
10+
},
11+
});
12+
};
13+
14+
/**
15+
* Creates an enhanced MUI theme for model selector with custom styling
16+
*/
17+
export const createModelSelectorMuiTheme = (isDarkMode: boolean) => {
18+
return createTheme({
19+
palette: {
20+
mode: isDarkMode ? 'dark' : 'light',
21+
primary: {
22+
main: '#6366f1',
23+
},
24+
background: {
25+
paper: isDarkMode ? 'rgba(31, 41, 55, 0.98)' : 'rgba(255, 255, 255, 0.98)',
26+
default: isDarkMode ? '#1f2937' : '#f9fafb',
27+
},
28+
text: {
29+
primary: isDarkMode ? '#f9fafb' : '#374151',
30+
secondary: isDarkMode ? '#d1d5db' : '#6b7280',
31+
},
32+
},
33+
components: {
34+
MuiSelect: {
35+
styleOverrides: {
36+
root: {
37+
borderRadius: '8px',
38+
height: '28px',
39+
minHeight: '28px',
40+
fontSize: '12px',
41+
fontWeight: 500,
42+
background: isDarkMode ? 'rgba(55, 65, 81, 0.3)' : 'rgba(248, 250, 252, 0.8)',
43+
backdropFilter: 'blur(8px)',
44+
border: isDarkMode
45+
? '1px solid rgba(75, 85, 99, 0.3)'
46+
: '1px solid rgba(203, 213, 225, 0.6)',
47+
'& .MuiOutlinedInput-notchedOutline': { border: 'none !important' },
48+
'&:hover': {
49+
background: isDarkMode ? 'rgba(55, 65, 81, 0.8)' : 'rgba(241, 245, 249, 0.9)',
50+
boxShadow: isDarkMode
51+
? '0 2px 4px -1px rgba(0, 0, 0, 0.2)'
52+
: '0 2px 4px -1px rgba(0, 0, 0, 0.05)',
53+
},
54+
'& .MuiSelect-icon': {
55+
display: 'none',
56+
},
57+
},
58+
select: {
59+
padding: '4px 10px !important',
60+
display: 'flex',
61+
alignItems: 'center',
62+
gap: '6px',
63+
height: '24px',
64+
minHeight: '24px',
65+
},
66+
},
67+
},
68+
MuiMenuItem: {
69+
styleOverrides: {
70+
root: {
71+
fontSize: '13px',
72+
padding: '8px 16px',
73+
borderRadius: '8px',
74+
margin: '3px 8px',
75+
minHeight: '40px',
76+
transition: 'all 0.2s cubic-bezier(0.4, 0, 0.2, 1)',
77+
'&:hover': {
78+
backgroundColor: isDarkMode ? 'rgba(99, 102, 241, 0.15)' : 'rgba(99, 102, 241, 0.08)',
79+
transform: 'translateX(2px)',
80+
},
81+
'&.Mui-selected': {
82+
backgroundColor: isDarkMode ? 'rgba(99, 102, 241, 0.25)' : 'rgba(99, 102, 241, 0.12)',
83+
color: isDarkMode ? '#a5b4fc' : '#6366f1',
84+
'&:hover': {
85+
backgroundColor: isDarkMode
86+
? 'rgba(99, 102, 241, 0.3)'
87+
: 'rgba(99, 102, 241, 0.18)',
88+
transform: 'translateX(2px)',
89+
},
90+
},
91+
},
92+
},
93+
},
94+
MuiPaper: {
95+
styleOverrides: {
96+
root: {
97+
borderRadius: '16px',
98+
maxWidth: '400px',
99+
boxShadow: isDarkMode
100+
? '0 20px 40px -10px rgba(0, 0, 0, 0.5), 0 8px 16px -4px rgba(0, 0, 0, 0.3)'
101+
: '0 20px 40px -10px rgba(0, 0, 0, 0.15), 0 8px 16px -4px rgba(0, 0, 0, 0.08)',
102+
backdropFilter: 'blur(20px)',
103+
border: isDarkMode
104+
? '1px solid rgba(75, 85, 99, 0.4)'
105+
: '1px solid rgba(229, 231, 235, 0.6)',
106+
background: isDarkMode ? 'rgba(31, 41, 55, 0.95)' : 'rgba(255, 255, 255, 0.95)',
107+
animation: 'menuSlideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1)',
108+
transformOrigin: 'top center',
109+
},
110+
},
111+
},
112+
},
113+
});
114+
};

0 commit comments

Comments
 (0)