mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: ad placements
This commit is contained in:
1 parent
749d3fa7c5
commit
11bbe9309e
5 files changed
+29
-41
No files matched your search
@@ -1,14 +1,13 @@
|
||||
import { Box, type BoxProps } from '@radix-ui/themes';
|
||||
import { uniqueId } from 'lodash-es';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
type AdProps = BoxProps & {};
|
||||
|
||||
export function Ad({ ...props }: AdProps) {
|
||||
const id = useRef(uniqueId('ad-'));
|
||||
type AdProps = BoxProps & {
|
||||
id: string;
|
||||
};
|
||||
|
||||
export function Ad({ id, ...props }: AdProps) {
|
||||
useEffect(() => {
|
||||
(window as any).nitroAds.createAd(id.current, {
|
||||
(window as any).nitroAds.createAd(id, {
|
||||
refreshTime: 30,
|
||||
demo: import.meta.env.MODE === 'development',
|
||||
renderVisibleOnly: true,
|
||||
@@ -22,5 +21,5 @@ export function Ad({ ...props }: AdProps) {
|
||||
});
|
||||
}, []);
|
||||
|
||||
return <Box id={id.current} width="100%" {...props} />;
|
||||
return <Box id={id} width="100%" {...props} />;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ const isBranchNamed =
|
||||
position="relative"
|
||||
width="100%"
|
||||
>
|
||||
<Flex direction="column" align="center" gap="1">
|
||||
<Flex direction="column" align="center">
|
||||
<Heading size="9" weight="bold" align="center">
|
||||
<Flex
|
||||
align="center"
|
||||
@@ -68,7 +68,7 @@ const isBranchNamed =
|
||||
{
|
||||
!isBranchNamed && (
|
||||
<Text color="gray" align="center" size="4">
|
||||
Everything World of Tanks Blitz
|
||||
By TrèsAbhi ❤️
|
||||
</Text>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,14 @@ import {
|
||||
type TankDefinition,
|
||||
} from '@blitzkit/core';
|
||||
import { useStore } from '@nanostores/react';
|
||||
import { Callout, Flex, Link, Text, type FlexProps } from '@radix-ui/themes';
|
||||
import {
|
||||
Box,
|
||||
Callout,
|
||||
Flex,
|
||||
Link,
|
||||
Text,
|
||||
type FlexProps,
|
||||
} from '@radix-ui/themes';
|
||||
import fuzzysort from 'fuzzysort';
|
||||
import { times } from 'lodash-es';
|
||||
import { Fragment, memo, useEffect, useMemo, useState } from 'react';
|
||||
@@ -23,7 +30,7 @@ import {
|
||||
SORT_UNITS,
|
||||
} from '../../stores/tankopediaPersistent/constants';
|
||||
import { $tankopediaSort } from '../../stores/tankopediaSort';
|
||||
import { AdMidSectionResponsive } from '../AdMidSectionResponsive';
|
||||
import { Ad } from '../Ad';
|
||||
import { ExperimentIcon } from '../ExperimentIcon';
|
||||
import { FilterControl } from './components/FilterControl';
|
||||
import { NoResults } from './components/NoResults';
|
||||
@@ -471,7 +478,9 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
!compact &&
|
||||
(index + 16) % 32 === 0 &&
|
||||
index !== tanks.length - 1 && (
|
||||
<AdMidSectionResponsive gridColumn="1 / -1" />
|
||||
<Box gridColumn="1 / -1">
|
||||
<Ad id={`ad-${index}`} />
|
||||
</Box>
|
||||
)}
|
||||
</Fragment>
|
||||
))}
|
||||
|
||||
+3
-3
@@ -31,7 +31,6 @@ import { useEquipment } from '../../../../../hooks/useEquipment';
|
||||
import { useTankModelDefinition } from '../../../../../hooks/useTankModelDefinition';
|
||||
import { Duel } from '../../../../../stores/duel';
|
||||
import { TankopediaEphemeral } from '../../../../../stores/tankopediaEphemeral';
|
||||
import { Ad, AdType } from '../../../../Ad';
|
||||
import { Info } from './components/Info';
|
||||
import { InfoWithDelta } from './components/InfoWithDelta';
|
||||
|
||||
@@ -504,7 +503,8 @@ export function Characteristics() {
|
||||
</Flex>
|
||||
</Flex>
|
||||
|
||||
{!exempt && (
|
||||
{/* AD TODO: */}
|
||||
{/* {!exempt && (
|
||||
<Flex
|
||||
justify="center"
|
||||
display={{
|
||||
@@ -514,7 +514,7 @@ export function Characteristics() {
|
||||
>
|
||||
<Ad type={AdType.MediumRectangleHorizontalPurple} />
|
||||
</Flex>
|
||||
)}
|
||||
)} */}
|
||||
|
||||
<Flex direction="column" gap="8" style={{ flex: 1 }}>
|
||||
<Flex direction="column" gap="2">
|
||||
|
||||
Reference in new issue
Block a user