Changeset 87b79bc for pages/dashboard
- Timestamp:
- 01/24/26 21:18:40 (6 months ago)
- Branches:
- main
- Children:
- a744c90
- Parents:
- ad211d1
- File:
-
- 1 edited
-
pages/dashboard/admin/+Page.tsx (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pages/dashboard/admin/+Page.tsx
rad211d1 r87b79bc 51 51 const [adminComment, setAdminComment] = useState(""); 52 52 53 const [createComponentDialog, setCreateComponentDialog] = useState<{ 54 open: boolean; 55 suggestion: any | null; 56 }>({open: false, suggestion: null}); 57 53 58 const loadData = () => { 54 59 setLoading(true); … … 143 148 if (loading) { 144 149 return ( 145 <Container maxWidth="xl" sx={{mt: 4, mb: 10, display: 'flex', justifyContent: 'center', alignItems: 'center', minHeight: '50vh'}}> 146 <CircularProgress /> 150 <Container maxWidth="xl" sx={{ 151 mt: 4, 152 mb: 10, 153 display: 'flex', 154 justifyContent: 'center', 155 alignItems: 'center', 156 minHeight: '50vh' 157 }}> 158 <CircularProgress/> 147 159 </Container> 148 160 ); … … 196 208 size="large" 197 209 fullWidth 198 startIcon={<BuildIcon />}210 startIcon={<BuildIcon/>} 199 211 onClick={() => setAddDialogOpen(true)} 200 sx={{ mb: 2}}212 sx={{mb: 2}} 201 213 > 202 214 Add Component … … 213 225 <MemoryIcon color="secondary" sx={{mr: 1}}/> 214 226 <Typography variant="h6" fontWeight="bold"> 215 Suggested Components ({data.componentSuggestions?.length || 0})227 Component Suggestions ({data.componentSuggestions?.length || 0}) 216 228 </Typography> 217 229 </Box> 218 230 219 231 {data.componentSuggestions?.length === 0 ? ( 220 <Typography color="text.secondary">No pendingsuggestions.</Typography>232 <Typography color="text.secondary">No suggestions.</Typography> 221 233 ) : ( 222 234 <Table size="small"> … … 226 238 <TableCell>Type</TableCell> 227 239 <TableCell>User</TableCell> 240 <TableCell>Status</TableCell> 228 241 <TableCell align="right">Actions</TableCell> 229 242 </TableRow> … … 245 258 <TableCell>{sug.componentType?.toUpperCase()}</TableCell> 246 259 <TableCell>{sug.userId}</TableCell> 260 <TableCell> 261 <Chip 262 label={sug.status || 'pending'} 263 size="small" 264 color={ 265 sug.status === 'approved' ? 'success' : 266 sug.status === 'rejected' ? 'error' : 267 'default' 268 } 269 /> 270 </TableCell> 247 271 <TableCell align="right"> 248 <IconButton 249 size="small" 250 color="success" 251 onClick={() => openSuggestionReview(sug.id, 'approved')} 252 > 253 <CheckCircleIcon/> 254 </IconButton> 255 <IconButton 256 size="small" 257 color="error" 258 onClick={() => openSuggestionReview(sug.id, 'rejected')} 259 > 260 <CancelIcon/> 261 </IconButton> 272 {sug.status === 'pending' ? ( 273 <> 274 <IconButton 275 size="small" 276 color="success" 277 onClick={() => openSuggestionReview(sug.id, 'approved')} 278 > 279 <CheckCircleIcon/> 280 </IconButton> 281 <IconButton 282 size="small" 283 color="error" 284 onClick={() => openSuggestionReview(sug.id, 'rejected')} 285 > 286 <CancelIcon/> 287 </IconButton> 288 </> 289 ) : sug.status === 'approved' ? ( 290 <Button 291 size="small" 292 variant="contained" 293 color="warning" 294 startIcon={<AddIcon/>} 295 onClick={() => setCreateComponentDialog({ 296 open: true, 297 suggestion: sug 298 })} 299 > 300 Create 301 </Button> 302 ) : ( 303 <Typography variant="caption" color="text.secondary"> 304 {sug.adminComment || 'Rejected'} 305 </Typography> 306 )} 262 307 </TableCell> 263 308 </TableRow> … … 299 344 color="warning" 300 345 size="small" 301 startIcon={<BuildIcon />}346 startIcon={<BuildIcon/>} 302 347 onClick={(e) => { 303 348 e.stopPropagation(); … … 337 382 color="error" 338 383 size="small" 339 startIcon={<DeleteIcon />}384 startIcon={<DeleteIcon/>} 340 385 onClick={(e) => { 341 386 e.stopPropagation(); … … 358 403 </Grid> 359 404 360 <Dialog open={suggestionDialog.open} onClose={() => setSuggestionDialog({...suggestionDialog, open: false})}> 405 <Dialog open={suggestionDialog.open} 406 onClose={() => setSuggestionDialog({...suggestionDialog, open: false})}> 361 407 <DialogTitle>Review Component Suggestion</DialogTitle> 362 408 <DialogContent> … … 369 415 value={adminComment} 370 416 onChange={(e) => setAdminComment(e.target.value)} 371 sx={{ mt: 2}}417 sx={{mt: 2}} 372 418 /> 373 419 </DialogContent> … … 448 494 color="error" 449 495 disabled={deleteLoading} 450 startIcon={deleteLoading ? <CircularProgress size={20}/> : <DeleteIcon />}496 startIcon={deleteLoading ? <CircularProgress size={20}/> : <DeleteIcon/>} 451 497 > 452 498 {deleteLoading ? 'Deleting...' : 'Delete Build'} … … 471 517 }} 472 518 /> 519 520 <AddComponentDialog 521 open={createComponentDialog.open} 522 onClose={() => setCreateComponentDialog({ open: false, suggestion: null })} 523 onSuccess={() => { 524 loadData(); 525 setCreateComponentDialog({ open: false, suggestion: null }); 526 }} 527 prefillData={createComponentDialog.suggestion ? { 528 type: createComponentDialog.suggestion.componentType, 529 suggestionLink: createComponentDialog.suggestion.link, 530 suggestionDescription: createComponentDialog.suggestion.description 531 } : undefined} 532 /> 473 533 </Container> 474 534 );
Note:
See TracChangeset
for help on using the changeset viewer.
