Skip to content

Commit

Permalink
Added overflow hidden to landing page
Browse files Browse the repository at this point in the history
  • Loading branch information
Spicer Matthews committed Jan 20, 2024
1 parent b8df929 commit a9408c3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 266 deletions.
253 changes: 0 additions & 253 deletions src/__tests__/pages/index.moduleLoad.test.js

This file was deleted.

25 changes: 16 additions & 9 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { isNil } from 'lodash/lang'
import clsx from 'clsx'
import dayjs from 'dayjs'
import { graphql } from 'react-relay'
import { AdComponent, fetchAds } from 'tab-ads'
import { AdComponent } from 'tab-ads'
import { v4 as uuid } from 'uuid'
import { get } from 'lodash/object'
import {
Expand All @@ -17,6 +17,7 @@ import {
import moment from 'moment'
import { useGrowthBook } from '@growthbook/growthbook-react'
import gtag from 'ga-gtag'
import { goTo } from 'src/utils/navigation'

// custom components
import Achievement from 'src/components/Achievement'
Expand Down Expand Up @@ -53,14 +54,7 @@ import LogTabMutation from 'src/utils/mutations/LogTabMutation'
import UpdateImpactMutation from 'src/utils/mutations/UpdateImpactMutation'
import LogUserRevenueMutation from 'src/utils/mutations/LogUserRevenueMutation'
import SetHasViewedIntroFlowMutation from 'src/utils/mutations/SetHasViewedIntroFlowMutation'
import { getCurrentURL, goTo } from 'src/utils/navigation'
import {
getAdUnits,
areAdsEnabled,
showMockAds,
isGAMDevEnvironment,
incrementTabsOpenedToday,
} from 'src/utils/adHelpers'
import { getAdUnits, incrementTabsOpenedToday } from 'src/utils/adHelpers'
import { isClientSide } from 'src/utils/ssr'
import { aboutURL, accountURL, achievementsURL } from 'src/utils/urls'
import {
Expand Down Expand Up @@ -478,6 +472,19 @@ const Index = ({ data: fallbackData, userAgent }) => {
const showAchievements = showMockAchievements()
const enableBackgroundImages = showBackgroundImages()

// No scolling on this home page.
useEffect(() => {
// Add the style when the component mounts
// eslint-disable-next-line no-undef
document.body.style.overflow = 'hidden'

// Revert back to the initial style when the component unmounts
return () => {
// eslint-disable-next-line no-undef
document.body.style.overflow = ''

Check warning on line 484 in src/pages/index.js

View check run for this annotation

Codecov / codecov/patch

src/pages/index.js#L484

Added line #L484 was not covered by tests
}
}, [])

// Determine which ad units we'll show only once, on mount,
// because the ads have already been fetched and won't change.
const [adUnits, setAdUnits] = useState([])
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15315,10 +15315,10 @@ synchronous-promise@^2.0.15:
resolved "https://registry.yarnpkg.com/synchronous-promise/-/synchronous-promise-2.0.16.tgz#669b75e86b4295fdcc1bb0498de9ac1af6fd51a9"
integrity sha512-qImOD23aDfnIDNqlG1NOehdB9IYsn1V9oByPjKY1nakv2MQYCEMyX033/q+aEtYCpmYK1cv2+NTmlH+ra6GA5A==

tab-ads@^1.1.23:
version "1.1.23"
resolved "https://registry.yarnpkg.com/tab-ads/-/tab-ads-1.1.23.tgz#aa02b7ce727d42ef0310cbb56b56e1b982090cc1"
integrity sha512-hhWhLGoUiuZDokqMG37yDzgfUMZUuDh9K/AlU2yLSBWL/1ZIif5jqCISHp3P9NG6u8TGS1L/Lt/pBCF6oav3EA==
tab-ads@^1.1.24:
version "1.1.24"
resolved "https://registry.yarnpkg.com/tab-ads/-/tab-ads-1.1.24.tgz#11ed0dc5ea991f8239a1f2040f01eada44937998"
integrity sha512-xQqLIlGfQ6T7BxQj730L2arM+dQqUHYqtm52z9M0bykeo4C5hwkqXtu5cLYSp2ff4rdHw+tj7w6z/gDJUjM92w==
dependencies:
lodash "^4.17.21"

Expand Down

0 comments on commit a9408c3

Please sign in to comment.