Changeset d07d68c for components/BuildDetailsDialog.tsx
- Timestamp:
- 02/19/26 23:17:54 (5 months ago)
- Branches:
- main
- Children:
- 4f2900a
- Parents:
- 6270fa4
- File:
-
- 1 edited
-
components/BuildDetailsDialog.tsx (modified) (6 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 );
Note:
See TracChangeset
for help on using the changeset viewer.
