Changeset 8a7f936 for pages/index
- Timestamp:
- 12/29/25 00:37:49 (6 months ago)
- Branches:
- main
- Children:
- 5af32f0
- Parents:
- ae5d054
- File:
-
- 1 edited
-
pages/index/+Page.tsx (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pages/index/+Page.tsx
rae5d054 r8a7f936 1 import React, { useEffect, useState} from 'react';1 import React, {useEffect, useState} from 'react'; 2 2 import { 3 3 Container, Box, Typography, Button, Grid, IconButton, Dialog, DialogTitle, DialogContent … … 10 10 import BuildCard from '../../components/BuildCard'; 11 11 12 import { onGetApprovedBuilds, onGetAuthState, onCloneBuild} from '../+Layout.telefunc';12 import {onGetApprovedBuilds, onGetAuthState, onCloneBuild} from '../+Layout.telefunc'; 13 13 14 14 export default function HomePage() { … … 29 29 ] = await Promise.all([ 30 30 onGetAuthState(), 31 onGetApprovedBuilds({ limit: 5 , sort: 'rating_desc'}),32 onGetApprovedBuilds({ limit: 12}),33 onGetApprovedBuilds({ limit: 10, sort: 'rating_desc'})31 onGetApprovedBuilds({limit: 5, sort: 'rating_desc'}), 32 onGetApprovedBuilds({limit: 12}), 33 onGetApprovedBuilds({limit: 20, sort: 'rating_desc'}) 34 34 ]); 35 35 … … 45 45 } 46 46 } 47 47 48 loadSite(); 48 49 }, []); … … 51 52 if (!data?.isLoggedIn) return alert("Please login to clone builds!"); 52 53 if (confirm(`Clone this build to your dashboard?`)) { 53 await onCloneBuild({ buildId});54 await onCloneBuild({buildId}); 54 55 alert("Build cloned! Check your dashboard."); 55 56 setSelectedBuildId(null); … … 57 58 }; 58 59 59 if (!data) return <Box sx={{ p: 10, textAlign: 'center'}}>Loading Forge...</Box>;60 if (!data) return <Box sx={{p: 10, textAlign: 'center'}}>Loading Forge...</Box>; 60 61 61 62 return ( … … 69 70 } 70 71 }}> 71 <Box sx={{ position: 'relative', textAlign: 'center', zIndex: 1, p: 2}}>72 <Box sx={{position: 'relative', textAlign: 'center', zIndex: 1, p: 2}}> 72 73 <Typography variant="h2" fontWeight="bold" gutterBottom>Forge Your Ultimate Machine</Typography> 73 <Typography variant="h5" sx={{ maxWidth: '800px', mx: 'auto', mb: 1}}>74 <Typography variant="h5" sx={{maxWidth: '800px', mx: 'auto', mb: 1}}> 74 75 Build, share, discuss, and discover custom PC configurations. 75 76 </Typography> 76 <Button variant="contained" size="large" href="/forge" startIcon={<AutoFixHighIcon />}77 sx={{ fontSize: '1.2rem', px: 4, py: 1.5, mt: 2}}>77 <Button variant="contained" size="large" href="/forge" startIcon={<AutoFixHighIcon/>} 78 sx={{fontSize: '1.2rem', px: 4, py: 1.5, mt: 2}}> 78 79 Start Forging 79 80 </Button> … … 81 82 </Box> 82 83 83 <Container maxWidth="xl" sx={{ mt: 6, mb: 10}}>84 <Container maxWidth="xl" sx={{mt: 6, mb: 10}}> 84 85 <Box sx={{ 85 mb: 4, borderLeft: '5px solid #ff8201', pl: 2,86 mb: 2, borderLeft: '5px solid #ff8201', pl: 1, 86 87 display: 'flex', justifyContent: 'space-between', alignItems: 'end' 87 88 }}> … … 92 93 </Typography> 93 94 </Box> 94 <Button variant="outlined" startIcon={<ListIcon />} onClick={() => setOpenRankedPopup(true)}>95 <Button variant="outlined" startIcon={<ListIcon/>} onClick={() => setOpenRankedPopup(true)}> 95 96 Show All Top Ranked 96 97 </Button> 97 98 </Box> 98 99 <Grid container spacing={3} sx={{ mb: 8, alignItems: 'stretch' }}> 100 {data.prebuilts.slice(0, 3).map((build: any) => ( 101 <Grid item xs={12} sm={6} md={3} key={build.id} sx={{ display: 'flex' }}> 102 <Box sx={{ width: '100%' }}> 103 <BuildCard 104 build={build} 105 onClick={() => setSelectedBuildId(build.id)} 106 /> 107 </Box> 108 </Grid> 99 <Box 100 sx={{ 101 display: 'grid', 102 gridTemplateColumns: { 103 xs: '1fr', 104 sm: 'repeat(2, 1fr)', 105 md: 'repeat(3, 1fr)', 106 lg: 'repeat(4, 1fr)', 107 xl: 'repeat(5, 1fr)', 108 }, 109 gap: 3, 110 width: '90%', 111 }} 112 > 113 {data.prebuilts.map((build: any) => ( 114 <BuildCard 115 key={build.id} 116 build={build} 117 onClick={() => setSelectedBuildId(build.id)} 118 /> 109 119 ))} 110 </Grid> 111 112 <SectionHeader title="Community Forge" subtitle="Fresh builds from users around the world."/> 113 <Grid container spacing={3}> 120 </Box> 121 122 <Box sx={{ 123 mb: 2, mt: 2, borderLeft: '5px solid #ff8201', pl: 1, 124 }}> 125 <Typography variant="h4" fontWeight="bold" color="text.primary">Community Forge</Typography> 126 <Typography variant="subtitle1" color="text.secondary" sx={{mb: 2}}>Fresh builds from users around 127 the world.</Typography> 128 </Box> 129 <Box 130 sx={{ 131 display: 'grid', 132 gridTemplateColumns: { 133 xs: '1fr', 134 sm: 'repeat(2, 1fr)', 135 md: 'repeat(3, 1fr)', 136 lg: 'repeat(4, 1fr)', 137 xl: 'repeat(5, 1fr)', 138 }, 139 gap: 3, 140 width: '90%', 141 }} 142 > 114 143 {data.communityBuilds.map((build: any) => ( 115 <Grid item xs={12} sm={6} md={3} key={build.id}> 116 <BuildCard 117 build={build} 118 onClick={() => setSelectedBuildId(build.id)} 119 /> 120 </Grid> 144 <BuildCard 145 key={build.id} 146 build={build} 147 onClick={() => setSelectedBuildId(build.id)} 148 /> 121 149 ))} 122 </ Grid>123 124 <Box sx={{ display: 'flex', justifyContent: 'center', mt: 6}}>150 </Box> 151 152 <Box sx={{display: 'flex', justifyContent: 'center', mt: 6}}> 125 153 <Button variant="outlined" size="large" href="/completed-builds">View All Community Builds</Button> 126 154 </Box> … … 135 163 /> 136 164 137 <Dialog open={openRankedPopup} onClose={() => setOpenRankedPopup(false)} maxWidth="lg" fullWidth scroll="paper"> 138 <DialogTitle sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}> 165 <Dialog open={openRankedPopup} onClose={() => setOpenRankedPopup(false)} maxWidth="xl" fullWidth 166 scroll="paper"> 167 <DialogTitle sx={{display: 'flex', justifyContent: 'space-between', alignItems: 'center'}}> 139 168 Hall of Fame (Top Rated) 140 <IconButton onClick={() => setOpenRankedPopup(false)}><CloseIcon /></IconButton>169 <IconButton onClick={() => setOpenRankedPopup(false)}><CloseIcon/></IconButton> 141 170 </DialogTitle> 142 171 <DialogContent dividers> 143 <Grid container spacing={3} >172 <Grid container spacing={3} sx={{p: 1}}> 144 173 {allRanked.map((build: any, index: number) => ( 145 <Grid item xs={12} sm={6} md={3} key={`ranked-${build.id}`}> 146 <Box sx={{ position: 'relative' }}> 174 <Grid 175 item 176 xs={12} 177 sm={6} 178 md={3} 179 key={`ranked-${build.id}`} 180 sx={{display: 'flex'}} 181 > 182 <Box sx={{position: 'relative', width: '100%', display: 'flex'}}> 147 183 <Box sx={{ 148 184 position: 'absolute', top: -10, left: -10, zIndex: 1, 149 width: 30, height: 30, borderRadius: '50%', 150 bgcolor: index < 3 ? '#ff8201' : 'grey.700', color: 'white', 151 display: 'flex', alignItems: 'center', justifyContent: 'center', fontWeight: 'bold' 185 width: 35, height: 35, borderRadius: '50%', 186 bgcolor: index < 3 ? '#ff8201' : 'grey.800', color: 'white', 187 display: 'flex', alignItems: 'center', justifyContent: 'center', 188 fontWeight: 'bold', border: '2px solid white', boxShadow: 2 152 189 }}> 153 190 #{index + 1} … … 166 203 </DialogContent> 167 204 </Dialog> 168 169 205 </Box> 170 206 ); 171 207 } 172 173 function SectionHeader({ title, subtitle }: { title: string, subtitle: string }) {174 return (175 <Box sx={{ mb: 4, borderLeft: '5px solid #ff8201', pl: 2 }}>176 <Typography variant="h4" fontWeight="bold" color="text.primary">{title}</Typography>177 <Typography variant="subtitle1" color="text.secondary">{subtitle}</Typography>178 </Box>179 );180 }
Note:
See TracChangeset
for help on using the changeset viewer.
