- File:
-
- 1 edited
-
components/BuildDetailsDialog.tsx (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
components/BuildDetailsDialog.tsx
rf727252 r41a2f81 1 1 import React, {useEffect, useState} from 'react'; 2 2 import { 3 Dialog, DialogTitle, DialogContent, DialogActions, Button, Box, Typography,3 Dialog, DialogTitle, DialogContent, DialogActions, Button, Grid, Box, Typography, 4 4 IconButton, Tab, Tabs, Table, TableBody, TableCell, TableRow, Rating, TextField, Avatar, Chip, Alert 5 5 } from '@mui/material'; … … 34 34 const [ratingVal, setRatingVal] = useState(5); 35 35 36 // Main details fetch 36 37 useEffect(() => { 37 if (open && buildId !== null ) {38 if (open && buildId !== null && typeof buildId === 'number') { 38 39 setLoading(true); 39 40 setReviewText(""); … … 51 52 52 53 useEffect(() => { 53 if (open && buildId !== null ) {54 if (open && buildId !== null && typeof buildId === 'number') { 54 55 onGetBuildState({buildId}) 55 56 .then(state => { … … 62 63 }, [open, buildId]); 63 64 64 useEffect(() => {65 if (open) {66 setTabIndex(0);67 }68 }, [open, buildId]);69 70 71 65 const handleFavorite = async () => { 72 66 if (!currentUser || buildId === null) return alert("Please login to favorite builds."); … … 109 103 return ( 110 104 <> 111 <Dialog open={open} onClose={onClose} maxWidth="md" fullWidth scroll=" body">105 <Dialog open={open} onClose={onClose} maxWidth="md" fullWidth scroll="paper"> 112 106 {loading || !details ? ( 113 107 <Box sx={{p: 5, textAlign: 'center'}}>Loading Forge Schematics...</Box> … … 152 146 <Box sx={{p: 3}}> 153 147 {tabIndex === 0 && ( 154 <Box 155 sx={{ 156 display: 'grid', 157 gridTemplateColumns: { 158 xs: '1fr', 159 md: '2fr 1fr' 160 }, 161 gap: 2, 162 width: '100%' 163 }} 164 > 165 <Box> 148 <Grid container spacing={2}> 149 <Grid item xs={12} md={8}> 166 150 <Table size="small"> 167 151 <TableBody> … … 209 193 </TableBody> 210 194 </Table> 211 </ Box>212 213 < Box>195 </Grid> 196 197 <Grid item xs={12} md={4}> 214 198 <Box sx={{bgcolor: '#424343', p: 2, borderRadius: 2, mb: 2}}> 215 <Typography color="primary.main" gutterBottom fontWeight="bold"> 216 Builder's Notes 217 </Typography> 199 <Typography color="primary.main" gutterBottom fontWeight="bold">Builder's 200 Notes</Typography> 218 201 <Typography color="primary.main" variant="body2" 219 202 sx={{fontStyle: 'italic'}}> … … 260 243 </Button> 261 244 </Box> 262 </ Box>263 </ Box>245 </Grid> 246 </Grid> 264 247 )} 265 248 … … 330 313 ))} 331 314 {details.reviews.length === 0 && ( 332 <Typography color="text.secondary" align="center"> 333 No reviews yet. Be the first! 334 </Typography> 315 <Typography color="text.secondary" align="center">No reviews yet. Be the 316 first!</Typography> 335 317 )} 336 318 </Box>
Note:
See TracChangeset
for help on using the changeset viewer.
