mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-26 12:09:50 +01: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 { Box, type BoxProps } from '@radix-ui/themes';
|
||||||
import { uniqueId } from 'lodash-es';
|
import { useEffect } from 'react';
|
||||||
import { useEffect, useRef } from 'react';
|
|
||||||
|
|
||||||
type AdProps = BoxProps & {};
|
type AdProps = BoxProps & {
|
||||||
|
id: string;
|
||||||
export function Ad({ ...props }: AdProps) {
|
};
|
||||||
const id = useRef(uniqueId('ad-'));
|
|
||||||
|
|
||||||
|
export function Ad({ id, ...props }: AdProps) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(window as any).nitroAds.createAd(id.current, {
|
(window as any).nitroAds.createAd(id, {
|
||||||
refreshTime: 30,
|
refreshTime: 30,
|
||||||
demo: import.meta.env.MODE === 'development',
|
demo: import.meta.env.MODE === 'development',
|
||||||
renderVisibleOnly: true,
|
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"
|
position="relative"
|
||||||
width="100%"
|
width="100%"
|
||||||
>
|
>
|
||||||
<Flex direction="column" align="center" gap="1">
|
<Flex direction="column" align="center">
|
||||||
<Heading size="9" weight="bold" align="center">
|
<Heading size="9" weight="bold" align="center">
|
||||||
<Flex
|
<Flex
|
||||||
align="center"
|
align="center"
|
||||||
@@ -68,7 +68,7 @@ const isBranchNamed =
|
|||||||
{
|
{
|
||||||
!isBranchNamed && (
|
!isBranchNamed && (
|
||||||
<Text color="gray" align="center" size="4">
|
<Text color="gray" align="center" size="4">
|
||||||
Everything World of Tanks Blitz
|
By TrèsAbhi ❤️
|
||||||
</Text>
|
</Text>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,14 @@ import {
|
|||||||
type TankDefinition,
|
type TankDefinition,
|
||||||
} from '@blitzkit/core';
|
} from '@blitzkit/core';
|
||||||
import { useStore } from '@nanostores/react';
|
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 fuzzysort from 'fuzzysort';
|
||||||
import { times } from 'lodash-es';
|
import { times } from 'lodash-es';
|
||||||
import { Fragment, memo, useEffect, useMemo, useState } from 'react';
|
import { Fragment, memo, useEffect, useMemo, useState } from 'react';
|
||||||
@@ -23,7 +30,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 { AdMidSectionResponsive } from '../AdMidSectionResponsive';
|
import { Ad } from '../Ad';
|
||||||
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';
|
||||||
@@ -471,7 +478,9 @@ export const TankSearch = memo<TankSearchProps>(
|
|||||||
!compact &&
|
!compact &&
|
||||||
(index + 16) % 32 === 0 &&
|
(index + 16) % 32 === 0 &&
|
||||||
index !== tanks.length - 1 && (
|
index !== tanks.length - 1 && (
|
||||||
<AdMidSectionResponsive gridColumn="1 / -1" />
|
<Box gridColumn="1 / -1">
|
||||||
|
<Ad id={`ad-${index}`} />
|
||||||
|
</Box>
|
||||||
)}
|
)}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
))}
|
))}
|
||||||
|
|||||||
+3
-3
@@ -31,7 +31,6 @@ import { useEquipment } from '../../../../../hooks/useEquipment';
|
|||||||
import { useTankModelDefinition } from '../../../../../hooks/useTankModelDefinition';
|
import { useTankModelDefinition } from '../../../../../hooks/useTankModelDefinition';
|
||||||
import { Duel } from '../../../../../stores/duel';
|
import { Duel } from '../../../../../stores/duel';
|
||||||
import { TankopediaEphemeral } from '../../../../../stores/tankopediaEphemeral';
|
import { TankopediaEphemeral } from '../../../../../stores/tankopediaEphemeral';
|
||||||
import { Ad, AdType } from '../../../../Ad';
|
|
||||||
import { Info } from './components/Info';
|
import { Info } from './components/Info';
|
||||||
import { InfoWithDelta } from './components/InfoWithDelta';
|
import { InfoWithDelta } from './components/InfoWithDelta';
|
||||||
|
|
||||||
@@ -504,7 +503,8 @@ export function Characteristics() {
|
|||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
{!exempt && (
|
{/* AD TODO: */}
|
||||||
|
{/* {!exempt && (
|
||||||
<Flex
|
<Flex
|
||||||
justify="center"
|
justify="center"
|
||||||
display={{
|
display={{
|
||||||
@@ -514,7 +514,7 @@ export function Characteristics() {
|
|||||||
>
|
>
|
||||||
<Ad type={AdType.MediumRectangleHorizontalPurple} />
|
<Ad type={AdType.MediumRectangleHorizontalPurple} />
|
||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)} */}
|
||||||
|
|
||||||
<Flex direction="column" gap="8" style={{ flex: 1 }}>
|
<Flex direction="column" gap="8" style={{ flex: 1 }}>
|
||||||
<Flex direction="column" gap="2">
|
<Flex direction="column" gap="2">
|
||||||
|
|||||||
@@ -24,13 +24,7 @@ import RootLayout from '../layouts/RootLayout.astro';
|
|||||||
<Flex maxWidth="64rem" flexGrow="1" gap="4" direction="column">
|
<Flex maxWidth="64rem" flexGrow="1" gap="4" direction="column">
|
||||||
<ToolCard tool={tankopediaTool} />
|
<ToolCard tool={tankopediaTool} />
|
||||||
|
|
||||||
{
|
<Ad client:only="react" id="ad-1" />
|
||||||
(
|
|
||||||
<Flex justify="center">
|
|
||||||
<Ad client:only="react" />
|
|
||||||
</Flex>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
<Flex gap="4" direction={{ initial: 'column', sm: 'row' }}>
|
<Flex gap="4" direction={{ initial: 'column', sm: 'row' }}>
|
||||||
{/* <ToolCard tool={playerStatsTool} /> */}
|
{/* <ToolCard tool={playerStatsTool} /> */}
|
||||||
@@ -41,34 +35,20 @@ import RootLayout from '../layouts/RootLayout.astro';
|
|||||||
<Flex gap="4" direction={{ initial: 'column', sm: 'row' }}>
|
<Flex gap="4" direction={{ initial: 'column', sm: 'row' }}>
|
||||||
<ToolCard tool={sessionTool} />
|
<ToolCard tool={sessionTool} />
|
||||||
{/* <ToolCard tool={embedTool} /> */}
|
{/* <ToolCard tool={embedTool} /> */}
|
||||||
<!-- <ToolCard tool={ratingTool} /> -->
|
{/* <ToolCard tool={ratingTool} /> */}
|
||||||
<ToolCard tool={discordTool} />
|
<ToolCard tool={discordTool} />
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<!-- {
|
<Ad client:only="react" id="ad-2" />
|
||||||
!exempt && (
|
|
||||||
<Flex
|
|
||||||
justify="center"
|
|
||||||
display={{
|
|
||||||
initial: 'flex',
|
|
||||||
md: 'none',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<AdMidSectionResponsive />
|
|
||||||
</Flex>
|
|
||||||
)
|
|
||||||
} -->
|
|
||||||
|
|
||||||
<Flex gap="4" direction={{ initial: 'column', sm: 'row' }}>
|
<Flex gap="4" direction={{ initial: 'column', sm: 'row' }}>
|
||||||
<ToolCard tool={moreTool} />
|
<ToolCard tool={moreTool} />
|
||||||
<Box flexGrow="1" />
|
<Box flexGrow="1" />
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<!-- {!exempt && <AdMidSectionResponsive />} -->
|
<Heading align="center" mt="6">Other cool projects</Heading>
|
||||||
|
|
||||||
<Heading mt="6">Other cool projects</Heading>
|
<Flex gap="4" mb="6" direction={{ initial: 'column', sm: 'row' }}>
|
||||||
|
|
||||||
<Flex gap="4" direction={{ initial: 'column', sm: 'row' }}>
|
|
||||||
<ToolCard
|
<ToolCard
|
||||||
tool={{
|
tool={{
|
||||||
button: {
|
button: {
|
||||||
|
|||||||
Reference in new issue
Block a user