Show warning banner in non-prod environments#916
Conversation
Personally, I would never want this when running a local dev server, I obviously know it's not prod since I'm actively developing on localhost, and I agree that for dev you want the UI to be as real as possible for layouts/sizes/etc. Setting What if instead the banner can only render if |
| // otherwise overlay the EnvironmentBanner because both want to live at top: 0. | ||
| // We offset by the banner's height when the banner is showing so the banner | ||
| // stays visible above this header. | ||
| function Header ({ children, className }) { |
There was a problem hiding this comment.
Devin review caught this, I confirmed it does cause this issue with the scan modal layout
after:
Devin writeup:
The components/Header.jsx now applies a top offset based on shouldShowEnvironmentBanner, but this is incorrect when the Header is rendered inside a fullscreen Modal (e.g. ScanCodeModal at client/src/components/ScanCodeModal.jsx:150). Inside the modal, the environment banner is hidden behind the overlay, so the offset creates an unintended 40px gap.
Possible approaches:
1. Accept an optional prop (e.g. `disableBannerOffset`) on components/Header.jsx and pass it from ScanCodeModal.
2. Instead of computing the offset inside Header, let callers pass the top value explicitly (or default to 0) so context-aware parents can control it.
3. Use a React context or ref to detect whether the Header is inside a Modal and skip the offset.

Closes #760 , #912
In this PR
The problem this tries to solve is: "real users keep accidentally hitting the staging URL and being confused about why the data is not there, or why they can no longer log in. let's make it extremely obvious that they're not on the right URL, and easy to go to the right URL."
VITE_ENVIRONMENT_LABEL=PROD, which tells us that our current environment is production.This is a test siteand provides a link to production CareConnect.VITE_PRODUCTION_URL_OVERRIDEis set, the link will use the URL provided there. Otherwise it falls back to the primary Production URLhttps://reset.careconnect.sf.gov/login, hard-coded.Note that the env vars are build-time for Vite — they must be set when the deploy runs
npm run build, not at server runtime.Deployer instructions (Production)
Set
VITE_ENVIRONMENT_LABEL=PROD. This is the only way to hide the banner. Any other value, or omitting it, shows the banner.Deployer instructions (Dev/Staging/Etc)
Leave
VITE_ENVIRONMENT_LABELunset, or set it to anything exceptPRODDeveloper instructions
If you do nothing, then you will see the yellow banner in your local development and testing.
You may wish to hide the banner locally, to get a more accurate view of what a real user would see.) To do this:
client/.env, add:VITE_ENVIRONMENT_LABEL=PROD.Screenshots
Caveats
HIDE_ENVIRONMENT_BANNER(withtrue/false) instead of asking for aVITE_ENVIRONMENT_LABEL. But in the future it's possible we'd wire additional functionality that's environment-sensitive, or want to respond in a more granular way to the different environments, or make use of the provided label. So I did it this way.