feat: added tool ground work

This commit is contained in:
TresAbhi committed 2023-09-18 21:55:40 +00:00
1 parent c0eca0c851
commit 350434cc5a
10 files changed
+143 -71

No files matched your search

File renamed without changes.
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

File renamed without changes.
+1 -3
View File
@@ -28,9 +28,7 @@ export default function RootLayout({ children }: RootLayoutProps) {
width: '100%', width: '100%',
}} }}
> >
<div style={{ maxWidth: 780, margin: 'auto', display: 'block' }}> {children}
{children}
</div>
</div> </div>
</body> </body>
</html> </html>
+2 -2
View File
@@ -16,10 +16,10 @@ export const tool = style({
justifyContent: 'flex-end', justifyContent: 'flex-end',
padding: 16, padding: 16,
gap: 4, gap: 4,
boxShadow: 'inset 0 -192px 128px -128px black', boxShadow: `inset 0 -192px 128px -128px ${theme.colors.appBackground1}`,
transition: `box-shadow ${theme.durations.regular}`, transition: `box-shadow ${theme.durations.regular}`,
':hover': { ':hover': {
boxShadow: 'inset 0 -128px 128px -128px black', boxShadow: `inset 0 -128px 128px -128px ${theme.colors.appBackground1}`,
}, },
}); });
+71 -65
View File
@@ -4,106 +4,112 @@ import { CaretRightIcon } from '@radix-ui/react-icons';
import Link from 'next/link'; import Link from 'next/link';
import { useRef } from 'react'; import { useRef } from 'react';
import { Search, SearchItem } from 'react-fuzzysort'; import { Search, SearchItem } from 'react-fuzzysort';
import PageWrapper from '../components/PageWrapper';
import { SearchBar } from '../components/SearchBar'; import { SearchBar } from '../components/SearchBar';
import { theme } from '../stitches.config'; import { theme } from '../stitches.config';
import * as styles from './page.css'; import * as styles from './page.css';
const TOOLS = [ export const TOOLS = [
{ {
id: 'session',
title: 'Session tracker',
description: 'Track your performance in a session',
},
{
id: 'ratings',
title: 'Ratings', title: 'Ratings',
description: 'Current and old season leader boards', description: 'Current and old season leader boards',
banner: '/assets/banners/ratings.png',
href: '/tools/ratings',
}, },
{ {
id: 'tankopedia',
title: 'Tankopedia', title: 'Tankopedia',
description: 'Full Blitz tank encyclopedia', description: 'Full Blitz tank encyclopedia',
banner: '/assets/banners/tank.png',
href: '/tools/tankopedia',
}, },
{ {
id: 'inactive',
title: 'Inactivity tracker', title: 'Inactivity tracker',
description: 'Find inactive members of a clan', description: 'Find inactive members of a clan',
banner: '/assets/banners/inactive.png',
href: '/tools/inactive',
}, },
{ {
id: 'profile',
title: 'Player profile', title: 'Player profile',
description: "A player's basic non-statistical info", description: "A player's basic non-statistical info",
banner: '/assets/banners/player.png',
href: '/tools/profile',
},
{
title: 'More coming soon',
description: 'New tools are added often',
banner: '/assets/banners/more.png',
href: 'https://discord.gg/nDt7AjGJQH',
}, },
// {
// title: 'More coming soon',
// description: 'New tools are added often',
// banner: '/assets/banners/more.png',
// id: 'https://discord.gg/nDt7AjGJQH',
// },
]; ];
export default function Page() { export default function Page() {
const input = useRef<HTMLInputElement>(null); const input = useRef<HTMLInputElement>(null);
return ( return (
<div <PageWrapper>
style={{
width: '100%',
padding: 16,
display: 'flex',
flexDirection: 'column',
gap: 16,
boxSizing: 'border-box',
}}
>
<SearchBar ref={input} />
<div <div
style={{ style={{
width: '100%',
padding: 16,
display: 'flex', display: 'flex',
flexDirection: 'column',
gap: 16, gap: 16,
flexWrap: 'wrap', boxSizing: 'border-box',
}} }}
> >
<Search <SearchBar ref={input} />
input={input}
list={TOOLS.map( <div
(tool) => style={{
({ display: 'flex',
node: ( gap: 16,
<Link flexWrap: 'wrap',
href={tool.href} }}
className={styles.tool} >
style={{ <Search
backgroundImage: `url(${tool.banner})`, input={input}
}} list={TOOLS.map(
> (tool) =>
<span ({
node: (
<Link
href={`/tools/${tool.id}`}
className={styles.tool}
style={{ style={{
fontSize: 32, backgroundImage: `url(/assets/banners/${tool.id}.png)`,
color: theme.colors.textHighContrast,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}} }}
> >
{tool.title} <span
<CaretRightIcon style={{ width: '1em', height: '1em' }} /> style={{
</span> fontSize: 32,
<span color: theme.colors.textHighContrast,
style={{ display: 'flex',
color: theme.colors.textLowContrast, alignItems: 'center',
fontSize: 16, justifyContent: 'center',
}} }}
> >
{tool.description} {tool.title}
</span> <CaretRightIcon
</Link> style={{ width: '1em', height: '1em' }}
), />
query: `${tool.title} ${tool.description}`, </span>
}) satisfies SearchItem, <span
)} style={{
/> color: theme.colors.textLowContrast,
fontSize: 16,
}}
>
{tool.description}
</span>
</Link>
),
query: `${tool.title} ${tool.description}`,
}) satisfies SearchItem,
)}
/>
</div>
</div> </div>
</div> </PageWrapper>
); );
} }
+52
View File
@@ -0,0 +1,52 @@
'use client';
import { ReactNode } from 'react';
import { theme } from '../../stitches.config';
import { TOOLS } from '../page';
interface ToolsLayoutProps {
children: ReactNode;
}
export default function ToolsLayout({ children }: ToolsLayoutProps) {
const toolId = location.pathname.split('/').at(-1);
const tool = TOOLS.find((tool) => tool.id === toolId);
return (
<>
<div
style={{
height: 128,
backgroundImage: `url(/assets/banners/${toolId}.png)`,
backgroundSize: 'cover',
backgroundPosition: 'center',
boxShadow: `inset 0 -192px 128px -128px ${theme.colors.appBackground1}`,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
gap: 4,
flexDirection: 'column',
}}
>
<span
style={{
color: theme.colors.textHighContrast,
fontSize: 32,
}}
>
{tool?.title}
</span>
<span
style={{
color: theme.colors.textLowContrast,
fontSize: 16,
}}
>
{tool?.description}
</span>
</div>
{children}
</>
);
}
+3
View File
@@ -0,0 +1,3 @@
export default function Page() {
return 'inner';
}
+13
View File
@@ -0,0 +1,13 @@
import { ReactNode } from 'react';
interface PageWrapperProps {
children: ReactNode;
}
export default function PageWrapper({ children }: PageWrapperProps) {
return (
<div style={{ maxWidth: 780, margin: 'auto', display: 'block' }}>
{children}
</div>
);
}
+1 -1
View File
@@ -13,7 +13,7 @@ export const SearchBar = forwardRef<HTMLInputElement, ComponentProps<'input'>>(
style={{ style={{
display: 'flex', display: 'flex',
padding: 8, padding: 8,
borderRadius: 16, borderRadius: 4,
border: theme.borderStyles.interactive, border: theme.borderStyles.interactive,
backgroundColor: theme.colors.componentInteractive, backgroundColor: theme.colors.componentInteractive,
color: theme.colors.textLowContrast, color: theme.colors.textLowContrast,