Changeset d07d68c
- Timestamp:
- 02/19/26 23:17:54 (5 months ago)
- Branches:
- main
- Children:
- 4f2900a
- Parents:
- 6270fa4
- Files:
-
- 4 edited
-
components/BuildDetailsDialog.tsx (modified) (6 diffs)
-
components/ComponentDialog.tsx (modified) (1 diff)
-
pages/dashboard/admin/+Page.tsx (modified) (1 diff)
-
pages/forge/+Page.tsx (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
components/BuildDetailsDialog.tsx
r6270fa4 rd07d68c 2 2 import { 3 3 Dialog, DialogTitle, DialogContent, DialogActions, Button, Box, Typography, 4 IconButton, Tab, Tabs, Table, TableBody, TableCell, TableRow, Rating, TextField, Avatar, Chip, Alert 4 IconButton, Tab, Tabs, Table, TableBody, TableCell, TableRow, Rating, TextField, Avatar, Chip, Alert, Snackbar 5 5 } from '@mui/material'; 6 6 import CloseIcon from '@mui/icons-material/Close'; … … 34 34 const [ratingVal, setRatingVal] = useState(5); 35 35 36 const [snackbar, setSnackbar] = useState<{ 37 open: boolean; 38 message: string; 39 severity: 'error' | 'warning' | 'info' | 'success'; 40 }>({ 41 open: false, 42 message: '', 43 severity: 'warning' 44 }); 45 36 46 useEffect(() => { 37 47 if (open && buildId !== null) { … … 95 105 if (!cloningBuildId) return; 96 106 107 if(!currentUser){ 108 window.location.href="/auth/login"; 109 return; 110 } 111 97 112 try { 98 113 const newBuildId = await onCloneBuild({buildId: cloningBuildId}); … … 101 116 setCloningBuildId(null); 102 117 } catch (e) { 103 alert("Failed to clone build. Please try again."); 118 // alert("Failed to clone build. Please try again."); 119 setCloneDialogOpen(false); 120 setSnackbar({ 121 open: true, 122 message: 'Failed to clone build. Please try again!', 123 severity: 'error' 124 }) 104 125 } 105 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 } 106 137 107 138 if (!open) return null; … … 242 273 size="large" 243 274 startIcon={<AutoFixHighIcon/>} 244 onClick={() => { 245 setCloningBuildId(details.id); 246 setCloneDialogOpen(true); 247 }} 275 onClick={handleCloneClick} 248 276 > 249 277 Clone & Edit … … 362 390 </DialogActions> 363 391 </Dialog> 392 <Snackbar 393 open={snackbar.open} 394 autoHideDuration={5000} 395 onClose={() => setSnackbar(prev => ({...prev, open: false}))} 396 anchorOrigin={{vertical: 'bottom', horizontal: 'center'}} 397 > 398 <Alert 399 onClose={() => setSnackbar(prev => ({...prev, open: false}))} 400 severity={snackbar.severity} 401 variant="filled" 402 sx={{width: '100%'}} 403 > 404 {snackbar.message} 405 </Alert> 406 </Snackbar> 364 407 </> 365 408 ); -
components/ComponentDialog.tsx
r6270fa4 rd07d68c 308 308 Browsing: 309 309 </Box> 310 <b> {category === 'gpu' ? 'GRAPHICS CARDS' : category === 'memory_card' ? 'STORAGE EXPANSION CARDS' : category?.toUpperCase()}</b> 310 <b> { 311 category === 'gpu' ? 'GRAPHICS CARDS' 312 : category === 'memory_card' ? 'STORAGE EXPANSION CARDS' 313 : category === 'power_supply' ? 'POWER SUPPLIES' 314 : category === 'network_card' ? 'NETWORK CARDS' 315 : category === 'network_adapters' ? 'NETWORK ADAPTERS' 316 : category === 'sound_card' ? 'SOUND CARDS' 317 : category === 'optical_drive' ? 'OPTICAL DRIVES' 318 : category?.toUpperCase()}</b> 311 319 {mode === 'forge' && currentBuildId && ( 312 320 <Typography -
pages/dashboard/admin/+Page.tsx
r6270fa4 rd07d68c 97 97 setApprovalLoading(true); 98 98 try { 99 await onSetBuildApprovalStatus({buildId: buildApprovalDialog.buildId, isApproved: false}); 99 await onSetBuildApprovalStatus({ 100 buildId: buildApprovalDialog.buildId, 101 isApproved: false, 102 }); 100 103 setBuildApprovalDialog({open: false, buildId: null, buildName: ''}); 101 104 loadData(); 102 105 } catch (e) { 106 console.error("Reject error:", e); // 🔧 add this 103 107 alert("Reject failed"); 104 108 } finally { -
pages/forge/+Page.tsx
r6270fa4 rd07d68c 491 491 492 492 <TableCell align="right" width="15%" sx={{verticalAlign: 'top', pt: 2}}> 493 {slot.component && ( 494 <Box sx={{ 495 display: 'flex', 496 gap: 1, 497 justifyContent: 'flex-end', 498 alignItems: 'center' 499 }}> 500 {(slot.type === 'memory' || slot.type === 'storage') && ( 501 <> 502 <IconButton 503 size="small" 504 color="primary" 505 onClick={() => handleDecrementComponent(slot.id)} 506 disabled={(slot.component.quantity || 1) <= 1} 507 sx={{ 508 bgcolor: 'action.hover', 509 '&:disabled': {bgcolor: 'action.disabledBackground'} 510 }} 511 > 512 <RemoveIcon/> 513 </IconButton> 514 515 <Typography 516 variant="body2" 517 sx={{ 518 minWidth: '20px', 519 textAlign: 'center', 520 fontWeight: 'bold' 521 }} 522 > 523 {slot.component.quantity || 1} 524 </Typography> 525 526 <IconButton 527 size="small" 528 color="primary" 529 onClick={() => handleIncrementComponent(slot.id)} 530 sx={{bgcolor: 'action.hover'}} 531 > 532 <AddIcon/> 533 </IconButton> 534 </> 535 )} 536 493 <Box sx={{ 494 display: 'flex', 495 gap: 1, 496 justifyContent: 'flex-end', 497 alignItems: 'center' 498 }}> 499 {slot.component && ( 500 <> 501 {(slot.type === 'memory' || slot.type === 'storage') && ( 502 <> 503 <IconButton 504 size="small" 505 color="primary" 506 onClick={() => handleDecrementComponent(slot.id)} 507 disabled={(slot.component.quantity || 1) <= 1} 508 sx={{ 509 bgcolor: 'action.hover', 510 '&:disabled': {bgcolor: 'action.disabledBackground'} 511 }} 512 > 513 <RemoveIcon/> 514 </IconButton> 515 516 <Typography 517 variant="body2" 518 sx={{ 519 minWidth: '20px', 520 textAlign: 'center', 521 fontWeight: 'bold' 522 }} 523 > 524 {slot.component.quantity || 1} 525 </Typography> 526 527 <IconButton 528 size="small" 529 color="primary" 530 onClick={() => handleIncrementComponent(slot.id)} 531 sx={{bgcolor: 'action.hover'}} 532 > 533 <AddIcon/> 534 </IconButton> 535 </> 536 )} 537 538 <IconButton 539 color="error" 540 onClick={() => handleRemovePart(slot.id)} 541 > 542 <DeleteIcon/> 543 </IconButton> 544 </> 545 )} 546 547 {!slot.required && ( 537 548 <IconButton 538 color=" error"539 onClick={() => handle RemovePart(slot.id)}549 color="warning" 550 onClick={() => handleDeleteSlot(slot.id)} 540 551 > 541 < DeleteIcon/>552 <CloseIcon/> 542 553 </IconButton> 543 544 {!slot.required && ( 545 <IconButton 546 color="warning" 547 onClick={() => handleDeleteSlot(slot.id)} 548 > 549 <CloseIcon/> 550 </IconButton> 551 )} 552 </Box> 553 )} 554 )} 555 </Box> 554 556 </TableCell> 555 557 </TableRow> … … 631 633 disabled={isSubmitting} 632 634 > 633 {isSubmitting ? <CircularProgress size={24}/> : 'S ubmit Build For Review'}635 {isSubmitting ? <CircularProgress size={24}/> : 'Save Build'} 634 636 </Button> 635 637 </Box>
Note:
See TracChangeset
for help on using the changeset viewer.
