Ignore:
Timestamp:
12/28/25 00:07:22 (7 months ago)
Author:
Mihail <mihail2.naumov@…>
Branches:
main
Children:
9c87509
Parents:
f7c0b0d
Message:

Added frontend elements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pages/index/+Page.tsx

    rf7c0b0d re599341  
    1414export default function HomePage() {
    1515    const [data, setData] = useState<any>(null);
     16    const [allRanked, setAllRanked] = useState<any[]>([]);
    1617
    1718    const [selectedBuildId, setSelectedBuildId] = useState<number | null>(null);
    18 
    1919    const [openRankedPopup, setOpenRankedPopup] = useState(false);
    2020
     
    2323            try {
    2424                const [
    25                     authData, highestRankedBuilds, communityBuilds
     25                    authData,
     26                    highestRankedBuilds,
     27                    communityBuilds,
     28                    fullRankedList
    2629                ] = await Promise.all([
    2730                    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' })
    3034                ]);
    3135
     
    3640                    communityBuilds: communityBuilds
    3741                });
     42                setAllRanked(fullRankedList);
    3843            } catch (error) {
    3944                console.error("Error loading homepage data:", error);
     
    6974                        Build, share, discuss, and discover custom PC configurations.
    7075                    </Typography>
    71                     <Button variant="contained" size="large" href="/forger" startIcon={<AutoFixHighIcon />}
     76                    <Button variant="contained" size="large" href="/forge" startIcon={<AutoFixHighIcon />}
    7277                            sx={{ fontSize: '1.2rem', px: 4, py: 1.5, mt: 2 }}>
    7378                        Start Forging
     
    9297                </Box>
    9398
    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' }}>
    105100                    {data.prebuilts.slice(0, 3).map((build: any) => (
    106101                        <Grid item xs={12} sm={6} md={3} key={build.id} sx={{ display: 'flex' }}>
     
    114109                    ))}
    115110                </Grid>
    116 
    117111
    118112                <SectionHeader title="Community Forge" subtitle="Fresh builds from users around the world."/>
     
    133127            </Container>
    134128
    135 
    136129            <BuildDetailsDialog
    137130                open={!!selectedBuildId}
     
    142135            />
    143136
    144 
    145             <Dialog open={openRankedPopup} onClose={() => setOpenRankedPopup(false)} maxWidth="lg" fullWidth>
     137            <Dialog open={openRankedPopup} onClose={() => setOpenRankedPopup(false)} maxWidth="lg" fullWidth scroll="paper">
    146138                <DialogTitle sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
    147                     Hall of Fame (All Top Ranked)
     139                    Hall of Fame (Top Rated)
    148140                    <IconButton onClick={() => setOpenRankedPopup(false)}><CloseIcon /></IconButton>
    149141                </DialogTitle>
    150142                <DialogContent dividers>
    151143                    <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>
    161163                            </Grid>
    162164                        ))}
     
    171173function SectionHeader({ title, subtitle }: { title: string, subtitle: string }) {
    172174    return (
    173         <Box sx={{ mb: 4, borderLeft: '5px solid #1976d2', pl: 2 }}>
     175        <Box sx={{ mb: 4, borderLeft: '5px solid #ff8201', pl: 2 }}>
    174176            <Typography variant="h4" fontWeight="bold" color="text.primary">{title}</Typography>
    175177            <Typography variant="subtitle1" color="text.secondary">{subtitle}</Typography>
Note: See TracChangeset for help on using the changeset viewer.