Changes in pages/dashboard/admin/+Page.tsx [87b79bc:958bc89]
- File:
-
- 1 edited
-
pages/dashboard/admin/+Page.tsx (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pages/dashboard/admin/+Page.tsx
r87b79bc r958bc89 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 58 53 const loadData = () => { 59 54 setLoading(true); … … 148 143 if (loading) { 149 144 return ( 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/> 145 <Container maxWidth="xl" sx={{mt: 4, mb: 10, display: 'flex', justifyContent: 'center', alignItems: 'center', minHeight: '50vh'}}> 146 <CircularProgress /> 159 147 </Container> 160 148 ); … … 208 196 size="large" 209 197 fullWidth 210 startIcon={<BuildIcon />}198 startIcon={<BuildIcon />} 211 199 onClick={() => setAddDialogOpen(true)} 212 sx={{ mb: 2}}200 sx={{ mb: 2 }} 213 201 > 214 202 Add Component … … 225 213 <MemoryIcon color="secondary" sx={{mr: 1}}/> 226 214 <Typography variant="h6" fontWeight="bold"> 227 Component Suggestions ({data.componentSuggestions?.length || 0})215 Suggested Components ({data.componentSuggestions?.length || 0}) 228 216 </Typography> 229 217 </Box> 230 218 231 219 {data.componentSuggestions?.length === 0 ? ( 232 <Typography color="text.secondary">No suggestions.</Typography>220 <Typography color="text.secondary">No pending suggestions.</Typography> 233 221 ) : ( 234 222 <Table size="small"> … … 238 226 <TableCell>Type</TableCell> 239 227 <TableCell>User</TableCell> 240 <TableCell>Status</TableCell>241 228 <TableCell align="right">Actions</TableCell> 242 229 </TableRow> … … 258 245 <TableCell>{sug.componentType?.toUpperCase()}</TableCell> 259 246 <TableCell>{sug.userId}</TableCell> 260 <TableCell> 261 <Chip 262 label={sug.status || 'pending'} 247 <TableCell align="right"> 248 <IconButton 263 249 size="small" 264 color={ 265 sug.status === 'approved' ? 'success' : 266 sug.status === 'rejected' ? 'error' : 267 'default' 268 } 269 /> 270 </TableCell> 271 <TableCell align="right"> 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 )} 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> 307 262 </TableCell> 308 263 </TableRow> … … 344 299 color="warning" 345 300 size="small" 346 startIcon={<BuildIcon />}301 startIcon={<BuildIcon />} 347 302 onClick={(e) => { 348 303 e.stopPropagation(); … … 382 337 color="error" 383 338 size="small" 384 startIcon={<DeleteIcon />}339 startIcon={<DeleteIcon />} 385 340 onClick={(e) => { 386 341 e.stopPropagation(); … … 403 358 </Grid> 404 359 405 <Dialog open={suggestionDialog.open} 406 onClose={() => setSuggestionDialog({...suggestionDialog, open: false})}> 360 <Dialog open={suggestionDialog.open} onClose={() => setSuggestionDialog({...suggestionDialog, open: false})}> 407 361 <DialogTitle>Review Component Suggestion</DialogTitle> 408 362 <DialogContent> … … 415 369 value={adminComment} 416 370 onChange={(e) => setAdminComment(e.target.value)} 417 sx={{ mt: 2}}371 sx={{ mt: 2 }} 418 372 /> 419 373 </DialogContent> … … 494 448 color="error" 495 449 disabled={deleteLoading} 496 startIcon={deleteLoading ? <CircularProgress size={20}/> : <DeleteIcon />}450 startIcon={deleteLoading ? <CircularProgress size={20}/> : <DeleteIcon />} 497 451 > 498 452 {deleteLoading ? 'Deleting...' : 'Delete Build'} … … 517 471 }} 518 472 /> 519 520 <AddComponentDialog521 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.description531 } : undefined}532 />533 473 </Container> 534 474 );
Note:
See TracChangeset
for help on using the changeset viewer.
