mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
refactors, dynamic constants (lol)
This commit is contained in:
parent
755891710a
commit
d4553896af
25 changed files with 323 additions and 312 deletions
|
@ -7,7 +7,7 @@ const Snowfall = dynamic(() => import('react-snowfall'), { ssr: false })
|
|||
|
||||
import LogoutIcon from './logoutIcon'
|
||||
import Modal from './modal'
|
||||
import constants from '../constants.json'
|
||||
import constants from '../constants'
|
||||
import BB from './b'
|
||||
|
||||
import styles from './layout.module.css'
|
||||
|
@ -67,36 +67,35 @@ function TopBar({
|
|||
unreads,
|
||||
userId,
|
||||
}) {
|
||||
return <>
|
||||
<MenuIcon setSidebarOpen={setSidebarOpen} sidebarOpen={sidebarOpen} />
|
||||
<Link href="/">
|
||||
return (
|
||||
<>
|
||||
<MenuIcon setSidebarOpen={setSidebarOpen} sidebarOpen={sidebarOpen} />
|
||||
<Link href="/">
|
||||
<img
|
||||
src={`${constants.siteUrl}img/frylabs-logo_small_transparent.png`}
|
||||
alt="FryLabs"
|
||||
/>
|
||||
</Link>
|
||||
<div className={styles.topBarLinks}>
|
||||
{Object.keys(topBarLinks).map((key) => {
|
||||
const item = topBarLinks[key]
|
||||
|
||||
<img
|
||||
src={`${constants.siteUrl}img/frylabs-logo_small_transparent.png`}
|
||||
alt="FryLabs"
|
||||
/>
|
||||
|
||||
</Link>
|
||||
<div className={styles.topBarLinks}>
|
||||
{Object.keys(topBarLinks).map((key) => {
|
||||
const item = topBarLinks[key]
|
||||
|
||||
return (
|
||||
(<Link
|
||||
key={key}
|
||||
href={item.href}
|
||||
onClick={closeSideBar}
|
||||
className={href.includes(key) ? styles.active : undefined}>
|
||||
|
||||
{item.text}
|
||||
|
||||
</Link>)
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<div className={'seperator'} />
|
||||
<UserStatus onClick={closeSideBar} unreads={unreads} userId={userId} />
|
||||
</>;
|
||||
return (
|
||||
<Link
|
||||
key={key}
|
||||
href={item.href}
|
||||
onClick={closeSideBar}
|
||||
className={href.includes(key) ? styles.active : undefined}
|
||||
>
|
||||
{item.text}
|
||||
</Link>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
<div className={'seperator'} />
|
||||
<UserStatus onClick={closeSideBar} unreads={unreads} userId={userId} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
function SideBar({ sidebarOpen, closeSideBar, href, setDonateShowing }) {
|
||||
|
@ -110,17 +109,16 @@ function SideBar({ sidebarOpen, closeSideBar, href, setDonateShowing }) {
|
|||
}
|
||||
|
||||
return (
|
||||
(<Link
|
||||
<Link
|
||||
href={item.href}
|
||||
key={key}
|
||||
onClick={closeSideBar}
|
||||
className={href.includes(key) ? styles.active : undefined}
|
||||
id={item.id || undefined}>
|
||||
|
||||
id={item.id || undefined}
|
||||
>
|
||||
{item.text}
|
||||
|
||||
</Link>)
|
||||
);
|
||||
</Link>
|
||||
)
|
||||
})}
|
||||
<a
|
||||
onClick={() => {
|
||||
|
@ -132,7 +130,7 @@ function SideBar({ sidebarOpen, closeSideBar, href, setDonateShowing }) {
|
|||
</a>
|
||||
</div>
|
||||
</>
|
||||
) : null;
|
||||
) : null
|
||||
}
|
||||
|
||||
function Donate() {
|
||||
|
@ -187,11 +185,10 @@ function UserStatus({ userId, unreads, onClick }) {
|
|||
href="/chat"
|
||||
onClick={onClick}
|
||||
title={`Chat${unreadCount ? ' (' + unreadCount + ' új üzenet)' : ''}`}
|
||||
className={styles.unreadNotification}>
|
||||
|
||||
className={styles.unreadNotification}
|
||||
>
|
||||
<span>💬</span>
|
||||
{unreadCount ? <div>{unreadCount}</div> : null}
|
||||
|
||||
</Link>
|
||||
|
||||
<div
|
||||
|
@ -215,7 +212,7 @@ function UserStatus({ userId, unreads, onClick }) {
|
|||
<LogoutIcon size={28} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
function MenuIcon({ setSidebarOpen, sidebarOpen }) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue