Changeset 9d40151
- Timestamp:
- 02/25/26 20:46:23 (5 months ago)
- Branches:
- main
- Children:
- ad3c219
- Parents:
- 4f2900a
- Files:
-
- 4 edited
-
components/BuildDetailsDialog.tsx (modified) (2 diffs)
-
database/drizzle/queries/components.ts (modified) (2 diffs)
-
pages/dashboard/admin/+Page.tsx (modified) (1 diff)
-
pages/forge/+Page.tsx (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
components/BuildDetailsDialog.tsx
r4f2900a r9d40151 125 125 } 126 126 }; 127 128 const handleCloneClick = () => {129 if(!currentUser){130 window.location.href="/auth/login";131 return;132 }133 134 setCloningBuildId(details.id);135 setCloneDialogOpen(true);136 }137 127 138 128 if (!open) return null; … … 273 263 size="large" 274 264 startIcon={<AutoFixHighIcon/>} 275 onClick={handleCloneClick} 276 > 265 onClick={() => { 266 setCloningBuildId(details.id); 267 setCloneDialogOpen(true); 268 }} > 277 269 Clone & Edit 278 270 </Button> -
database/drizzle/queries/components.ts
r4f2900a r9d40151 1067 1067 ); 1068 1068 1069 //const totalPrice = buildComponents.reduce((sum, c) =>1070 //sum + (Number(c.price) * c.quantity), 01071 //);1072 1073 //await tx1074 //.update(buildsTable)1075 //.set({1076 //totalPrice: totalPrice.toFixed(2)1077 //})1078 //.where(1079 //eq(buildsTable.id, buildId)1080 //);1069 const totalPrice = buildComponents.reduce((sum, c) => 1070 sum + (Number(c.price) * c.quantity), 0 1071 ); 1072 1073 await tx 1074 .update(buildsTable) 1075 .set({ 1076 totalPrice: totalPrice.toFixed(2) 1077 }) 1078 .where( 1079 eq(buildsTable.id, buildId) 1080 ); 1081 1081 1082 1082 return buildId; … … 1151 1151 ); 1152 1152 1153 //const totalPrice = buildComponents.reduce((sum, c) =>1154 //sum + (Number(c.price) * c.quantity), 01155 //);1156 1157 //await tx1158 //.update(buildsTable)1159 //.set({1160 //totalPrice: totalPrice.toFixed(2)1161 //})1162 //.where(1163 //eq(buildsTable.id, buildId)1164 //);1153 const totalPrice = buildComponents.reduce((sum, c) => 1154 sum + (Number(c.price) * c.quantity), 0 1155 ); 1156 1157 await tx 1158 .update(buildsTable) 1159 .set({ 1160 totalPrice: totalPrice.toFixed(2) 1161 }) 1162 .where( 1163 eq(buildsTable.id, buildId) 1164 ); 1165 1165 1166 1166 return componentId; -
pages/dashboard/admin/+Page.tsx
r4f2900a r9d40151 352 352 }}> 353 353 {data.pendingBuilds.map((build: any) => ( 354 <Box key={build.id}> 354 <Box key={build.id} sx={{ 355 display: 'flex', 356 flexDirection: 'column', 357 borderRadius: 2, 358 overflow: 'hidden', 359 bgcolor: 'background.paper' 360 }}> 355 361 <BuildCard 356 362 build={build} 357 363 onClick={() => setSelectedBuildId(build.id)} 358 364 /> 359 <B ox sx={{mt: 1, display: 'flex', gap: 1, justifyContent: 'center'}}>360 <Button361 variant="contained"362 color="warning"363 size="small"364 startIcon={<BuildIcon/>}365 onClick={(e) => {366 e.stopPropagation();367 openBuildApproval(build.id, build.name);368 }}369 >370 Review371 </Button>372 </B ox>365 <Button 366 variant="contained" 367 color="warning" 368 size="small" 369 fullWidth 370 startIcon={<BuildIcon/>} 371 onClick={(e) => { 372 e.stopPropagation(); 373 openBuildApproval(build.id, build.name); 374 }} 375 sx={{borderRadius: 0}} 376 > 377 Review 378 </Button> 373 379 </Box> 374 380 ))} 381 375 382 </Box> 376 383 )} -
pages/forge/+Page.tsx
r4f2900a r9d40151 2 2 import { 3 3 Container, Paper, Typography, Box, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, 4 Button, IconButton, Avatar, TextField, Grid,Chip, CircularProgress,4 Button, IconButton, Avatar, TextField, Chip, CircularProgress, 5 5 Menu, MenuItem, ListItemIcon, Dialog, DialogTitle, DialogContent, DialogActions 6 6 } from '@mui/material'; … … 74 74 if (buildId && buildName.trim()) { 75 75 const timeoutId = setTimeout(() => { 76 saveBuildState({buildId, name: buildName.trim(), description}); 76 saveBuildState({buildId, name: buildName.trim(), description}).catch(() => { 77 }); 77 78 }, 1000); 78 79 … … 326 327 const slot = slots.find(s => s.id === slotId); 327 328 if (slot?.component) { 328 handleRemovePart(slotId); 329 handleRemovePart(slotId).catch(() => { 330 }); 329 331 } 330 332 setSlots(prev => prev.filter(s => s.id !== slotId)); … … 388 390 severity: 'error' 389 391 }); 392 return; 390 393 } finally { 391 394 setIsSubmitting(false); … … 402 405 <Paper sx={{p: 4, mb: 0, bgcolor: '#ff8201', border: '1px solid #1e1e1e', color: 'white'}}> 403 406 <Typography variant="h4" align="center" fontWeight="bold">Forge Your Machine</Typography> 404 <Grid container spacing={2} justifyContent="center" sx={{mt: 2}}> 405 <Grid item xs={12} md={6}> 406 <TextField 407 fullWidth 408 label="Build Name *" 409 value={buildName} 410 onChange={e => setBuildName(e.target.value)} 411 sx={{bgcolor: '#1e1e1e', borderRadius: 1, color: 'white'}} 412 /> 413 </Grid> 414 </Grid> 407 <Box sx={{display: 'flex', justifyContent: 'center', mt: 2}}> 408 <TextField 409 label="Build Name *" 410 value={buildName} 411 onChange={e => setBuildName(e.target.value)} 412 sx={{bgcolor: '#1e1e1e', textAlign: 'center', borderRadius: 1, color: 'white', width: '200px'}} 413 /> 414 </Box> 415 415 416 </Paper> 416 417 … … 580 581 sx: { 581 582 position: 'absolute', 582 top: ' 30%',583 top: '46%', 583 584 // left: '50%', 584 585 // transform: 'translate(50%, +50%)',
Note:
See TracChangeset
for help on using the changeset viewer.
