Skip to content

Commit

Permalink
fix: Banner breaking production tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisblackburn committed Sep 9, 2024
1 parent 07a6bfb commit 24ccba2
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions app/components/banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,12 @@ import { useEffect, useState } from 'react'
import { Icon } from './ui/icon'

export default function Banner() {
// TODO: This should be set back to true if there is a new feature announcement
const [isBannerSeen, setIsBannerSeen] = useState(false)
const [showBanner, setIsBannerSeen] = useState(false)

useEffect(() => {
if (process.env.NODE_ENV === 'test') return
// eslint-disable-next-line no-warning-comments
// FIXME: This should be removed when the playwright tests are fixed
if (process.env.NODE_ENV === 'development') return

const isBannerSeen = window.localStorage.getItem('isBannerSeen')

if (isBannerSeen === null) {
window.localStorage.setItem('isBannerSeen', String(true))
setIsBannerSeen(true)
return
}
// TODO: Add logic to show the banner if there is a new feature announcement and reset the local storage value

setIsBannerSeen(isBannerSeen === 'true')
}, [])
Expand All @@ -28,7 +18,7 @@ export default function Banner() {
setIsBannerSeen(false)
}

if (!isBannerSeen) {
if (!showBanner) {
return null
}

Expand Down

0 comments on commit 24ccba2

Please sign in to comment.