From 2ed0a6963f160425c67e9c15b5ffcc86701b85e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 9 Jun 2024 23:35:35 -0500 Subject: [PATCH 1/9] Update cd-discover-ids.yml --- .github/workflows/cd-discover-ids.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd-discover-ids.yml b/.github/workflows/cd-discover-ids.yml index e63c6b4bf..6cb5e86b5 100644 --- a/.github/workflows/cd-discover-ids.yml +++ b/.github/workflows/cd-discover-ids.yml @@ -5,7 +5,7 @@ on: branches: main workflow_dispatch: schedule: - - cron: '0 8 * * *' + - cron: '0 */6 * * *' concurrency: group: ${{ github.workflow }}-${{ github.ref }} From 785407c8ff7440a2db4905c79e0cf41f2392dbc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 9 Jun 2024 23:40:40 -0500 Subject: [PATCH 2/9] Update discoverIds.ts --- scripts/discoverIds.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/discoverIds.ts b/scripts/discoverIds.ts index 9fadaf829..494682436 100644 --- a/scripts/discoverIds.ts +++ b/scripts/discoverIds.ts @@ -139,7 +139,7 @@ function post() { const idsSorted = ids.sort((a, b) => a - b); const idsChunked = chunk(idsSorted, CHUNK_SIZE); const files = idsChunked.map((ids, chunk) => { - const didsWriteStream = new DidsWriteStream().dids(idsSorted); + const didsWriteStream = new DidsWriteStream().dids(ids); const compressed = compress(didsWriteStream.uint8Array); const content = Buffer.from(compressed).toString('base64'); From fe9e300c80008def584de2bdd2557ca264883687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 9 Jun 2024 23:43:13 -0500 Subject: [PATCH 3/9] Update discoverIds.ts --- scripts/discoverIds.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/discoverIds.ts b/scripts/discoverIds.ts index 494682436..fd634a331 100644 --- a/scripts/discoverIds.ts +++ b/scripts/discoverIds.ts @@ -48,7 +48,7 @@ while (chunkIndex < preDiscoveredManifest.chunks) { }); // no spread syntax: https://github.com/oven-sh/bun/issues/11734 - preDiscovered.forEach((id) => ids.push(id)); + preDiscovered.forEach((id) => !ids.includes(id) && ids.push(id)); console.log( `Pre-discovered ${preDiscovered.length} ids (chunk ${chunkIndex})`, From 1fd9c9e6b032d92d411a9f2570f4ce9ca9324080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 9 Jun 2024 23:46:35 -0500 Subject: [PATCH 4/9] Update discoverIds.ts --- scripts/discoverIds.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/discoverIds.ts b/scripts/discoverIds.ts index fd634a331..dfd6eda8a 100644 --- a/scripts/discoverIds.ts +++ b/scripts/discoverIds.ts @@ -48,7 +48,9 @@ while (chunkIndex < preDiscoveredManifest.chunks) { }); // no spread syntax: https://github.com/oven-sh/bun/issues/11734 - preDiscovered.forEach((id) => !ids.includes(id) && ids.push(id)); + preDiscovered.forEach((id) => { + if (!ids.includes(id)) ids.push(id); + }); console.log( `Pre-discovered ${preDiscovered.length} ids (chunk ${chunkIndex})`, From e370a53473bd2eae9c4c71337145a047153520b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 9 Jun 2024 23:49:56 -0500 Subject: [PATCH 5/9] Update discoverIds.ts --- scripts/discoverIds.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/discoverIds.ts b/scripts/discoverIds.ts index dfd6eda8a..5d575deef 100644 --- a/scripts/discoverIds.ts +++ b/scripts/discoverIds.ts @@ -1,4 +1,4 @@ -import { chunk, times } from 'lodash'; +import { chunk, times, uniq } from 'lodash'; import { compress, decompress } from 'lz4js'; import { argv } from 'process'; import { REGIONS, Region } from '../src/constants/regions'; @@ -48,9 +48,7 @@ while (chunkIndex < preDiscoveredManifest.chunks) { }); // no spread syntax: https://github.com/oven-sh/bun/issues/11734 - preDiscovered.forEach((id) => { - if (!ids.includes(id)) ids.push(id); - }); + preDiscovered.forEach((id) => ids.push(id)); console.log( `Pre-discovered ${preDiscovered.length} ids (chunk ${chunkIndex})`, @@ -138,7 +136,7 @@ function post() { clearInterval(interval); console.log(`Uploading ${ids.length} ids...`); - const idsSorted = ids.sort((a, b) => a - b); + const idsSorted = uniq(ids).sort((a, b) => a - b); const idsChunked = chunk(idsSorted, CHUNK_SIZE); const files = idsChunked.map((ids, chunk) => { const didsWriteStream = new DidsWriteStream().dids(ids); From 626eb7e2d66415d651ac98194788292e35146c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 10 Jun 2024 13:52:25 -0500 Subject: [PATCH 6/9] feat: ads --- .vscode/settings.json | 1 + src/app/tools/tankopedia/page.tsx | 5 +++++ src/components/Ad.tsx | 21 +++++++++++++++++++++ src/components/Ads/Horizontal.tsx | 24 ------------------------ src/components/Party3.tsx | 2 +- 5 files changed, 28 insertions(+), 25 deletions(-) create mode 100644 src/components/Ad.tsx delete mode 100644 src/components/Ads/Horizontal.tsx diff --git a/.vscode/settings.json b/.vscode/settings.json index 7c8a532cb..923aa3721 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -93,6 +93,7 @@ "Minotauro", "MIPMAPCOUNT", "miĊĦek", + "mmnow", "modeltransform", "MURICA", "NEGATIVEX", diff --git a/src/app/tools/tankopedia/page.tsx b/src/app/tools/tankopedia/page.tsx index a2cb744af..a1bc1965f 100644 --- a/src/app/tools/tankopedia/page.tsx +++ b/src/app/tools/tankopedia/page.tsx @@ -3,6 +3,7 @@ import { Flex } from '@radix-ui/themes'; import Link from 'next/link'; import { useRouter } from 'next/navigation'; +import { Ad, AdType } from '../../../components/Ad'; import PageWrapper from '../../../components/PageWrapper'; import { TankSearch } from './components/TankSearch'; @@ -11,6 +12,10 @@ export default function Page() { return ( + + + + { router.push(`./tankopedia/${tank.id}`); diff --git a/src/components/Ad.tsx b/src/components/Ad.tsx new file mode 100644 index 000000000..d303ee603 --- /dev/null +++ b/src/components/Ad.tsx @@ -0,0 +1,21 @@ +'use client'; + +import { ComponentProps, useEffect } from 'react'; + +export enum AdType { + TankopediaHorizontal800 = 738182777, +} + +interface AdProps extends ComponentProps<'div'> { + type: AdType; +} + +export function Ad({ type, ...props }: AdProps) { + useEffect(() => { + (window as any).msAdsQueue.push(function () { + (window as any).mmnow.render({ adUnitId: type, elementId: type }); + }); + }); + + return
; +} diff --git a/src/components/Ads/Horizontal.tsx b/src/components/Ads/Horizontal.tsx deleted file mode 100644 index 4a66a4dcb..000000000 --- a/src/components/Ads/Horizontal.tsx +++ /dev/null @@ -1,24 +0,0 @@ -export function AdHorizontal() { - return ( - <> -