Skip to content

Commit f4a94e4

Browse files
CopilotTechQuery
andcommitted
Migrate all PR files to use Tailwind CSS instead of MUI sx prop
Co-authored-by: TechQuery <[email protected]>
1 parent 61e7041 commit f4a94e4

File tree

3 files changed

+31
-115
lines changed

3 files changed

+31
-115
lines changed

components/User/SessionBox.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ export class SessionBox extends Component<SessionBoxProps> {
4949
const { path, menu = [] } = this.props;
5050

5151
return (
52-
<List component="nav" sx={{ px: 2 }}>
52+
<List component="nav" className="px-2">
5353
{menu.map(({ href, title }) => (
5454
<ListItem key={href} disablePadding>
5555
<ListItemButton
5656
component={Link}
5757
href={href || '#'}
5858
selected={path?.split('?')[0].startsWith(href || '')}
59-
sx={{ borderRadius: 1 }}
59+
className="rounded"
6060
onClick={this.closeDrawer}
6161
>
6262
<ListItemText primary={title} />

pages/dashboard/index.tsx

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,18 @@ const DashboardPage: FC<DashboardPageProps> = observer(({ route, jwtPayload }) =
3737

3838
return (
3939
<SessionBox title={t('backend_management')} path={route.resolvedUrl} {...{ menu, jwtPayload }}>
40-
<Container maxWidth="lg" sx={{ py: { xs: 3, md: 8 } }}>
40+
<Container maxWidth="lg" className="py-3 md:py-8">
4141
<Typography
4242
variant="h3"
4343
component="h1"
4444
gutterBottom
45-
sx={{
46-
fontSize: { xs: '1.75rem', sm: '2.5rem', md: '3rem' },
47-
}}
45+
className="text-[1.75rem] sm:text-[2.5rem] md:text-[3rem]"
4846
>
4947
{t('welcome_use')}
5048
</Typography>
5149

52-
<Box
53-
component="form"
54-
sx={{
55-
display: 'flex',
56-
flexDirection: { xs: 'column', sm: 'row' },
57-
gap: 2,
58-
alignItems: { xs: 'stretch', sm: 'center' },
59-
mt: 2,
60-
mb: 4,
61-
}}
50+
<form
51+
className="mb-4 mt-2 flex flex-col items-stretch gap-2 sm:flex-row sm:items-center"
6252
onSubmit={handleCreateProject}
6353
>
6454
<TextField
@@ -73,23 +63,16 @@ const DashboardPage: FC<DashboardPageProps> = observer(({ route, jwtPayload }) =
7363
type="submit"
7464
variant="contained"
7565
disabled={projectStore.uploading > 0}
76-
sx={{
77-
whiteSpace: 'nowrap',
78-
minWidth: { xs: '100%', sm: 'auto' },
79-
}}
66+
className="min-w-full whitespace-nowrap sm:min-w-0"
8067
>
8168
{t('create_new_project')}
8269
</Button>
83-
</Box>
70+
</form>
8471

8572
<Typography
8673
variant="h5"
8774
component="h2"
88-
sx={{
89-
mt: 4,
90-
mb: 3,
91-
fontSize: { xs: '1.25rem', sm: '1.5rem' },
92-
}}
75+
className="mb-3 mt-4 text-[1.25rem] sm:text-[1.5rem]"
9376
>
9477
{t('recent_projects')}
9578
</Typography>
@@ -110,7 +93,7 @@ const DashboardPage: FC<DashboardPageProps> = observer(({ route, jwtPayload }) =
11093
))
11194
) : (
11295
<Grid size={{ xs: 12 }}>
113-
<Typography color="textSecondary" sx={{ textAlign: 'center', mt: 4 }}>
96+
<Typography color="textSecondary" className="mt-4 text-center">
11497
{t('no_project_data')}
11598
</Typography>
11699
</Grid>

pages/dashboard/project/[id].tsx

Lines changed: 21 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -80,62 +80,35 @@ export default class ProjectEvaluationPage extends ObservedComponent<
8080
const name = isBot ? `${t('ai_assistant')} 🤖` : createdBy?.name || 'User';
8181

8282
return (
83-
<Box
83+
<div
8484
key={id}
8585
id={index + 1 === length ? 'last-message' : undefined}
86-
sx={{
87-
display: 'flex',
88-
justifyContent: isBot ? 'flex-start' : 'flex-end',
89-
mb: 2,
90-
width: '100%',
91-
}}
86+
className={`mb-2 flex w-full ${isBot ? 'justify-start' : 'justify-end'}`}
9287
>
93-
<Box
94-
sx={{
95-
display: 'flex',
96-
flexDirection: isBot ? 'row' : 'row-reverse',
97-
alignItems: 'flex-start',
98-
maxWidth: { xs: '95%', sm: '80%' },
99-
gap: 1,
100-
}}
88+
<div
89+
className={`flex items-start gap-1 max-w-[95%] sm:max-w-[80%] ${isBot ? 'flex-row' : 'flex-row-reverse'}`}
10190
>
102-
<Avatar
103-
src={avatarSrc}
104-
alt={name}
105-
sx={{
106-
width: { xs: 28, sm: 32 },
107-
height: { xs: 28, sm: 32 },
108-
}}
109-
/>
91+
<Avatar src={avatarSrc} alt={name} className="h-7 w-7 sm:h-8 sm:w-8" />
11092
<Paper
11193
elevation={1}
94+
className="rounded-[16px_16px_4px_16px] p-1.5 sm:p-2 bg-primary-light text-primary-contrast"
11295
sx={{
113-
p: { xs: 1.5, sm: 2 },
11496
backgroundColor: 'primary.light',
11597
color: 'primary.contrastText',
116-
borderRadius: '16px 16px 4px 16px',
11798
}}
11899
>
119100
<Typography
120101
variant="caption"
121102
display="block"
122-
sx={{
123-
mb: 0.5,
124-
opacity: 0.8,
125-
fontSize: { xs: '0.7rem', sm: '0.75rem' },
126-
}}
103+
className="mb-0.5 text-[0.7rem] opacity-80 sm:text-[0.75rem]"
127104
>
128105
{name}
129106
</Typography>
130107

131108
{content && (
132109
<Typography
133-
className="prose"
110+
className="prose mb-1 text-[0.875rem] sm:text-base"
134111
variant="body2"
135-
sx={{
136-
mb: 1,
137-
fontSize: { xs: '0.875rem', sm: '1rem' },
138-
}}
139112
dangerouslySetInnerHTML={{ __html: marked(content) }}
140113
/>
141114
)}
@@ -148,19 +121,13 @@ export default class ProjectEvaluationPage extends ObservedComponent<
148121
/>
149122
)}
150123
{createdAt && (
151-
<Typography
152-
variant="caption"
153-
sx={{
154-
opacity: 0.6,
155-
fontSize: { xs: '0.65rem', sm: '0.75rem' },
156-
}}
157-
>
124+
<Typography variant="caption" className="text-[0.65rem] opacity-60 sm:text-[0.75rem]">
158125
{new Date(createdAt).toLocaleTimeString()}
159126
</Typography>
160127
)}
161128
</Paper>
162-
</Box>
163-
</Box>
129+
</div>
130+
</div>
164131
);
165132
};
166133

@@ -178,66 +145,36 @@ export default class ProjectEvaluationPage extends ObservedComponent<
178145

179146
<Container
180147
maxWidth="md"
181-
sx={{
182-
height: { xs: 'calc(100vh - 120px)', md: '85vh' },
183-
display: 'flex',
184-
flexDirection: 'column',
185-
gap: { xs: '0.5rem', sm: '1rem' },
186-
px: { xs: 0, sm: 2 },
187-
}}
148+
className="flex h-[calc(100vh-120px)] flex-col gap-2 px-0 sm:gap-4 sm:px-2 md:h-[85vh]"
188149
>
189150
<Typography
190151
component="h1"
191-
sx={{
192-
mt: { xs: 2, sm: 4, md: 20 },
193-
mb: { xs: 1, sm: 2 },
194-
fontSize: { xs: '1.5rem', sm: '2rem', md: '3rem' },
195-
fontWeight: 'bold',
196-
px: { xs: 2, sm: 0 },
197-
}}
152+
className="mb-1 mt-2 px-2 text-2xl font-bold sm:mb-2 sm:mt-4 sm:px-0 sm:text-3xl md:mt-20 md:text-5xl"
198153
>
199154
{title}
200155
</Typography>
201156
{/* Chat Messages Area */}
202-
<Box sx={{ flex: 1, overflow: 'auto', mb: 2 }}>
157+
<div className="mb-2 flex-1 overflow-auto">
203158
<ScrollList
204159
translator={i18n}
205160
store={messageStore}
206161
filter={{ project: projectId }}
207162
renderList={allItems => (
208-
<Box
209-
sx={{
210-
height: '100%',
211-
overflowY: 'auto',
212-
p: { xs: 1, sm: 2 },
213-
}}
214-
>
163+
<div className="h-full overflow-y-auto p-1 sm:p-2">
215164
{allItems.map(this.renderChatMessage)}
216-
</Box>
165+
</div>
217166
)}
218167
/>
219-
</Box>
168+
</div>
220169

221170
{/* Message Input Form */}
222171
<Paper
223172
component="form"
224173
elevation={1}
225-
sx={{
226-
p: { xs: 1.5, sm: 2 },
227-
mt: 'auto',
228-
mx: { xs: 1, sm: 0 },
229-
mb: { xs: 1, sm: 0 },
230-
}}
174+
className="mx-1 mb-1 mt-auto p-1.5 sm:mx-0 sm:mb-0 sm:p-2"
231175
onSubmit={this.handleMessageSubmit}
232176
>
233-
<Box
234-
sx={{
235-
display: 'flex',
236-
gap: 1,
237-
alignItems: 'flex-end',
238-
flexDirection: { xs: 'column', sm: 'row' },
239-
}}
240-
>
177+
<div className="flex flex-col items-end gap-1 sm:flex-row">
241178
<TextField
242179
name="content"
243180
placeholder={t('type_your_message')}
@@ -251,16 +188,12 @@ export default class ProjectEvaluationPage extends ObservedComponent<
251188
<Button
252189
type="submit"
253190
variant="contained"
254-
sx={{
255-
minWidth: { xs: '100%', sm: 'auto' },
256-
px: 2,
257-
whiteSpace: 'nowrap',
258-
}}
191+
className="min-w-full whitespace-nowrap px-2 sm:min-w-0"
259192
disabled={messageStore.uploading > 0}
260193
>
261194
{t('send')}
262195
</Button>
263-
</Box>
196+
</div>
264197
</Paper>
265198
</Container>
266199
</SessionBox>

0 commit comments

Comments
 (0)