Skip to content

Commit 3ce9e5d

Browse files
authored
chore: don't show ad on no search result
1 parent 138ef55 commit 3ce9e5d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pages/search.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const SearchComponent: FC<{
5858
const Search: NextPage<SearchProps> = ({ botData, serverData, priority, query }) => {
5959
if (!query?.q) return <Redirect text={false} to='/' />
6060
const list: ('bot' | 'server')[] = ['bot', 'server']
61+
const resultNotExists = (!botData || botData.data.length === 0) && (!serverData || serverData.data.length === 0)
6162
return (
6263
<>
6364
<Hero
@@ -67,7 +68,7 @@ const Search: NextPage<SearchProps> = ({ botData, serverData, priority, query })
6768
/>
6869
<Container>
6970
<section id='list'>
70-
<Advertisement />
71+
{resultNotExists ? null : <Advertisement />}
7172
{(priority === 'server' ? list.reverse() : list).map((el) => (
7273
<SearchComponent
7374
key={el}
@@ -76,7 +77,7 @@ const Search: NextPage<SearchProps> = ({ botData, serverData, priority, query })
7677
type={el}
7778
/>
7879
))}
79-
<Advertisement />
80+
{resultNotExists ? null : <Advertisement />}
8081
</section>
8182
</Container>
8283
</>

0 commit comments

Comments
 (0)