Changeset e599341 for pages/index/+Page.tsx
- Timestamp:
- 12/28/25 00:07:22 (7 months ago)
- Branches:
- main
- Children:
- 9c87509
- Parents:
- f7c0b0d
- File:
-
- 1 edited
-
pages/index/+Page.tsx (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pages/index/+Page.tsx
rf7c0b0d re599341 14 14 export default function HomePage() { 15 15 const [data, setData] = useState<any>(null); 16 const [allRanked, setAllRanked] = useState<any[]>([]); 16 17 17 18 const [selectedBuildId, setSelectedBuildId] = useState<number | null>(null); 18 19 19 const [openRankedPopup, setOpenRankedPopup] = useState(false); 20 20 … … 23 23 try { 24 24 const [ 25 authData, highestRankedBuilds, communityBuilds 25 authData, 26 highestRankedBuilds, 27 communityBuilds, 28 fullRankedList 26 29 ] = await Promise.all([ 27 30 onGetAuthState(), 28 onGetApprovedBuilds({ limit: 3 , sort: 'rating_desc' }), 29 onGetApprovedBuilds({ limit: 12 }) 31 onGetApprovedBuilds({ limit: 5 , sort: 'rating_desc' }), 32 onGetApprovedBuilds({ limit: 12 }), 33 onGetApprovedBuilds({ limit: 10, sort: 'rating_desc' }) 30 34 ]); 31 35 … … 36 40 communityBuilds: communityBuilds 37 41 }); 42 setAllRanked(fullRankedList); 38 43 } catch (error) { 39 44 console.error("Error loading homepage data:", error); … … 69 74 Build, share, discuss, and discover custom PC configurations. 70 75 </Typography> 71 <Button variant="contained" size="large" href="/forge r" startIcon={<AutoFixHighIcon />}76 <Button variant="contained" size="large" href="/forge" startIcon={<AutoFixHighIcon />} 72 77 sx={{ fontSize: '1.2rem', px: 4, py: 1.5, mt: 2 }}> 73 78 Start Forging … … 92 97 </Box> 93 98 94 <Grid container spacing={2} sx={{ mb: 8, alignItems: 'stretch' }}> 95 {/*<Grid item xs={12} md={3} sx={{ display: 'flex' }}>*/} 96 {/* <Box sx={{*/} 97 {/* width: '100%', p: 3, bgcolor: '#ff8201', color: 'black', borderRadius: 2,*/} 98 {/* display: 'flex', flexDirection: 'column', justifyContent: 'center'*/} 99 {/* }}>*/} 100 {/* <Typography color={'black'} variant="h5" fontWeight="bold" gutterBottom>The Elite</Typography>*/} 101 {/* <Typography variant="body1" fontWeight="bold">The top 3 community-voted builds.</Typography>*/} 102 {/* </Box>*/} 103 {/*</Grid>*/} 104 99 <Grid container spacing={3} sx={{ mb: 8, alignItems: 'stretch' }}> 105 100 {data.prebuilts.slice(0, 3).map((build: any) => ( 106 101 <Grid item xs={12} sm={6} md={3} key={build.id} sx={{ display: 'flex' }}> … … 114 109 ))} 115 110 </Grid> 116 117 111 118 112 <SectionHeader title="Community Forge" subtitle="Fresh builds from users around the world."/> … … 133 127 </Container> 134 128 135 136 129 <BuildDetailsDialog 137 130 open={!!selectedBuildId} … … 142 135 /> 143 136 144 145 <Dialog open={openRankedPopup} onClose={() => setOpenRankedPopup(false)} maxWidth="lg" fullWidth> 137 <Dialog open={openRankedPopup} onClose={() => setOpenRankedPopup(false)} maxWidth="lg" fullWidth scroll="paper"> 146 138 <DialogTitle sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}> 147 Hall of Fame ( All Top Ranked)139 Hall of Fame (Top Rated) 148 140 <IconButton onClick={() => setOpenRankedPopup(false)}><CloseIcon /></IconButton> 149 141 </DialogTitle> 150 142 <DialogContent dividers> 151 143 <Grid container spacing={3}> 152 {data.prebuilts.concat(data.communityBuilds).map((build: any) => ( 153 <Grid item xs={12} sm={6} md={3} key={`popup-${build.id}`}> 154 <BuildCard 155 build={build} 156 onClick={() => { 157 setOpenRankedPopup(false); 158 setSelectedBuildId(build.id); // Open details from popup 159 }} 160 /> 144 {allRanked.map((build: any, index: number) => ( 145 <Grid item xs={12} sm={6} md={3} key={`ranked-${build.id}`}> 146 <Box sx={{ position: 'relative' }}> 147 <Box sx={{ 148 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' 152 }}> 153 #{index + 1} 154 </Box> 155 <BuildCard 156 build={build} 157 onClick={() => { 158 setOpenRankedPopup(false); 159 setSelectedBuildId(build.id); 160 }} 161 /> 162 </Box> 161 163 </Grid> 162 164 ))} … … 171 173 function SectionHeader({ title, subtitle }: { title: string, subtitle: string }) { 172 174 return ( 173 <Box sx={{ mb: 4, borderLeft: '5px solid # 1976d2', pl: 2 }}>175 <Box sx={{ mb: 4, borderLeft: '5px solid #ff8201', pl: 2 }}> 174 176 <Typography variant="h4" fontWeight="bold" color="text.primary">{title}</Typography> 175 177 <Typography variant="subtitle1" color="text.secondary">{subtitle}</Typography>
Note:
See TracChangeset
for help on using the changeset viewer.
