Skip to content

Commit

Permalink
Tell firefox users to tick box
Browse files Browse the repository at this point in the history
  • Loading branch information
IanPhilips committed Sep 30, 2024
1 parent 08e7a3c commit 07bce24
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
26 changes: 23 additions & 3 deletions web/components/gidx/location-monitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Col } from '../layout/col'
import { Contract } from 'common/contract'
import { TRADE_TERM } from 'common/envs/constants'
import { useState, useEffect } from 'react'
import Image from 'next/image'

export const LocationMonitor = (props: {
contract: Contract
Expand Down Expand Up @@ -36,11 +37,12 @@ export const LocationMonitor = (props: {
return null
}
return (
<Col className="py-2">
<Col className="gap-2 py-2">
<span className="text-xl font-semibold">
Location required to participate in sweepstakes
</span>
<div className="mt-2 flex">
<FirefoxWarning />
<div className="flex">
<Button
size="xl"
loading={loading}
Expand All @@ -55,12 +57,30 @@ export const LocationMonitor = (props: {
</span>
)}
{monitorStatus !== 'success' && (
<span className="mt-2 text-red-500">{monitorStatusMessage}</span>
<span className=" text-red-500">{monitorStatusMessage}</span>
)}
</Col>
)
}

export const FirefoxWarning = () => {
const isFirefox =
typeof window !== 'undefined' &&
navigator.userAgent.toLowerCase().indexOf('firefox') > -1

if (isFirefox) {
return (
<Image
src="/firefox-remember.png"
alt="Firefox Remember Location"
width={500}
height={200}
/>
)
}
return null
}

export const useShowAfterLoadingTime = (
loading: boolean,
thresholdMS: number
Expand Down
4 changes: 3 additions & 1 deletion web/components/gidx/location-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useLocation } from 'web/hooks/use-location'
import { LoadingIndicator } from '../widgets/loading-indicator'
import { useEffect } from 'react'
import { useNativeInfo } from '../native-message-provider'
import { useShowAfterLoadingTime } from './location-monitor'
import { FirefoxWarning, useShowAfterLoadingTime } from './location-monitor'
import { Col } from '../layout/col'

export const LocationPanel = (props: {
Expand Down Expand Up @@ -47,6 +47,7 @@ export const LocationPanel = (props: {
return (
<Col>
<LoadingIndicator />
<FirefoxWarning />
{showLoadingNote && (
<span className="text-warning mt-2">
Loading location may take a while, hold on!
Expand All @@ -64,6 +65,7 @@ export const LocationPanel = (props: {
You must allow location sharing to verify that you're in a participating
municipality.
</span>
<FirefoxWarning />
<BottomRow>
<Button color={'gray-white'} onClick={back}>
Back
Expand Down
Binary file added web/public/firefox-remember.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 07bce24

Please sign in to comment.