mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
feat: report buttons
This commit is contained in:
1 parent
ec9a3cb2ce
commit
ea70033b08
6 files changed
+23
-58
No files matched your search
@@ -1,44 +1,11 @@
|
|||||||
import { Box, type BoxProps } from '@radix-ui/themes';
|
import { Box, type BoxProps } from '@radix-ui/themes';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import type { Vector2Tuple } from 'three';
|
|
||||||
|
|
||||||
export type AdProps = BoxProps & {
|
export type AdProps = BoxProps & {
|
||||||
id: string;
|
id: string;
|
||||||
commonHeight: 250;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export enum MaxAdSize {
|
export function Ad({ id, ...props }: AdProps) {
|
||||||
Size728x90,
|
|
||||||
Size970x90,
|
|
||||||
Size970x250,
|
|
||||||
Size300x250,
|
|
||||||
Size336x280,
|
|
||||||
Size320x50,
|
|
||||||
Size320x100,
|
|
||||||
Size320x480,
|
|
||||||
Size160x600,
|
|
||||||
Size300x600,
|
|
||||||
}
|
|
||||||
|
|
||||||
const MAX_AD_SIZES: Record<MaxAdSize, Vector2Tuple> = {
|
|
||||||
[MaxAdSize.Size728x90]: [728, 90],
|
|
||||||
[MaxAdSize.Size970x90]: [970, 90],
|
|
||||||
[MaxAdSize.Size970x250]: [970, 250],
|
|
||||||
[MaxAdSize.Size300x250]: [300, 250],
|
|
||||||
[MaxAdSize.Size336x280]: [336, 280],
|
|
||||||
[MaxAdSize.Size320x50]: [320, 50],
|
|
||||||
[MaxAdSize.Size320x100]: [320, 100],
|
|
||||||
[MaxAdSize.Size320x480]: [320, 480],
|
|
||||||
[MaxAdSize.Size160x600]: [160, 600],
|
|
||||||
[MaxAdSize.Size300x600]: [300, 600],
|
|
||||||
};
|
|
||||||
|
|
||||||
export function Ad({ id, commonHeight, ...props }: AdProps) {
|
|
||||||
// const [width, height] =
|
|
||||||
// maxAdSize === undefined
|
|
||||||
// ? [undefined, undefined]
|
|
||||||
// : MAX_AD_SIZES[maxAdSize].map((dimension) => `${dimension}px`);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(window as any).nitroAds.createAd(id, {
|
(window as any).nitroAds.createAd(id, {
|
||||||
refreshTime: 30,
|
refreshTime: 30,
|
||||||
@@ -46,21 +13,13 @@ export function Ad({ id, commonHeight, ...props }: AdProps) {
|
|||||||
renderVisibleOnly: true,
|
renderVisibleOnly: true,
|
||||||
delayLoading: true,
|
delayLoading: true,
|
||||||
report: {
|
report: {
|
||||||
enabled: false,
|
enabled: true,
|
||||||
icon: true,
|
icon: true,
|
||||||
wording: 'Report Ad',
|
wording: 'Report Ad',
|
||||||
position: 'top-right',
|
position: 'top-right-side',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}, [id]);
|
}, [id]);
|
||||||
|
|
||||||
return (
|
return <Box id={id} className="ad-container" {...props} />;
|
||||||
<Box
|
|
||||||
id={id}
|
|
||||||
width="100%"
|
|
||||||
className="ad-container"
|
|
||||||
height={commonHeight ? `${commonHeight}px` : 'auto'}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { Ad, type AdProps } from './Ad';
|
||||||
|
|
||||||
|
type AdResponsiveHorizontal = AdProps;
|
||||||
|
|
||||||
|
export function AdResponsiveHorizontal(props: AdResponsiveHorizontal) {
|
||||||
|
return <Ad height="250px" width="100%" {...props} />;
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Flex, Table } from '@radix-ui/themes';
|
import { Flex, Table } from '@radix-ui/themes';
|
||||||
import { Ad } from './Ad';
|
import { AdResponsiveHorizontal } from './AdResponsiveHorizontal';
|
||||||
|
|
||||||
interface AdStickyTableRowProps {
|
interface AdStickyTableRowProps {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -16,7 +16,7 @@ export function AdStickyTableRow({ id }: AdStickyTableRowProps) {
|
|||||||
width="100%"
|
width="100%"
|
||||||
left="0"
|
left="0"
|
||||||
>
|
>
|
||||||
<Ad commonHeight={250} id={id} />
|
<AdResponsiveHorizontal id={id} />
|
||||||
</Flex>
|
</Flex>
|
||||||
</Table.Row>
|
</Table.Row>
|
||||||
</Table.Body>
|
</Table.Body>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import {
|
|||||||
SORT_UNITS,
|
SORT_UNITS,
|
||||||
} from '../../stores/tankopediaPersistent/constants';
|
} from '../../stores/tankopediaPersistent/constants';
|
||||||
import { $tankopediaSort } from '../../stores/tankopediaSort';
|
import { $tankopediaSort } from '../../stores/tankopediaSort';
|
||||||
import { Ad } from '../Ad';
|
import { AdResponsiveHorizontal } from '../AdResponsiveHorizontal';
|
||||||
import { ExperimentIcon } from '../ExperimentIcon';
|
import { ExperimentIcon } from '../ExperimentIcon';
|
||||||
import { FilterControl } from './components/FilterControl';
|
import { FilterControl } from './components/FilterControl';
|
||||||
import { NoResults } from './components/NoResults';
|
import { NoResults } from './components/NoResults';
|
||||||
@@ -476,8 +476,7 @@ export const TankSearch = memo<TankSearchProps>(
|
|||||||
hasAd &&
|
hasAd &&
|
||||||
index !== tanks.length - 1 && (
|
index !== tanks.length - 1 && (
|
||||||
<Flex gridColumn="1 / -1">
|
<Flex gridColumn="1 / -1">
|
||||||
<Ad
|
<AdResponsiveHorizontal
|
||||||
commonHeight={250}
|
|
||||||
id={`tankopedia-search-${adId}`}
|
id={`tankopedia-search-${adId}`}
|
||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
import { Box, Flex, Heading } from '@radix-ui/themes';
|
import { Box, Flex, Heading } from '@radix-ui/themes';
|
||||||
import { Ad } from '../components/Ad.tsx';
|
import { AdResponsiveHorizontal } from '../components/AdResponsiveHorizontal';
|
||||||
import HomeHero from '../components/HomeHero.astro';
|
import HomeHero from '../components/HomeHero.astro';
|
||||||
import { Plugs } from '../components/Plugs.tsx';
|
import { Plugs } from '../components/Plugs.tsx';
|
||||||
import ToolCard from '../components/ToolCard.astro';
|
import ToolCard from '../components/ToolCard.astro';
|
||||||
@@ -25,7 +25,7 @@ import BaseLayout from '../layouts/BaseLayout.astro';
|
|||||||
<ToolCard tool={tankopediaTool} />
|
<ToolCard tool={tankopediaTool} />
|
||||||
|
|
||||||
<Flex justify="center">
|
<Flex justify="center">
|
||||||
<Ad client:idle id="homepage-1" commonHeight={250} />
|
<AdResponsiveHorizontal client:idle id="homepage-1" />
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Flex gap="4" direction={{ initial: 'column', sm: 'row' }}>
|
<Flex gap="4" direction={{ initial: 'column', sm: 'row' }}>
|
||||||
@@ -42,7 +42,7 @@ import BaseLayout from '../layouts/BaseLayout.astro';
|
|||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Flex justify="center">
|
<Flex justify="center">
|
||||||
<Ad client:idle id="homepage-2" commonHeight={250} />
|
<AdResponsiveHorizontal client:idle id="homepage-2" />
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Flex gap="4" direction={{ initial: 'column', sm: 'row' }}>
|
<Flex gap="4" direction={{ initial: 'column', sm: 'row' }}>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
fetchProvisionDefinitions,
|
fetchProvisionDefinitions,
|
||||||
fetchTankDefinitions,
|
fetchTankDefinitions,
|
||||||
} from '@blitzkit/core';
|
} from '@blitzkit/core';
|
||||||
import { Ad } from '../../../../components/Ad';
|
import { AdResponsiveHorizontal } from '../../../../components/AdResponsiveHorizontal';
|
||||||
import { PageWrapper } from '../../../../components/PageWrapper';
|
import { PageWrapper } from '../../../../components/PageWrapper';
|
||||||
import { CalloutsSection } from '../../../../components/Tankopedia/CalloutsSection';
|
import { CalloutsSection } from '../../../../components/Tankopedia/CalloutsSection';
|
||||||
import { CharacteristicsSection } from '../../../../components/Tankopedia/CharacteristicsSection';
|
import { CharacteristicsSection } from '../../../../components/Tankopedia/CharacteristicsSection';
|
||||||
@@ -48,16 +48,16 @@ export function Page({ id }: PageProps) {
|
|||||||
>
|
>
|
||||||
<HeroSection />
|
<HeroSection />
|
||||||
<ShotDisplaySection />
|
<ShotDisplaySection />
|
||||||
<Ad id="tankopedia-1" commonHeight={250} />
|
<AdResponsiveHorizontal id="tankopedia-1" />
|
||||||
<CalloutsSection />
|
<CalloutsSection />
|
||||||
<MetaSection />
|
<MetaSection />
|
||||||
<TechTreeSection />
|
<TechTreeSection />
|
||||||
<Ad id="tankopedia-2" commonHeight={250} />
|
<AdResponsiveHorizontal id="tankopedia-2" />
|
||||||
<CharacteristicsSection />
|
<CharacteristicsSection />
|
||||||
<Ad id="tankopedia-3" commonHeight={250} />
|
<AdResponsiveHorizontal id="tankopedia-3" />
|
||||||
<GameModeSection />
|
<GameModeSection />
|
||||||
<VideoSection />
|
<VideoSection />
|
||||||
<Ad id="tankopedia-4" commonHeight={250} />
|
<AdResponsiveHorizontal id="tankopedia-4" />
|
||||||
<HistorySection />
|
<HistorySection />
|
||||||
</PageWrapper>
|
</PageWrapper>
|
||||||
</Duel.Provider>
|
</Duel.Provider>
|
||||||
|
|||||||
Reference in new issue
Block a user