Skip to content

feat: Ambient Light Sensor Integration (P2 #21)#21

Merged
thefiredev-cloud merged 2 commits intomainfrom
feature/ambient-light-sensor
Feb 2, 2026
Merged

feat: Ambient Light Sensor Integration (P2 #21)#21
thefiredev-cloud merged 2 commits intomainfrom
feature/ambient-light-sensor

Conversation

@thefiredev-cloud
Copy link
Copy Markdown
Owner

Summary

Implements ambient light sensor integration for automatic theme switching, optimized for EMS field conditions.

Features

  • useAmbientLight hook with W3C Ambient Light Sensor API support
  • Light level classification: very-dark, dim, normal, bright, very-bright
  • Optimal theme suggestions based on ambient conditions
  • Time-based fallback when sensor unavailable
  • AmbientLightSettings component with toggle and status indicator
  • Integration into Profile settings page

EMS Field Optimization

Condition Light Level Suggested Theme
Night shift / ambulance interior very-dark (< 20 lux) Dark
Hospital corridor at night dim (20-100 lux) Dark
Indoor office normal (100-500 lux) Light
Outdoor scene bright (500-5000 lux) Light
Direct sunlight very-bright (> 5000 lux) High-contrast Light

Testing

  • 19 unit tests covering all classification scenarios
  • EMS-specific test cases (ambulance interior, outdoor scenes, etc.)

Part of Batch 2

P2 UI enhancements as specified in the UI upgrade plan.

@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 1, 2026

Deploy Preview for protocol-guide ready!

Name Link
🔨 Latest commit 3769271
🔍 Latest deploy log https://app.netlify.com/projects/protocol-guide/deploys/69800ac6064c0400080fd443
😎 Deploy Preview https://deploy-preview-21--protocol-guide.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Tanner added 2 commits February 1, 2026 18:23
- Add useAmbientLight hook with W3C Ambient Light Sensor API support
- Classify light levels: very-dark, dim, normal, bright, very-bright
- Suggest optimal theme based on EMS field conditions
- Time-based fallback when sensor unavailable
- Add AmbientLightSettings component with toggle and status indicator
- Integrate into Profile settings page
- Add comprehensive tests for light classification

Designed for EMS field use:
- Night shift / ambulance interior → Dark mode
- Outdoor daytime scenes → Light mode
- Direct sunlight → High-contrast light mode

Part of P2 UI enhancements (PR #21)
- Add isAutoModeEnabledRef to track current auto mode state
- Use ref in sensor reading callback to avoid stale closure
- Sensor now correctly responds to auto mode toggle without reinitializing
@thefiredev-cloud thefiredev-cloud force-pushed the feature/ambient-light-sensor branch from 3d3876b to 3769271 Compare February 2, 2026 02:24
@thefiredev-cloud thefiredev-cloud merged commit b857afc into main Feb 2, 2026
1 of 2 checks passed
thefiredev-cloud pushed a commit that referenced this pull request Feb 2, 2026
PRs introduced a runtime error causing React to not mount.
Will re-apply fixes after debugging.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant