Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • components/BuildDetailsDialog.tsx

    rf727252 r41a2f81  
    11import React, {useEffect, useState} from 'react';
    22import {
    3     Dialog, DialogTitle, DialogContent, DialogActions, Button, Box, Typography,
     3    Dialog, DialogTitle, DialogContent, DialogActions, Button, Grid, Box, Typography,
    44    IconButton, Tab, Tabs, Table, TableBody, TableCell, TableRow, Rating, TextField, Avatar, Chip, Alert
    55} from '@mui/material';
     
    3434    const [ratingVal, setRatingVal] = useState(5);
    3535
     36    // Main details fetch
    3637    useEffect(() => {
    37         if (open && buildId !== null) {
     38        if (open && buildId !== null && typeof buildId === 'number') {
    3839            setLoading(true);
    3940            setReviewText("");
     
    5152
    5253    useEffect(() => {
    53         if (open && buildId !== null) {
     54        if (open && buildId !== null && typeof buildId === 'number') {
    5455            onGetBuildState({buildId})
    5556                .then(state => {
     
    6263    }, [open, buildId]);
    6364
    64     useEffect(() => {
    65         if (open) {
    66             setTabIndex(0);
    67         }
    68     }, [open, buildId]);
    69 
    70 
    7165    const handleFavorite = async () => {
    7266        if (!currentUser || buildId === null) return alert("Please login to favorite builds.");
     
    109103    return (
    110104        <>
    111             <Dialog open={open} onClose={onClose} maxWidth="md" fullWidth scroll="body">
     105            <Dialog open={open} onClose={onClose} maxWidth="md" fullWidth scroll="paper">
    112106                {loading || !details ? (
    113107                    <Box sx={{p: 5, textAlign: 'center'}}>Loading Forge Schematics...</Box>
     
    152146                            <Box sx={{p: 3}}>
    153147                                {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}>
    166150                                            <Table size="small">
    167151                                                <TableBody>
     
    209193                                                </TableBody>
    210194                                            </Table>
    211                                         </Box>
    212 
    213                                         <Box>
     195                                        </Grid>
     196
     197                                        <Grid item xs={12} md={4}>
    214198                                            <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>
    218201                                                <Typography color="primary.main" variant="body2"
    219202                                                            sx={{fontStyle: 'italic'}}>
     
    260243                                                </Button>
    261244                                            </Box>
    262                                         </Box>
    263                                     </Box>
     245                                        </Grid>
     246                                    </Grid>
    264247                                )}
    265248
     
    330313                                            ))}
    331314                                            {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>
    335317                                            )}
    336318                                        </Box>
Note: See TracChangeset for help on using the changeset viewer.