Add sex field, rare-group warning, and timeout fallback banner#2
Merged
Conversation
… banner - DonorRegistration: add optional sex selector (M/F) and pass it to /donor/register so the backend can apply the correct donation cooldown (90d male, 120d female) - PatientIntakeView: save blood group and rare_group flag to sessionStorage on trigger so the results screen can display context without an extra API round-trip - PatientResultsView: read session cache to show rare blood group warning banner; surface unconfirmed_fallback banner when no hospital has responded after timeout; add mock timeout simulation toggle for demo purposes - api.ts: add rare_group? to EmergencyResponse and unconfirmed_fallback? to EmergencyStatusResponse; wire sex param through registerDonor call
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…fix stale closure - Restore donorsAlerted setter (was frozen at 5); wire data.donors_alerted from updateStateFromPayload so the real API value is reflected in the UI - Revert isMockMode default from opt-out (!== 'false') back to opt-in (=== 'true') so fresh production visitors hit the real API, not the mock simulation - Add useRef guard to the localStorage write-back effect so the initial default is never baked into storage for users who never explicitly toggled mock mode - Add mockTimeoutSimulation to the polling effect dependency array so the TIMEOUT toggle takes effect immediately (previously the interval held a stale closure) - Restore isLoading conditional on the donors-alerted label (shows 'Locating donors nearby...' during the skeleton phase instead of the stale count)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sextoPOST /donor/register; field is optional so existing flows still work.bloodGroup,emergencyType, andrare_grouptosessionStorageon success, keyed byrequest_id, so the results screen has context without an extra round-trip.rare_groupis true, warns that compatible donors may be scarce.unconfirmed_fallbackis true (no hospital confirmed after ~3 min), prompts family to call hospitals directly.api.ts— addedrare_group?toEmergencyResponseandunconfirmed_fallback?toEmergencyStatusResponse; wiredsexparam throughregisterDonor.What's NOT in this PR (kept from main)
PWA manifest, service worker, icons, and SW registration are kept as-is in main (this branch only touches
frontend/src/).Test plan
npm run build(zero type errors) ✅