chore: ads improved

This commit is contained in:
wonderlandpark 2021-05-31 11:35:50 +09:00
parent 25f9229fd1
commit ddef05d418
3 changed files with 23 additions and 17 deletions

View File

@ -5,12 +5,18 @@ const Advertisement: React.FC<AdvertisementProps> = ({ size = 'short' }) => {
useEffect(() => { useEffect(() => {
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
window.adsbygoogle = window.adsbygoogle || [] window.adsbygoogle = window.adsbygoogle || []
window.adsbygoogle.push({}) try {
window.adsbygoogle.push({})
Logger.debug('Ad Pushed')
}
catch {
Logger.debug('Ad Push Fail')
}
} }
Logger.debug('Ads Pushed')
}, []) }, [])
return ( return <div className='py-5'>
<div <div
className={`z-0 mx-auto w-full text-center text-white ${ className={`z-0 mx-auto w-full text-center text-white ${
process.env.NODE_ENV === 'production' ? '' : 'py-12 bg-gray-700' process.env.NODE_ENV === 'production' ? '' : 'py-12 bg-gray-700'
@ -19,18 +25,19 @@ const Advertisement: React.FC<AdvertisementProps> = ({ size = 'short' }) => {
> >
{process.env.NODE_ENV === 'production' ? ( {process.env.NODE_ENV === 'production' ? (
<ins <ins
className='adsbygoogle w-full' className='adsbygoogle'
style={{ display: 'inline-block', height: '90px' }} style={{ display: 'block', width: '100%' }}
data-ad-client='ca-pub-4856582423981759' data-ad-client='ca-pub-4856582423981759'
data-ad-slot='3250141451' data-ad-slot='3250141451'
data-adtest='on' data-ad-format='auto'
data-full-width-responsive='true' data-full-width-responsive='true'
></ins> data-adtest='on'
/>
) : ( ) : (
'Advertisement' 'Advertisement'
)} )}
</div> </div>
) </div>
} }
declare global { declare global {

View File

@ -53,11 +53,7 @@ class MyDocument extends Document {
{/* SCRIPT */} {/* SCRIPT */}
<script src='//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/highlight.min.js'></script> <script src='//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/highlight.min.js'></script>
<script <script async src='https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'></script>
data-ad-client='ca-pub-4856582423981759'
async
src='https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'
></script>
<script async src='https://www.googletagmanager.com/gtag/js?id=UA-165454387-1'></script> <script async src='https://www.googletagmanager.com/gtag/js?id=UA-165454387-1'></script>
<script <script
dangerouslySetInnerHTML={{ dangerouslySetInnerHTML={{

View File

@ -162,6 +162,9 @@ const Bots: NextPage<BotsProps> = ({ data, desc, date, user, theme, csrfToken })
</div> </div>
</div> </div>
<Divider className='px-5' /> <Divider className='px-5' />
<div className='hidden lg:block'>
<Advertisement />
</div>
<div className='lg:flex lg:flex-row-reverse' style={bg ? { color: 'white' } : {}}> <div className='lg:flex lg:flex-row-reverse' style={bg ? { color: 'white' } : {}}>
<div className='mb-1 w-full lg:w-1/4'> <div className='mb-1 w-full lg:w-1/4'>
<h2 className='3xl mb-2 font-bold'></h2> <h2 className='3xl mb-2 font-bold'></h2>
@ -310,9 +313,6 @@ const Bots: NextPage<BotsProps> = ({ data, desc, date, user, theme, csrfToken })
<Advertisement size='tall' /> <Advertisement size='tall' />
</div> </div>
<div className='w-full lg:pr-5 lg:w-3/4'> <div className='w-full lg:pr-5 lg:w-3/4'>
<div className='hidden lg:block'>
<Advertisement />
</div>
{ {
checkBotFlag(data.flags, 'hackerthon') ? <Segment className='mt-10'> checkBotFlag(data.flags, 'hackerthon') ? <Segment className='mt-10'>
<h1 className='text-3xl font-semibold'> <h1 className='text-3xl font-semibold'>
@ -326,9 +326,12 @@ const Bots: NextPage<BotsProps> = ({ data, desc, date, user, theme, csrfToken })
<Segment className='my-4'> <Segment className='my-4'>
<Markdown text={desc}/> <Markdown text={desc}/>
</Segment> </Segment>
<Advertisement />
</div> </div>
</div> </div>
</div>
<div className='pt-5'>
<Advertisement />
</div> </div>
</> </>
} }