Changeset f727252
- Timestamp:
- 02/10/26 01:23:31 (5 months ago)
- Branches:
- main
- Children:
- 546a194
- Parents:
- b348db4
- Files:
-
- 5 edited
-
components/BuildDetailsDialog.tsx (modified) (9 diffs)
-
components/ComponentDetailsDialog.tsx (modified) (9 diffs)
-
components/ComponentDialog.tsx (modified) (2 diffs)
-
components/Navbar.tsx (modified) (1 diff)
-
pages/index/+Page.tsx (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
components/BuildDetailsDialog.tsx
rb348db4 rf727252 1 1 import React, {useEffect, useState} from 'react'; 2 2 import { 3 Dialog, DialogTitle, DialogContent, DialogActions, Button, Grid,Box, Typography,3 Dialog, DialogTitle, DialogContent, DialogActions, Button, 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 fetch37 36 useEffect(() => { 38 if (open && buildId !== null && typeof buildId === 'number') {37 if (open && buildId !== null) { 39 38 setLoading(true); 40 39 setReviewText(""); … … 52 51 53 52 useEffect(() => { 54 if (open && buildId !== null && typeof buildId === 'number') {53 if (open && buildId !== null) { 55 54 onGetBuildState({buildId}) 56 55 .then(state => { … … 63 62 }, [open, buildId]); 64 63 64 useEffect(() => { 65 if (open) { 66 setTabIndex(0); 67 } 68 }, [open, buildId]); 69 70 65 71 const handleFavorite = async () => { 66 72 if (!currentUser || buildId === null) return alert("Please login to favorite builds."); … … 103 109 return ( 104 110 <> 105 <Dialog open={open} onClose={onClose} maxWidth="md" fullWidth scroll=" paper">111 <Dialog open={open} onClose={onClose} maxWidth="md" fullWidth scroll="body"> 106 112 {loading || !details ? ( 107 113 <Box sx={{p: 5, textAlign: 'center'}}>Loading Forge Schematics...</Box> … … 146 152 <Box sx={{p: 3}}> 147 153 {tabIndex === 0 && ( 148 <Grid container spacing={2}> 149 <Grid item xs={12} md={8}> 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> 150 166 <Table size="small"> 151 167 <TableBody> … … 193 209 </TableBody> 194 210 </Table> 195 </ Grid>196 197 < Grid item xs={12} md={4}>211 </Box> 212 213 <Box> 198 214 <Box sx={{bgcolor: '#424343', p: 2, borderRadius: 2, mb: 2}}> 199 <Typography color="primary.main" gutterBottom fontWeight="bold">Builder's 200 Notes</Typography> 215 <Typography color="primary.main" gutterBottom fontWeight="bold"> 216 Builder's Notes 217 </Typography> 201 218 <Typography color="primary.main" variant="body2" 202 219 sx={{fontStyle: 'italic'}}> … … 243 260 </Button> 244 261 </Box> 245 </ Grid>246 </ Grid>262 </Box> 263 </Box> 247 264 )} 248 265 … … 313 330 ))} 314 331 {details.reviews.length === 0 && ( 315 <Typography color="text.secondary" align="center">No reviews yet. Be the 316 first!</Typography> 332 <Typography color="text.secondary" align="center"> 333 No reviews yet. Be the first! 334 </Typography> 317 335 )} 318 336 </Box> -
components/ComponentDetailsDialog.tsx
rb348db4 rf727252 2 2 import { 3 3 Dialog, DialogTitle, DialogContent, DialogActions, Button, 4 Typography, Box, Grid,Chip, CircularProgress, IconButton,4 Typography, Box, Chip, CircularProgress, IconButton, 5 5 Table, TableBody, TableCell, TableContainer, TableRow, Paper 6 6 } from '@mui/material'; … … 92 92 open={open} 93 93 onClose={onClose} 94 maxWidth="lg" 95 // fullWidth 94 maxWidth="md" 95 fullWidth 96 scroll="body" 96 97 sx={{zIndex: 1400}} 97 98 > … … 116 117 </DialogTitle> 117 118 118 <DialogContent dividers> 119 <DialogContent 120 sx={{ 121 p: 1, 122 overflow: 'visible' 123 }} 124 > 119 125 {loading ? ( 120 126 <Box sx={{display: 'flex', justifyContent: 'center', p: 5}}> … … 122 128 </Box> 123 129 ) : ( 124 <Grid container spacing={4}> 125 <Grid item xs={12} md={4} sx={{display: 'flex', flexDirection: 'column', alignItems: 'center'}}> 130 <Box 131 sx={{ 132 display: 'grid', 133 gridTemplateColumns: { 134 xs: '1fr', 135 md: '1fr 1fr' 136 }, 137 gap: 4, 138 width: '100%' 139 }} 140 > 141 <Box sx={{display: 'flex', flexDirection: 'column', alignItems: 'center'}}> 126 142 <Box 127 143 component="img" 128 // src={`https://placehold.co/400x400?text=${encodeURIComponent(displayData.name)}`}129 144 src={displayData.imgUrl} 130 145 alt={displayData.name} … … 133 148 maxHeight: 300, 134 149 objectFit: 'contain', 135 mb: 2, 136 // border: '1px solid #eee', 137 // borderRadius: 2, 138 p: 2 150 mb: 1, 151 mt: 7, 152 p: 1 139 153 }} 140 154 /> … … 144 158 sx={{fontWeight: 'bold'}} 145 159 /> 146 </Grid> 147 148 <Grid item xs={12} md={8}> 149 <Typography variant="subtitle1" fontWeight="bold" gutterBottom 150 sx={{borderBottom: '2px solid #ff8201', display: 'inline-block', mb: 0.5}}> 160 </Box> 161 162 <Box sx={{ 163 display: 'flex', 164 flexDirection: 'column', 165 alignItems: 'center', 166 width: '70%' 167 }}> 168 <Typography 169 variant="subtitle1" 170 fontWeight="bold" 171 gutterBottom 172 sx={{ 173 borderBottom: '2px solid #ff8201', 174 mb: 1, 175 mt: 1, 176 textAlign: 'center', 177 width: '100%' 178 }} 179 > 151 180 Technical Specifications 152 181 </Typography> 153 182 154 <TableContainer component={Paper} variant="outlined"> 155 <Table size="small"> 183 <TableContainer 184 component={Paper} 185 variant="outlined" 186 sx={{ 187 maxWidth: '100%', 188 width: '100%' 189 }} 190 > 191 <Table size="medium"> 156 192 <TableBody> 157 193 <TableRow> 158 <TableCell component="th" scope="row" 159 sx={{fontWeight: 'bold', width: '30%', bgcolor: '#1e1e1e'}}> 194 <TableCell 195 component="th" 196 scope="row" 197 sx={{ 198 fontWeight: 'bold', 199 width: '50%', 200 bgcolor: '#1e1e1e', 201 textAlign: 'center', 202 px: 2 203 }} 204 > 160 205 Brand 161 206 </TableCell> 162 <TableCell>{displayData.brand}</TableCell> 207 <TableCell sx={{ 208 textAlign: 'center', 209 px: 2, 210 width: '50%' 211 }}> 212 {displayData.brand} 213 </TableCell> 163 214 </TableRow> 164 215 … … 168 219 return ( 169 220 <TableRow key={key}> 170 <TableCell component="th" scope="row" sx={{ 171 fontWeight: 'bold', 172 width: '30%', 173 bgcolor: '#1e1e1e' 174 }}> 221 <TableCell 222 component="th" 223 scope="row" 224 sx={{ 225 fontWeight: 'bold', 226 width: '50%', 227 bgcolor: '#1e1e1e', 228 textAlign: 'center', 229 px: 2 230 }} 231 > 175 232 {formatKey(key)} 176 233 </TableCell> 177 <TableCell>{renderValue(key, val)}</TableCell> 234 <TableCell sx={{ 235 textAlign: 'center', 236 px: 2, 237 width: '50%' 238 }}> 239 {renderValue(key, val)} 240 </TableCell> 178 241 </TableRow> 179 242 ); … … 182 245 </Table> 183 246 </TableContainer> 184 <Box sx={{display: 'flex', justifyContent: 'space-between', alignItems: 'center', mt: 0.5}}> 247 248 <Box sx={{ 249 display: 'flex', 250 justifyContent: 'center', 251 alignItems: 'center', 252 mt: 1, 253 width: '100%' 254 }}> 185 255 <Typography variant="h4" color="primary.main" fontWeight="bold"> 186 256 {formatMoney(displayData.price)} 187 257 </Typography> 188 258 </Box> 189 </ Grid>190 </ Grid>259 </Box> 260 </Box> 191 261 )} 192 262 </DialogContent> … … 198 268 color: 'white', 199 269 borderColor: '#ff8201', 200 onHover: {backgroundColor: '#ba5d02', borderColor: '#ba5d02'}270 '&:hover': {backgroundColor: '#ba5d02', borderColor: '#ba5d02'} 201 271 }} 202 272 >Close</Button> -
components/ComponentDialog.tsx
rb348db4 rf727252 57 57 return () => clearTimeout(timeoutId); 58 58 }, [tempSearchQuery]); 59 60 useEffect(() => { 61 if (open && category) { 62 setSelectedBrands([]); 63 setSortOrder('price_desc'); 64 setTempSearchQuery(''); 65 setSearchQuery(''); 66 setPriceRange([0, 2000]); 67 } 68 }, [open, category]); 69 59 70 60 71 useEffect(() => { … … 297 308 Browsing: 298 309 </Box> 299 <b> {category === 'gpu' ? 'G raphics Cards' : category?.toUpperCase()}</b>310 <b> {category === 'gpu' ? 'GRAPHICS CARDS' : category === 'memory_card' ? 'STORAGE EXPANSION CARDS' : category?.toUpperCase()}</b> 300 311 {mode === 'forge' && currentBuildId && ( 301 312 <Typography -
components/Navbar.tsx
rb348db4 rf727252 64 64 { id: 'sound_card', label: 'Sound Cards', icon: <SpeakerIcon fontSize="small" /> }, 65 65 { id: 'optical_drive', label: 'Optical Drives', icon: <AlbumIcon fontSize="small" /> }, 66 { id: 'memory_card', label: ' MemoryCards', icon: <SdCardIcon fontSize="small" /> },66 { id: 'memory_card', label: 'Storage Cards', icon: <SdCardIcon fontSize="small" /> }, 67 67 { id: 'cables', label: 'Cables', icon: <CableIcon fontSize="small" /> }, 68 68 ]; -
pages/index/+Page.tsx
rb348db4 rf727252 10 10 import BuildCard from '../../components/BuildCard'; 11 11 12 import {onGetApprovedBuilds, onGetAuthState , onCloneBuild} from '../+Layout.telefunc';12 import {onGetApprovedBuilds, onGetAuthState} from '../+Layout.telefunc'; 13 13 14 14 export default function HomePage() { … … 46 46 } 47 47 48 loadSite();48 void loadSite(); 49 49 }, []); 50 51 const handleCloneWrapper = async (buildId: number) => {52 if (!data?.isLoggedIn) return alert("Please login to clone builds!");53 if (confirm(`Clone this build to your dashboard?`)) {54 await onCloneBuild({buildId});55 alert("Build cloned! Check your dashboard.");56 setSelectedBuildId(null);57 }58 };59 50 60 51 if (!data) return <Box sx={{p: 10, textAlign: 'center'}}>Loading Forge...</Box>; … … 160 151 currentUser={data.userId} 161 152 onClose={() => setSelectedBuildId(null)} 162 onClone={handleCloneWrapper}163 153 /> 164 154
Note:
See TracChangeset
for help on using the changeset viewer.
