-
Notifications
You must be signed in to change notification settings - Fork 0
Hardcoded Values
Bryan Chen edited this page Apr 16, 2026
·
1 revision
This page documents hardcoded constants that contributors are likely to touch.
Update this page whenever you change a constant that affects routing, persistence, analytics, or simulation behavior.
Defined in src/App.tsx.
-
GA_MEASUREMENT_ID = 'G-5XJFVLZQ0Z'- Controls Google Analytics target property.
- If changed, validate page view events after consent.
-
GA_SCRIPT_ID = 'google-analytics-gtag'- DOM id used to avoid duplicate script injection.
-
COOKIE_CONSENT_KEY = 'physicssims-cookie-consent'- localStorage key for consent state (
allowordeny).
- localStorage key for consent state (
-
FORMSPREE_ENDPOINT = import.meta.env.VITE_FORMSPREE_ENDPOINT- Environment-driven endpoint for contact submissions.
-
APP_ROUTESarray- Main route map for all simulation and utility pages.
- Keep in sync with
KNOWN_SIM_PATHSwhen simulation routes change.
Defined in src/config/internalAdmin.ts.
-
ADMIN_SESSION_KEY = 'physicssims-admin-session'- sessionStorage key for authenticated admin role.
-
ADMIN_CONTROLS_KEY = 'physicssims-admin-controls'- localStorage key for full admin control state.
-
ANALYTICS_EVENTS_KEY = 'physicssims-analytics-events'- localStorage key for internal analytics log.
-
DEFAULT_FEATURED_SIM_PATH = '/kinematics-2d'- Default featured sim route for home content overrides.
-
KNOWN_SIM_PATHS- Canonical list used by publish visibility controls.
- Must include each route that should be toggleable in admin.
-
isInternalEnvironment()hostname allowlist- Allows internal admin on localhost, 127.0.0.1, ::1, *.internal, *.local, or env
VITE_INTERNAL_ADMIN_ENABLED=true.
- Allows internal admin on localhost, 127.0.0.1, ::1, *.internal, *.local, or env
Defined in src/lib/collider/constants.ts.
-
DEFAULT_CONTROLS- Default startup values for beam energy, magnetic field, particle type, bunch count, collisions flag, and visual sensitivity controls.
-
MIN_CONTROLSandMAX_CONTROLS- Slider/control bounds for collider controls.
- Keep these aligned with UI control ranges.
-
DETECTOR_POINTS- Hardcoded detector ids, names, and ring positions.
- Used for detector hit and event visualization.
-
ACCELERATION_SECTORS- Hardcoded RF sector arcs in normalized ring coordinates.
-
PARTICLE_COLORS- Visual palette for each particle mode.
-
MAX_LOGS = 8- Limits retained collider event log entries.
Defined in src/hooks/useColliderSimulation.ts.
-
SNAPSHOT_INTERVAL_MS = 120- UI snapshot update cadence from runtime state.
- Lower values increase UI refresh frequency and can increase render cost.
-
dtclamp in animation frame loop (0.001to0.04seconds)- Stabilizes simulation on slow or variable frame timing.
Defined in vite.config.ts.
-
base: '/PhysicsSims/'- Required for GitHub Pages project-site hosting under repository path.
- If repository name changes, update this and deployment docs.
Before merging a PR that changes hardcoded values:
- Confirm behavior in local dev.
- Verify any dependent list is updated (for example routes and known sim paths).
- Update this page with new values and rationale.
- Read Development Setup
- Check Hardcoded Values and Keys
- Make changes and verify locally
- Update docs in Simulation Catalog or other affected pages
- Follow PR checklist in Contributing