feat: better ad discriminators

This commit is contained in:
TrèsAbhi committed 2024-10-12 21:42:38 -05:00
1 parent dea84321d4
commit d8d1b4a016
2 files changed
+21 -15

No files matched your search

@@ -470,20 +470,26 @@ export const TankSearch = memo<TankSearchProps>(
<> <>
{tanks.length > 0 && ( {tanks.length > 0 && (
<TankCardWrapper> <TankCardWrapper>
{tanks.map((tank, index) => ( {tanks.map((tank, index) => {
<Fragment key={tank.id}> const hasAd = (index + 16) % 32 === 0;
<TankCard onSelect={onSelect} tank={tank} />
{!exempt && return (
!compact && <Fragment key={tank.id}>
(index + 16) % 32 === 0 && <TankCard onSelect={onSelect} tank={tank} />
index !== tanks.length - 1 && (
<Box gridColumn="1 / -1"> {!exempt &&
<Ad id={`ad-${index}`} /> !compact &&
</Box> hasAd &&
)} index !== tanks.length - 1 && (
</Fragment> <Box gridColumn="1 / -1">
))} <Ad
id={`tankopedia-search-ad-${Math.floor(index / 32)}`}
/>
</Box>
)}
</Fragment>
);
})}
{times( {times(
Math.min(PREVIEW_COUNT, tanksFiltered.length - loadedRows), Math.min(PREVIEW_COUNT, tanksFiltered.length - loadedRows),
+2 -2
View File
@@ -24,7 +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" /> <Ad client:only="react" id="homepage-ad-1" />
<Flex gap="4" direction={{ initial: 'column', sm: 'row' }}> <Flex gap="4" direction={{ initial: 'column', sm: 'row' }}>
{/* <ToolCard tool={playerStatsTool} /> */} {/* <ToolCard tool={playerStatsTool} /> */}
@@ -39,7 +39,7 @@ import RootLayout from '../layouts/RootLayout.astro';
<ToolCard tool={discordTool} /> <ToolCard tool={discordTool} />
</Flex> </Flex>
<Ad client:only="react" id="ad-2" /> <Ad client:only="react" id="homepage-ad-2" />
<Flex gap="4" direction={{ initial: 'column', sm: 'row' }}> <Flex gap="4" direction={{ initial: 'column', sm: 'row' }}>
<ToolCard tool={moreTool} /> <ToolCard tool={moreTool} />