mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: simplified
This commit is contained in:
1 parent
8f54b8a576
commit
ec547af49e
2 files changed
+252
-265
No files matched your search
@@ -58,6 +58,7 @@ export const navbarExpander = styleVariants({
|
|||||||
navbarExpanderBase,
|
navbarExpanderBase,
|
||||||
{
|
{
|
||||||
maxHeight: '100vh',
|
maxHeight: '100vh',
|
||||||
|
overscrollBehavior: 'contain',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|||||||
+251
-265
@@ -45,295 +45,281 @@ export default function Navbar() {
|
|||||||
<Flex className={styles.navbar}>
|
<Flex className={styles.navbar}>
|
||||||
<Flex
|
<Flex
|
||||||
className={styles.navbarExpander[`${showHamburgerMenu}`]}
|
className={styles.navbarExpander[`${showHamburgerMenu}`]}
|
||||||
align="start"
|
|
||||||
onClick={() => setShowHamburgerMenu((state) => !state)}
|
onClick={() => setShowHamburgerMenu((state) => !state)}
|
||||||
|
direction="column"
|
||||||
|
gap="2"
|
||||||
>
|
>
|
||||||
<Flex
|
<Flex justify="center">
|
||||||
className={styles.navbarContent}
|
<Flex flexGrow="1" maxWidth="1024px" p="3" align="center">
|
||||||
direction="column"
|
<Flex gap="3" align="center">
|
||||||
onClick={(event) => event.stopPropagation()}
|
<IconButton
|
||||||
>
|
variant="ghost"
|
||||||
<Flex justify="center">
|
color="gray"
|
||||||
<Flex flexGrow="1" maxWidth="1024px" p="3" align="center">
|
className={styles.hamburger}
|
||||||
<Flex gap="3" align="center">
|
onClick={(event) => {
|
||||||
<IconButton
|
event.stopPropagation();
|
||||||
variant="ghost"
|
setShowHamburgerMenu((state) => !state);
|
||||||
color="gray"
|
}}
|
||||||
className={styles.hamburger}
|
|
||||||
onClick={(event) => {
|
|
||||||
event.stopPropagation();
|
|
||||||
setShowHamburgerMenu((state) => !state);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{showHamburgerMenu ? <Cross1Icon /> : <HamburgerMenuIcon />}
|
|
||||||
</IconButton>
|
|
||||||
|
|
||||||
<Link
|
|
||||||
color="gray"
|
|
||||||
highContrast
|
|
||||||
href="/"
|
|
||||||
underline="hover"
|
|
||||||
weight="bold"
|
|
||||||
onClick={() => setShowHamburgerMenu(false)}
|
|
||||||
>
|
|
||||||
BlitzKit
|
|
||||||
</Link>
|
|
||||||
</Flex>
|
|
||||||
|
|
||||||
<Box flexGrow="1" />
|
|
||||||
|
|
||||||
<Flex
|
|
||||||
align="center"
|
|
||||||
gap="2"
|
|
||||||
justify="center"
|
|
||||||
className={styles.tools}
|
|
||||||
>
|
>
|
||||||
{TOOLS.map((tool, index) => {
|
{showHamburgerMenu ? <Cross1Icon /> : <HamburgerMenuIcon />}
|
||||||
const selected = pathname.startsWith(`/tools/${tool.id}`);
|
</IconButton>
|
||||||
|
|
||||||
return (
|
<Link
|
||||||
<>
|
color="gray"
|
||||||
{index > 0 && (
|
highContrast
|
||||||
<Separator orientation="vertical" size="1" />
|
href="/"
|
||||||
)}
|
underline="hover"
|
||||||
<Link
|
weight="bold"
|
||||||
onClick={() => setShowHamburgerMenu(false)}
|
onClick={() => setShowHamburgerMenu(false)}
|
||||||
color="gray"
|
>
|
||||||
highContrast={selected}
|
BlitzKit
|
||||||
size="2"
|
</Link>
|
||||||
href={`tools/${tool.id}`}
|
</Flex>
|
||||||
key={tool.title}
|
|
||||||
underline={selected ? 'always' : 'hover'}
|
|
||||||
>
|
|
||||||
{tool.title}
|
|
||||||
</Link>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</Flex>
|
|
||||||
|
|
||||||
<Box flexGrow="1" />
|
<Box flexGrow="1" />
|
||||||
|
|
||||||
<Flex align="center" gap="3">
|
<Flex
|
||||||
<Link
|
align="center"
|
||||||
style={{ display: 'flex', alignContent: 'center' }}
|
gap="2"
|
||||||
color="gray"
|
justify="center"
|
||||||
href="https://discord.gg/nDt7AjGJQH"
|
className={styles.tools}
|
||||||
underline="none"
|
>
|
||||||
target="_blank"
|
{TOOLS.map((tool, index) => {
|
||||||
onClick={() => setShowHamburgerMenu(false)}
|
const selected = pathname.startsWith(`/tools/${tool.id}`);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{index > 0 && <Separator orientation="vertical" size="1" />}
|
||||||
|
<Link
|
||||||
|
onClick={() => setShowHamburgerMenu(false)}
|
||||||
|
color="gray"
|
||||||
|
highContrast={selected}
|
||||||
|
size="2"
|
||||||
|
href={`tools/${tool.id}`}
|
||||||
|
key={tool.title}
|
||||||
|
underline={selected ? 'always' : 'hover'}
|
||||||
|
>
|
||||||
|
{tool.title}
|
||||||
|
</Link>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Flex>
|
||||||
|
|
||||||
|
<Box flexGrow="1" />
|
||||||
|
|
||||||
|
<Flex align="center" gap="3">
|
||||||
|
<Link
|
||||||
|
style={{ display: 'flex', alignContent: 'center' }}
|
||||||
|
color="gray"
|
||||||
|
href="https://discord.gg/nDt7AjGJQH"
|
||||||
|
underline="none"
|
||||||
|
target="_blank"
|
||||||
|
onClick={() => setShowHamburgerMenu(false)}
|
||||||
|
>
|
||||||
|
<DiscordLogoIcon />
|
||||||
|
</Link>
|
||||||
|
<Link
|
||||||
|
style={{ display: 'flex', alignContent: 'center' }}
|
||||||
|
color="gray"
|
||||||
|
href="https://discord.gg/nDt7AjGJQH"
|
||||||
|
underline="none"
|
||||||
|
target="_blank"
|
||||||
|
onClick={() => setShowHamburgerMenu(false)}
|
||||||
|
>
|
||||||
|
<PatreonIcon width="0.75em" height="0.75em" />
|
||||||
|
</Link>
|
||||||
|
<Link
|
||||||
|
style={{ display: 'flex', alignContent: 'center' }}
|
||||||
|
color="gray"
|
||||||
|
href="/settings"
|
||||||
|
underline="none"
|
||||||
|
target="_blank"
|
||||||
|
onClick={() => setShowHamburgerMenu(false)}
|
||||||
|
>
|
||||||
|
<GearIcon />
|
||||||
|
</Link>
|
||||||
|
<Popover.Root>
|
||||||
|
<Popover.Trigger>
|
||||||
|
<IconButton variant="ghost" color="gray">
|
||||||
|
<PersonIcon />
|
||||||
|
</IconButton>
|
||||||
|
</Popover.Trigger>
|
||||||
|
|
||||||
|
<Popover.Content
|
||||||
|
align="end"
|
||||||
|
width="320px"
|
||||||
|
onOpenAutoFocus={(event) => event.preventDefault()}
|
||||||
>
|
>
|
||||||
<DiscordLogoIcon />
|
{(logins.patreon || logins.wargaming) && (
|
||||||
</Link>
|
<Flex direction="column" gap="2">
|
||||||
<Link
|
<Text align="center" color="gray">
|
||||||
style={{ display: 'flex', alignContent: 'center' }}
|
Logged in accounts
|
||||||
color="gray"
|
</Text>
|
||||||
href="https://discord.gg/nDt7AjGJQH"
|
|
||||||
underline="none"
|
|
||||||
target="_blank"
|
|
||||||
onClick={() => setShowHamburgerMenu(false)}
|
|
||||||
>
|
|
||||||
<PatreonIcon width="0.75em" height="0.75em" />
|
|
||||||
</Link>
|
|
||||||
<Link
|
|
||||||
style={{ display: 'flex', alignContent: 'center' }}
|
|
||||||
color="gray"
|
|
||||||
href="/settings"
|
|
||||||
underline="none"
|
|
||||||
target="_blank"
|
|
||||||
onClick={() => setShowHamburgerMenu(false)}
|
|
||||||
>
|
|
||||||
<GearIcon />
|
|
||||||
</Link>
|
|
||||||
<Popover.Root>
|
|
||||||
<Popover.Trigger>
|
|
||||||
<IconButton variant="ghost" color="gray">
|
|
||||||
<PersonIcon />
|
|
||||||
</IconButton>
|
|
||||||
</Popover.Trigger>
|
|
||||||
|
|
||||||
<Popover.Content
|
{logins.patreon && (
|
||||||
align="end"
|
<Flex align="center" gap="2" justify="center">
|
||||||
width="320px"
|
<PatreonIcon width={15} height={15} />
|
||||||
onOpenAutoFocus={(event) => event.preventDefault()}
|
<Text>Patreon</Text>
|
||||||
>
|
<Button
|
||||||
{(logins.patreon || logins.wargaming) && (
|
color="red"
|
||||||
<Flex direction="column" gap="2">
|
variant="ghost"
|
||||||
<Text align="center" color="gray">
|
onClick={() =>
|
||||||
Logged in accounts
|
mutateApp((draft) => {
|
||||||
</Text>
|
draft.logins.patreon = undefined;
|
||||||
|
})
|
||||||
{logins.patreon && (
|
}
|
||||||
<Flex align="center" gap="2" justify="center">
|
|
||||||
<PatreonIcon width={15} height={15} />
|
|
||||||
<Text>Patreon</Text>
|
|
||||||
<Button
|
|
||||||
color="red"
|
|
||||||
variant="ghost"
|
|
||||||
onClick={() =>
|
|
||||||
mutateApp((draft) => {
|
|
||||||
draft.logins.patreon = undefined;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
>
|
|
||||||
Logout
|
|
||||||
</Button>
|
|
||||||
</Flex>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{logins.wargaming && (
|
|
||||||
<Flex align="center" gap="2" justify="center">
|
|
||||||
<WargamingIcon width={15} height={15} />
|
|
||||||
<Text>Wargaming</Text>
|
|
||||||
<Button
|
|
||||||
color="red"
|
|
||||||
variant="ghost"
|
|
||||||
onClick={() =>
|
|
||||||
mutateApp((draft) => {
|
|
||||||
draft.logins.wargaming = undefined;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
>
|
|
||||||
Logout
|
|
||||||
</Button>
|
|
||||||
</Flex>
|
|
||||||
)}
|
|
||||||
</Flex>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!logins.patreon !== !logins.wargaming && (
|
|
||||||
<Inset side="x">
|
|
||||||
<Separator my="4" size="4" />
|
|
||||||
</Inset>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{(!logins.patreon || !logins.wargaming) && (
|
|
||||||
<Flex direction="column" gap="2">
|
|
||||||
<Text align="center" color="gray">
|
|
||||||
Log in with...
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
{!logins.patreon && (
|
|
||||||
<Link
|
|
||||||
style={{ width: '100%' }}
|
|
||||||
href={patreonLoginUrl()}
|
|
||||||
>
|
>
|
||||||
<Button style={{ width: '100%' }} color="tomato">
|
Logout
|
||||||
<PatreonIcon width={15} height={15} /> Patreon
|
</Button>
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{logins.wargaming && (
|
||||||
|
<Flex align="center" gap="2" justify="center">
|
||||||
|
<WargamingIcon width={15} height={15} />
|
||||||
|
<Text>Wargaming</Text>
|
||||||
|
<Button
|
||||||
|
color="red"
|
||||||
|
variant="ghost"
|
||||||
|
onClick={() =>
|
||||||
|
mutateApp((draft) => {
|
||||||
|
draft.logins.wargaming = undefined;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Logout
|
||||||
|
</Button>
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!logins.patreon !== !logins.wargaming && (
|
||||||
|
<Inset side="x">
|
||||||
|
<Separator my="4" size="4" />
|
||||||
|
</Inset>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{(!logins.patreon || !logins.wargaming) && (
|
||||||
|
<Flex direction="column" gap="2">
|
||||||
|
<Text align="center" color="gray">
|
||||||
|
Log in with...
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
{!logins.patreon && (
|
||||||
|
<Link
|
||||||
|
style={{ width: '100%' }}
|
||||||
|
href={patreonLoginUrl()}
|
||||||
|
>
|
||||||
|
<Button style={{ width: '100%' }} color="tomato">
|
||||||
|
<PatreonIcon width={15} height={15} /> Patreon
|
||||||
|
</Button>
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!logins.wargaming && (
|
||||||
|
<Dialog.Root>
|
||||||
|
<Dialog.Trigger>
|
||||||
|
<Button color="red">
|
||||||
|
<WargamingIcon width={15} height={15} /> Wargaming
|
||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Dialog.Trigger>
|
||||||
)}
|
|
||||||
|
|
||||||
{!logins.wargaming && (
|
<Dialog.Content width="fit-content">
|
||||||
<Dialog.Root>
|
<Flex direction="column" gap="4" align="center">
|
||||||
<Dialog.Trigger>
|
<Text color="gray">Choose your region</Text>
|
||||||
<Button color="red">
|
|
||||||
<WargamingIcon width={15} height={15} />{' '}
|
|
||||||
Wargaming
|
|
||||||
</Button>
|
|
||||||
</Dialog.Trigger>
|
|
||||||
|
|
||||||
<Dialog.Content width="fit-content">
|
<Flex gap="2" wrap="wrap">
|
||||||
<Flex direction="column" gap="4" align="center">
|
{REGIONS.map((region) => (
|
||||||
<Text color="gray">Choose your region</Text>
|
<Dialog.Close key={region}>
|
||||||
|
<Link
|
||||||
<Flex gap="2" wrap="wrap">
|
href={
|
||||||
{REGIONS.map((region) => (
|
typeof window !== 'undefined'
|
||||||
<Dialog.Close key={region}>
|
? `https://api.worldoftanks.${region}/wot/auth/login/?application_id=${WARGAMING_APPLICATION_ID}&redirect_uri=${encodeURIComponent(
|
||||||
<Link
|
`${location.origin}/auth/wargaming?return=${location.origin}${location.pathname}`,
|
||||||
href={
|
)}`
|
||||||
typeof window !== 'undefined'
|
: undefined
|
||||||
? `https://api.worldoftanks.${region}/wot/auth/login/?application_id=${WARGAMING_APPLICATION_ID}&redirect_uri=${encodeURIComponent(
|
}
|
||||||
`${location.origin}/auth/wargaming?return=${location.origin}${location.pathname}`,
|
>
|
||||||
)}`
|
<Button color="red">
|
||||||
: undefined
|
{strings.common.regions.normal[region]}
|
||||||
}
|
</Button>
|
||||||
>
|
</Link>
|
||||||
<Button color="red">
|
</Dialog.Close>
|
||||||
{
|
))}
|
||||||
strings.common.regions.normal[
|
|
||||||
region
|
|
||||||
]
|
|
||||||
}
|
|
||||||
</Button>
|
|
||||||
</Link>
|
|
||||||
</Dialog.Close>
|
|
||||||
))}
|
|
||||||
</Flex>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
</Dialog.Content>
|
</Flex>
|
||||||
</Dialog.Root>
|
</Dialog.Content>
|
||||||
)}
|
</Dialog.Root>
|
||||||
</Flex>
|
)}
|
||||||
)}
|
</Flex>
|
||||||
</Popover.Content>
|
)}
|
||||||
</Popover.Root>
|
</Popover.Content>
|
||||||
</Flex>
|
</Popover.Root>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
</Flex>
|
||||||
|
|
||||||
<ScrollArea>
|
<ScrollArea>
|
||||||
<Flex justify="center">
|
<Grid
|
||||||
<Grid
|
columns="repeat(auto-fill, minmax(192px, 1fr))"
|
||||||
columns="repeat(auto-fill, minmax(192px, 1fr))"
|
flow="dense"
|
||||||
flow="dense"
|
gap="2"
|
||||||
gap="2"
|
width="100%"
|
||||||
width="100%"
|
p="3"
|
||||||
p="3"
|
pt="0"
|
||||||
pt="0"
|
>
|
||||||
|
{tools.map((tool) => (
|
||||||
|
<Flex
|
||||||
|
onClick={() => setShowHamburgerMenu(false)}
|
||||||
|
style={{
|
||||||
|
position: 'relative',
|
||||||
|
borderRadius: 'var(--radius-2)',
|
||||||
|
overflow: 'hidden',
|
||||||
|
backgroundImage: `url(${imgur(tool.image, { format: 'jpeg', size: ImgurSize.MediumThumbnail })})`,
|
||||||
|
backgroundSize: 'cover',
|
||||||
|
backgroundPosition: 'center',
|
||||||
|
aspectRatio: '2 / 1',
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{tools.map((tool) => (
|
<Link
|
||||||
<Flex
|
href={tool.id.length === 0 ? '/' : `/tools/${tool.id}`}
|
||||||
onClick={() => setShowHamburgerMenu(false)}
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
flexDirection: 'column',
|
||||||
|
textDecoration: 'none',
|
||||||
|
color: 'inherit',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
flexGrow="1"
|
||||||
style={{
|
style={{
|
||||||
position: 'relative',
|
|
||||||
borderRadius: 'var(--radius-2)',
|
|
||||||
overflow: 'hidden',
|
|
||||||
backgroundImage: `url(${imgur(tool.image, { format: 'jpeg', size: ImgurSize.MediumThumbnail })})`,
|
backgroundImage: `url(${imgur(tool.image, { format: 'jpeg', size: ImgurSize.MediumThumbnail })})`,
|
||||||
backgroundSize: 'cover',
|
backgroundSize: 'cover',
|
||||||
backgroundPosition: 'center',
|
backgroundPosition: 'center',
|
||||||
aspectRatio: '2 / 1',
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Flex
|
||||||
|
p="2"
|
||||||
|
align="center"
|
||||||
|
width="100%"
|
||||||
|
style={{
|
||||||
|
backgroundColor: 'var(--color-panel-translucent)',
|
||||||
|
backdropFilter: 'blur(4rem)',
|
||||||
|
WebkitBackdropFilter: 'blur(4rem)',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Link
|
<Text weight="medium">{tool.title}</Text>
|
||||||
href={tool.id.length === 0 ? '/' : `/tools/${tool.id}`}
|
|
||||||
style={{
|
|
||||||
display: 'flex',
|
|
||||||
width: '100%',
|
|
||||||
height: '100%',
|
|
||||||
flexDirection: 'column',
|
|
||||||
textDecoration: 'none',
|
|
||||||
color: 'inherit',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
flexGrow="1"
|
|
||||||
style={{
|
|
||||||
backgroundImage: `url(${imgur(tool.image, { format: 'jpeg', size: ImgurSize.MediumThumbnail })})`,
|
|
||||||
backgroundSize: 'cover',
|
|
||||||
backgroundPosition: 'center',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Flex
|
|
||||||
p="2"
|
|
||||||
align="center"
|
|
||||||
width="100%"
|
|
||||||
style={{
|
|
||||||
backgroundColor: 'var(--color-panel-translucent)',
|
|
||||||
backdropFilter: 'blur(4rem)',
|
|
||||||
WebkitBackdropFilter: 'blur(4rem)',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Text weight="medium">{tool.title}</Text>
|
|
||||||
</Flex>
|
|
||||||
</Link>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
))}
|
</Link>
|
||||||
</Grid>
|
</Flex>
|
||||||
</Flex>
|
))}
|
||||||
</ScrollArea>
|
</Grid>
|
||||||
</Flex>
|
</ScrollArea>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user