From 90c6535a4c484bfc5b893a4dcefecba0ec1e526d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 1 Oct 2023 17:24:02 -0500 Subject: [PATCH 01/11] fix: center aligned blitzkrieg logo --- package.json | 2 +- src/components/Navbar/index.tsx | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 44e41cff3..70121c170 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blitzkrieg", - "version": "1.13.0", + "version": "1.13.1", "description": "🎉 All-in-one Discord bot for everything World of Tanks Blitz", "main": "src/server.ts", "type": "module", diff --git a/src/components/Navbar/index.tsx b/src/components/Navbar/index.tsx index dd5dbaede..c2236e524 100644 --- a/src/components/Navbar/index.tsx +++ b/src/components/Navbar/index.tsx @@ -19,7 +19,15 @@ export default function Navbar() { {/* */} - + {/* + + + + + + + + + + + + + + + + useSession.setState({ showTotal: checked }) + } + > + Show total + + + diff --git a/src/components/Breakdown/components/Row.tsx b/src/components/Breakdown/components/Row.tsx index 5acd25cf8..b7ac74ab2 100644 --- a/src/components/Breakdown/components/Row.tsx +++ b/src/components/Breakdown/components/Row.tsx @@ -4,6 +4,14 @@ import { theme } from '../../../stitches.config'; import { TREE_TYPE_ICONS, TreeTypeEnum } from '../../Tanks'; import { RowStat } from './RowStat'; +export interface RowStat { + title: string; + current?: number | string; + career?: number | string; + delta?: number; + percentile?: Percentile; +} + interface RowProps { type?: 'tank' | 'summary'; title: string; @@ -11,13 +19,7 @@ interface RowProps { treeType?: TreeTypeEnum; tankType?: TankType; - stats: { - title: string; - current?: number | string; - career?: number | string; - delta?: number; - percentile?: Percentile; - }[]; + stats: (RowStat | undefined)[]; } export function Row(props: RowProps) { @@ -77,16 +79,19 @@ export function Row(props: RowProps) { paddingBottom: 8, }} > - {props.stats.map((row, index) => ( - - ))} + {props.stats.map( + (row, index) => + row && ( + + ), + )} ); diff --git a/src/stores/session.ts b/src/stores/session.ts index 02cd818d3..8e36c4895 100644 --- a/src/stores/session.ts +++ b/src/stores/session.ts @@ -1,5 +1,7 @@ +import { produce } from 'immer'; import { create } from 'zustand'; import { devtools, persist } from 'zustand/middleware'; +import { CustomColumnDisplay } from '../app/tools/session/components/CustomColumn'; import { Region } from '../constants/regions'; import { NormalizedTankStats } from '../types/tanksStats'; @@ -18,6 +20,11 @@ type Session = ( } ) & { promptBeforeReset: boolean; + customColumns: { + display: CustomColumnDisplay; + showDelta: boolean; + }[] & { length: 4 }; + showTotal: boolean; }; export const useSession = create()( @@ -26,6 +33,14 @@ export const useSession = create()( (set) => ({ isTracking: false, promptBeforeReset: true, + showTotal: true, + + customColumns: [ + { display: 'battles', showDelta: false }, + { display: 'winrate', showDelta: true }, + { display: 'wn8', showDelta: false }, + { display: 'damage', showDelta: true }, + ], }), { name: 'session', @@ -33,3 +48,7 @@ export const useSession = create()( ), ), ); + +export default function mutateSession(recipe: (draft: Session) => void) { + useSession.setState(produce(recipe)); +} diff --git a/yarn.lock b/yarn.lock index 6a0c7fd15..d85a8246c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3078,6 +3078,11 @@ ignore@^5.1.8, ignore@^5.2.4: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== +immer@^10.0.2: + version "10.0.2" + resolved "https://registry.yarnpkg.com/immer/-/immer-10.0.2.tgz#11636c5b77acf529e059582d76faf338beb56141" + integrity sha512-Rx3CqeqQ19sxUtYV9CU911Vhy8/721wRFnJv3REVGWUmoAcIwzifTsdmJte/MV+0/XpM35LZdQMBGkRIoLPwQA== + indent-string@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" From 691d5cde27cfc7c8c5556e93926b9fdfd85f9b1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 1 Oct 2023 18:52:11 -0500 Subject: [PATCH 08/11] feat: updated embed docs --- docs/guide/embeds.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/guide/embeds.md b/docs/guide/embeds.md index b663d0bfc..076363e14 100644 --- a/docs/guide/embeds.md +++ b/docs/guide/embeds.md @@ -1,23 +1,23 @@ # Embeds -Embeds are generated by a few commands as a URL that can be loaded in a browser/streaming software. +Embeds are URLs generated by commands or tools that represent the "naked" version of the respective command or tool ## Creating Embeds -1. Use a command of your liking (for example, `/stats`). -2. Customize the command however you like and the URL generated for the embed will match your needs. -3. Send the command and when the bot is "done thinking," an "Embed" button will appear below the bot's reply. +1. Use a command or tool and click on "Embed" if it's available +2. Make sure to tweak the settings of the command or tool because embeds replicate everything ## Using Embeds in Streaming Softwares -1. Click on the "Embed" button. -2. Copy the URL from your browser. -3. Paste the URL into a Browser Source. -4. Set the refresh rate/FPS to something very low like `0.0167` (that's 1 frame every 60 seconds). +1. Click on the "Embed" button + - If this was generated by a command, copy the URL from the browser + - If this was generated by a tool, the URL has been copied to your clipboard already +2. Paste this URL into your streaming service as a "Browser Source" + - Tool embeds use local storage so data won't be transferred from you browser to your streaming software + - Make sure to visit the tool's page in your streaming software (using the "Interact" feature) and then open the embed + - Set your browser source refresh rate to `1Hz` because that's how fast embeds refresh ## How Embeds Behave -- They load like any normal website albeit with a significant delay. -- They auto refresh every `60s`. -- All embeds and images generated by Blitzkrieg have a width of `640px` but the height varies and must be found manually through trial and error. - - It's okay to have a Browser Source that has a height larger than needed as Blitzkrieg embeds are transparent. +- They load like any normal website +- They auto refresh every `1s` From 3667fd82b73ac6e77b35a770c0713e45b0a7586e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 1 Oct 2023 18:56:25 -0500 Subject: [PATCH 09/11] feat: docs --- docs/changelogs/1.13.1.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 docs/changelogs/1.13.1.md diff --git a/docs/changelogs/1.13.1.md b/docs/changelogs/1.13.1.md new file mode 100644 index 000000000..798e5ea1d --- /dev/null +++ b/docs/changelogs/1.13.1.md @@ -0,0 +1,17 @@ +# Blitzkrieg 1.13.1 + +The quickest minor update in town 🤠 + +## Changes + +- Added a title, description, and icon to the website +- Added display options to the session tracker + +## Fixes + +- Center aligned stats in breakdown to work better on low width devices +- Center aligned the Blitzkrieg logo in the navbar + +## Technical Changes + +- Added up-to-date information to `README.md` and embed docs From b7b40354927458ee8c157187487ab913ba61a3e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 1 Oct 2023 19:00:05 -0500 Subject: [PATCH 10/11] feat: show career options --- src/app/embeds/session/page.tsx | 2 ++ src/app/tools/session/page.tsx | 8 ++++++++ src/stores/session.ts | 2 ++ 3 files changed, 12 insertions(+) diff --git a/src/app/embeds/session/page.tsx b/src/app/embeds/session/page.tsx index 4bff801db..332664e88 100644 --- a/src/app/embeds/session/page.tsx +++ b/src/app/embeds/session/page.tsx @@ -199,6 +199,7 @@ export default function SessionPage() { since !== undefined && diff !== undefined && ( Show total + + useSession.setState({ showCareer: checked }) + } + > + Show career + diff --git a/src/stores/session.ts b/src/stores/session.ts index 8e36c4895..e6db63fac 100644 --- a/src/stores/session.ts +++ b/src/stores/session.ts @@ -25,6 +25,7 @@ type Session = ( showDelta: boolean; }[] & { length: 4 }; showTotal: boolean; + showCareer: boolean; }; export const useSession = create()( @@ -34,6 +35,7 @@ export const useSession = create()( isTracking: false, promptBeforeReset: true, showTotal: true, + showCareer: true, customColumns: [ { display: 'battles', showDelta: false }, From 8aba19e05bc0f28ffd29dc119ae6b257b81a0ff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 1 Oct 2023 19:02:47 -0500 Subject: [PATCH 11/11] fix: duplicate name --- src/app/embeds/session/page.tsx | 4 ++-- src/components/Breakdown/components/Row.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/embeds/session/page.tsx b/src/app/embeds/session/page.tsx index 332664e88..48d41794d 100644 --- a/src/app/embeds/session/page.tsx +++ b/src/app/embeds/session/page.tsx @@ -142,7 +142,7 @@ export default function SessionPage() { const totalRowStats: Record< CustomColumnDisplay, - Breakdown.RowStat | undefined + Breakdown.RowStatItem | undefined > = { battles: { title: 'Battles', @@ -229,7 +229,7 @@ export default function SessionPage() { .map(({ stats, tankopedia, career, careerWN8, currentWN8 }) => { const rowStats: Record< CustomColumnDisplay, - Breakdown.RowStat | undefined + Breakdown.RowStatItem | undefined > = { battles: { title: 'Battles', diff --git a/src/components/Breakdown/components/Row.tsx b/src/components/Breakdown/components/Row.tsx index b7ac74ab2..9c4a7281f 100644 --- a/src/components/Breakdown/components/Row.tsx +++ b/src/components/Breakdown/components/Row.tsx @@ -4,7 +4,7 @@ import { theme } from '../../../stitches.config'; import { TREE_TYPE_ICONS, TreeTypeEnum } from '../../Tanks'; import { RowStat } from './RowStat'; -export interface RowStat { +export interface RowStatItem { title: string; current?: number | string; career?: number | string; @@ -19,7 +19,7 @@ interface RowProps { treeType?: TreeTypeEnum; tankType?: TankType; - stats: (RowStat | undefined)[]; + stats: (RowStatItem | undefined)[]; } export function Row(props: RowProps) {