Changeset e599341 for pages/completed-builds
- Timestamp:
- 12/28/25 00:07:22 (7 months ago)
- Branches:
- main
- Children:
- 9c87509
- Parents:
- f7c0b0d
- File:
-
- 1 edited
-
pages/completed-builds/+Page.tsx (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pages/completed-builds/+Page.tsx
rf7c0b0d re599341 1 1 import React, { useEffect, useState } from 'react'; 2 2 import { 3 Container, Grid,Box, Typography, TextField, MenuItem, Select,4 Slider, Button, Paper, InputAdornment 3 Container, Box, Typography, TextField, MenuItem, Select, 4 Slider, Button, Paper, InputAdornment, CircularProgress 5 5 } from '@mui/material'; 6 6 import SearchIcon from '@mui/icons-material/Search'; … … 9 9 import BuildCard from '../../components/BuildCard'; 10 10 import BuildDetailsDialog from '../../components/BuildDetailsDialog'; 11 12 11 import { onGetApprovedBuilds, onCloneBuild, onGetAuthState } from '../+Layout.telefunc'; 13 12 … … 27 26 const [userData, data] = await Promise.all([ 28 27 onGetAuthState(), 29 onGetApprovedBuilds({ q: searchQuery})28 onGetApprovedBuilds({q: searchQuery}) 30 29 ]); 31 30 setUserId(userData.userId); … … 58 57 59 58 setBuilds(sortedData); 59 } catch (e) { 60 console.error("Failed to load builds", e); 60 61 } finally { 61 62 setLoading(false); … … 65 66 useEffect(() => { 66 67 loadBuilds(); 67 }, [sortBy, priceRange, searchQuery]);68 69 useEffect(() => {70 loadBuilds();71 68 }, [sortBy, searchQuery]); 72 69 … … 74 71 if (!userId) return alert("Please login to clone builds!"); 75 72 if (confirm(`Clone this build?`)) { 76 await onCloneBuild({ buildId});73 await onCloneBuild({buildId}); 77 74 alert("Build cloned!"); 78 75 setSelectedBuildId(null); … … 81 78 82 79 return ( 83 <Container maxWidth= "xl" sx={{ mt: 4, mb: 10}}>80 <Container maxWidth={false} sx={{ mt: 4, mb: 10, px: { xs: 2, md: 4 } }}> 84 81 <Typography variant="h4" fontWeight="bold" gutterBottom>Completed Builds</Typography> 85 82 <Typography color="text.secondary" sx={{ mb: 4 }}> … … 87 84 </Typography> 88 85 89 <Grid container spacing={4}> 90 <Grid item xs={12} md={3}> 86 <Box sx={{ display: 'flex', flexDirection: { xs: 'column', md: 'row' }, gap: 4 }}> 87 88 <Box sx={{ 89 width: { xs: '100%', md: '280px' }, 90 flexShrink: 0 91 }}> 91 92 <Paper variant="outlined" sx={{ p: 3, position: 'sticky', top: 20 }}> 92 93 <Box sx={{ display: 'flex', alignItems: 'center', mb: 2 }}> … … 127 128 </Button> 128 129 </Paper> 129 </Grid> 130 131 <Grid item xs={12} md={9}> 132 {/* Toolbar */} 130 </Box> 131 132 <Box sx={{ flexGrow: 1 }}> 133 133 <Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 3 }}> 134 134 <Typography fontWeight="bold">{builds.length} Builds Found</Typography> … … 152 152 153 153 {loading ? ( 154 <Box sx={{ p: 5, textAlign: 'center' }}>Loading...</Box> 154 <Box sx={{ p: 5, textAlign: 'center' }}> 155 <CircularProgress /> 156 </Box> 155 157 ) : ( 156 <Grid container spacing={3}> 158 <Box 159 sx={{ 160 display: 'grid', 161 gridTemplateColumns: { 162 xs: '1fr', 163 sm: 'repeat(2, 1fr)', 164 md: 'repeat(3, 1fr)', 165 lg: 'repeat(4, 1fr)', 166 xl: 'repeat(5, 1fr)' 167 }, 168 gap: 3, 169 width: '100%' 170 }} 171 > 157 172 {builds.map((build) => ( 158 <Grid item xs={12} sm={6} lg={4} key={build.id} sx={{ display: 'flex' }}> 159 <Box sx={{ width: '100%' }}> 160 <BuildCard 161 build={build} 162 onClick={() => setSelectedBuildId(build.id)} 163 /> 164 </Box> 165 </Grid> 173 <BuildCard 174 key={build.id} 175 build={build} 176 onClick={() => setSelectedBuildId(build.id)} 177 /> 166 178 ))} 167 179 {builds.length === 0 && ( 168 <Grid item xs={12}> 169 <Box sx={{ p: 5, textAlign: 'center', bgcolor: '#f5f5f5', borderRadius: 2 }}> 170 <Typography>No builds found matching your filters.</Typography> 171 </Box> 172 </Grid> 180 <Box sx={{ gridColumn: '1 / -1', p: 5, textAlign: 'center', bgcolor: '#f5f5f5', borderRadius: 2 }}> 181 <Typography>No builds found matching your filters.</Typography> 182 </Box> 173 183 )} 174 </ Grid>184 </Box> 175 185 )} 176 </Grid> 177 </Grid> 178 186 </Box> 187 </Box> 188 189 {/* @ts-ignore */} 179 190 <BuildDetailsDialog 180 191 open={!!selectedBuildId} … … 186 197 </Container> 187 198 ); 199 188 200 } 189
Note:
See TracChangeset
for help on using the changeset viewer.
