diff --git a/docs/changelogs/1.15.8.md b/docs/changelogs/1.15.8.md new file mode 100644 index 000000000..ef708c6eb --- /dev/null +++ b/docs/changelogs/1.15.8.md @@ -0,0 +1,9 @@ +# Blitzkrieg 1.15.8 + +A request fulfilled \:\) + +## Features + +- Added custom titles in session tracker + - Change the title through Options > Edit title... +- Colors are shown when selecting a theme color for the session tracker diff --git a/package.json b/package.json index c032147c0..e1aa3e0c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blitzkrieg", - "version": "1.15.7", + "version": "1.15.8", "description": "🎉 Tools for everything World of Tanks Blitz", "main": "src/server.ts", "type": "module", diff --git a/src/app/embeds/session/page.tsx b/src/app/embeds/session/page.tsx index 46f342098..2fe94cacc 100644 --- a/src/app/embeds/session/page.tsx +++ b/src/app/embeds/session/page.tsx @@ -209,14 +209,7 @@ export default function SessionPage() { { const rowStat = totalRowStats[customColumn.display]; diff --git a/src/app/tools/session/components/Menu.tsx b/src/app/tools/session/components/Menu.tsx index 9c3172bbb..ed26bd10b 100644 --- a/src/app/tools/session/components/Menu.tsx +++ b/src/app/tools/session/components/Menu.tsx @@ -1,9 +1,20 @@ -import { ContextMenu, DropdownMenu } from '@radix-ui/themes'; +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'; @@ -15,59 +26,111 @@ interface ContextMenuProps { export function Menu({ Builder, reset }: ContextMenuProps) { const session = useSession(); + const [showTitleEditor, setShowTitleEditor] = useState(false); + const titleInput = useRef(null); return ( - - - Accent color + <> + + + + Edit title - - - useSession.setState({ color: value as AccentColor | GrayColor }) - } - > - {[...ACCENT_COLORS, ...GRAY_COLORS].map((color) => ( - {`${color - .charAt(0) - .toUpperCase()}${color.slice(1)}`} - ))} - - - + + + { + 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)}`} + + + ))} + + + - - useSession.setState({ showTotal: checked }) - } - > - Show total - - - useSession.setState({ showCareer: checked }) - } - > - Show career - + - + setShowTitleEditor(true)}> + Edit title... + + + + + - - Reset - - + + + + useSession.setState({ showTotal: checked }) + } + > + Show total + + + useSession.setState({ showCareer: checked }) + } + > + Show career + + + + + + Reset + + + ); } diff --git a/src/stores/session.ts b/src/stores/session.ts index 4612ba8d2..0e0223d88 100644 --- a/src/stores/session.ts +++ b/src/stores/session.ts @@ -22,6 +22,7 @@ type Session = ( time: number; } ) & { + title: string; resetPrompt: boolean; embedPrompt: boolean; customColumns: { @@ -68,6 +69,7 @@ export const useSession = create()( devtools( persist( (set) => ({ + title: 'Untitled session', isTracking: false, resetPrompt: true, showTotal: true,