From c26dd277a8529ca66b649e35021fae852ba3d322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Tue, 11 Jun 2024 13:36:02 -0500 Subject: [PATCH] feat: debug --- src/app/tools/tankopedia/page.tsx | 4 +-- src/components/Ad.tsx | 57 +++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/src/app/tools/tankopedia/page.tsx b/src/app/tools/tankopedia/page.tsx index a6b4a70b2..1db60188f 100644 --- a/src/app/tools/tankopedia/page.tsx +++ b/src/app/tools/tankopedia/page.tsx @@ -20,8 +20,8 @@ export default function Page() { /> - {times(2, () => ( - + {times(2, (index) => ( + ))} diff --git a/src/components/Ad.tsx b/src/components/Ad.tsx index afa0cc654..444e51679 100644 --- a/src/components/Ad.tsx +++ b/src/components/Ad.tsx @@ -1,18 +1,34 @@ 'use client'; +import { Box, Flex, Text } from '@radix-ui/themes'; import { uniqueId } from 'lodash'; import { ComponentProps, useEffect, useRef } from 'react'; +import { Vector2Tuple } from 'three'; +import { imgur } from '../core/blitzkit/imgur'; +import { useApp } from '../stores/app'; export enum AdType { - TankopediaHorizontal800 = 738182777, + MediumRectangleHorizontalPurple = 738182777, + LeaderboardHorizontalPurple = 84051521, + WideSkyscraperVerticalPurple = 1755617140, + HalfPageVerticalPurple = 880185176, } +const AD_DIMENSIONS: Record = { + [AdType.MediumRectangleHorizontalPurple]: [300, 250], + [AdType.LeaderboardHorizontalPurple]: [728, 90], + [AdType.WideSkyscraperVerticalPurple]: [160, 600], + [AdType.HalfPageVerticalPurple]: [300, 600], +}; + interface AdProps extends ComponentProps<'div'> { type: AdType; } export function Ad({ type, ...props }: AdProps) { const id = useRef(uniqueId()); + const dimensions = AD_DIMENSIONS[type]; + const developerMode = useApp((state) => state.developerMode); useEffect(() => { (window as any).msAdsQueue.push(function () { @@ -21,7 +37,42 @@ export function Ad({ type, ...props }: AdProps) { elementId: `${type}-${id.current}`, }); }); - }); + }, [type]); - return
; + return ( + + + {!developerMode && Advertisement} + {developerMode && ( + <> + + {AdType[type]} + + + {dimensions[0]}x{dimensions[1]} + + + )} + + + + + ); }