diff --git a/src/app/tools/session/components/CustomColumn.tsx b/src/app/tools/session/components/CustomColumn.tsx deleted file mode 100644 index fa27aaa25..000000000 --- a/src/app/tools/session/components/CustomColumn.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import { ContextMenu, DropdownMenu } from '@radix-ui/themes'; -import mutateSession, { useSession } from '../../../../stores/session'; - -export type CustomColumnDisplay = - | 'battles' - | 'winrate' - | 'wn8' - | 'damage' - | 'none'; - -const NO_DELTA: CustomColumnDisplay[] = ['battles', 'wn8', 'none']; - -interface CustomColumn { - Builder: typeof DropdownMenu | typeof ContextMenu; - column: number; -} - -export function CustomColumn({ column, Builder }: CustomColumn) { - const customColumn = useSession((state) => state.customColumns[column]); - - return ( - - Column {column + 1} - - - - mutateSession((draft) => { - draft.customColumns[column].display = - event as CustomColumnDisplay; - }) - } - > - Battles - Winrate - WN8 - Damage - None - - - {!NO_DELTA.includes(customColumn.display) && ( - <> - - - - mutateSession((draft) => { - draft.customColumns[column].showDelta = checked; - }) - } - > - Show delta - - - )} - - - ); -} diff --git a/src/app/tools/session/components/Menu.tsx b/src/app/tools/session/components/Menu.tsx deleted file mode 100644 index 2197d75a3..000000000 --- a/src/app/tools/session/components/Menu.tsx +++ /dev/null @@ -1,135 +0,0 @@ -import { - Button, - ContextMenu, - Dialog, - DropdownMenu, - Flex, - Heading, - TextField, -} from '@radix-ui/themes'; -import { createColors } from 'bepaint'; -import { useRef, useState } from 'react'; -import { - ACCENT_COLORS, - AccentColor, - GRAY_COLORS, - GrayColor, - PALETTES, -} from '../../../../constants/radixColors'; -import { useSession } from '../../../../stores/session'; -import { CustomColumn } from './CustomColumn'; - -interface ContextMenuProps { - Builder: typeof DropdownMenu | typeof ContextMenu; - reset: () => void; -} - -export function Menu({ Builder, reset }: ContextMenuProps) { - const session = useSession(); - const [showTitleEditor, setShowTitleEditor] = useState(false); - const titleInput = useRef(null); - - return ( - <> - - - - Edit title - - - { - if (event.key === 'Enter' && titleInput.current) { - setShowTitleEditor(false); - useSession.setState({ title: titleInput.current!.value }); - } - }} - /> - - - - - - - - - - - - Accent color - - - - useSession.setState({ color: value as AccentColor | GrayColor }) - } - > - {[...ACCENT_COLORS, ...GRAY_COLORS].map((color) => ( - - -
- {`${color.charAt(0).toUpperCase()}${color.slice(1)}`} - - - ))} - - - - - - - setShowTitleEditor(true)}> - Edit title... - - - - - - - - - - useSession.setState({ showTotal: checked }) - } - > - Show total - - - useSession.setState({ showCareer: checked }) - } - > - Show career - - - - - - Reset - - - - ); -} diff --git a/src/app/tools/session/page.css.ts b/src/app/tools/session/page.css.ts deleted file mode 100644 index 46e782ae4..000000000 --- a/src/app/tools/session/page.css.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { style } from '@vanilla-extract/css'; -import { theme } from '../../../stitches.config'; - -export const toolBar = style({ - '@media': { - 'screen and (min-width: 640px)': { - flexDirection: 'row', - }, - }, - - flexDirection: 'column', - display: 'flex', - gap: 8, -}); - -export const toolbarButton = style({ - '@media': { - 'screen and (min-width: 640px)': { - flex: 0, - }, - }, - - flex: 1, -}); - -export const searchButton = style({ - border: 'none', - background: 'none', - fontSize: 16, - display: 'flex', - padding: 8, - alignItems: 'center', - justifyContent: 'space-between', - cursor: 'pointer', - - ':hover': { - backgroundColor: theme.colors.componentInteractiveHover, - borderRadius: 4, - }, -}); diff --git a/src/core/blitzkit/jsxToSvg/index.ts b/src/core/blitzkit/jsxToSvg/index.ts index 6092b5157..5bf72835f 100644 --- a/src/core/blitzkit/jsxToSvg/index.ts +++ b/src/core/blitzkit/jsxToSvg/index.ts @@ -13,7 +13,7 @@ const fonts = [ export default async function jsxToSvg( jsx: JSX.Element, - renderConfiguration: RenderConfiguration, + renderConfiguration = new RenderConfiguration(), ) { return await satori(jsx, { width: renderConfiguration.width, diff --git a/src/core/blitzkit/resetSession.ts b/src/core/blitzkit/resetSession.ts deleted file mode 100644 index 3164ba54d..000000000 --- a/src/core/blitzkit/resetSession.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { useSession } from '../../stores/session'; -import { setSession } from './setSession'; - -export function resetSession() { - const session = useSession.getState(); - if (!session.isTracking) return; - setSession(session.region, session.id, session.nickname); -} diff --git a/src/core/blitzkit/setSession.ts b/src/core/blitzkit/setSession.ts deleted file mode 100644 index 17a971fb3..000000000 --- a/src/core/blitzkit/setSession.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Region } from '../../constants/regions'; -import { useSession } from '../../stores/session'; -import { NormalizedTankStats, TanksStats } from '../../types/tanksStats'; -import fetchBlitz from '../blitz/fetchBlitz'; - -export async function setSession(region: Region, id: number, nickname: string) { - // TODO: generalize this function and also check for more of these kind - const rawTankStats = ( - await fetchBlitz(region, 'tanks/stats', { account_id: id }) - )[id]; - const tankStats = rawTankStats!.reduce( - (accumulator, tank) => ({ - ...accumulator, - [tank.tank_id]: tank, - }), - {}, - ); - - useSession.setState({ - isTracking: true, - id, - region, - nickname, - tankStats, - time: Date.now(), - }); -}