Skip to content

Commit

Permalink
Don't show MapWelcomeToTheNewWebsite() if embedded mode is active
Browse files Browse the repository at this point in the history
  • Loading branch information
keithamoss committed Aug 12, 2024
1 parent 52670ce commit f5df975
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions django/demsausage/app/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def get_map_screenshot(election):
# firefox_options.add_argument("--start-fullscreen")
# firefox_options.add_argument("--start-maximized")
firefox_options.binary_location = '/usr/lib/firefox-esr/firefox-esr'
firefox_options.set_preference("general.useragent.override", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/109.0; Demsausage-Webdriver-Screenshot-Service")

if os.path.isfile('/app/logs/webdriver/geckodriver.log') is False:
Path('/app/logs/webdriver/').mkdir(parents=True, exist_ok=True)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Election } from '../../app/services/elections';
import { getAPIBaseURL, getBaseURL } from '../../app/utils';

export const isEmbedModeActive = () => navigator.userAgent.includes('Demsausage-Webdriver-Screenshot-Service');

export const getEmbedStaticMapImageURL = (election: Election) => `${getAPIBaseURL()}/0.1/map_image/${election.id}/`;

// export const embedPrecannedMapBboxes = [
Expand Down
3 changes: 2 additions & 1 deletion public-redesign/src/features/map/map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { getAPIBaseURL, getBaseURL } from '../../app/utils';
import { selectMapFilterSettings, setPollingPlaces } from '../app/appSlice';
import { getDefaultElection, getViewForElection } from '../elections/electionHelpers';
import { selectAllElections, selectElectionById } from '../elections/electionsSlice';
import { isEmbedModeActive } from '../embedBuilder/embedBuilderHelpers';
import { getPollingPlaceIdsFromFeatures } from '../pollingPlaces/pollingPlaceHelpers';
import SearchBarCosmeticNonFunctional from '../search/searchByAddressOrGPS/searchBar/searchBarCosmeticNonFunctional';
import AddStallButton from './addStallButton/addStallButton';
Expand Down Expand Up @@ -265,7 +266,7 @@ function Map(props: Props) {
<SearchBarCosmeticNonFunctional />
</Box>

<MapWelcomeToTheNewWebsite />
{isEmbedModeActive() === false && <MapWelcomeToTheNewWebsite />}

<Backdrop sx={{ color: '#fff', zIndex: (theme) => theme.zIndex.drawer + 1 }} open={isMapDataLoading}>
<CircularProgress color="inherit" />
Expand Down

0 comments on commit f5df975

Please sign in to comment.