Skip to content

Add IU/mcg units toggle and move skin type into control row - #25

Open
JWAY21 wants to merge 2 commits into
jackjackbits:mainfrom
JWAY21:feature/units-selector
Open

Add IU/mcg units toggle and move skin type into control row#25
JWAY21 wants to merge 2 commits into
jackjackbits:mainfrom
JWAY21:feature/units-selector

Conversation

@JWAY21

@JWAY21 JWAY21 commented Jun 7, 2026

Copy link
Copy Markdown

What this changes

Adds a UNITS control card alongside skin type, so all four per-session controls (clothing, sunscreen, skin type, units) sit in two symmetric rows. Tapping UNITS toggles the display between IU and mcg (1 mcg = 40 IU), matching Apple Health's native unit for vitamin D.

How it works

  • @AppStorage("usesMCG") persists the preference across sessions
  • A new unitsSection card sits alongside skinTypeSection in a matching HStack, giving skin type the same width/position as the clothing card
  • convertUnit(_:) helper converts IU → mcg when the toggle is on
  • The rate, session, and daily total displays in the main screen all update dynamically
  • The "VITAMIN D SYNTHESIZED" line in the session complete sheet also respects the selected unit

Testing

  1. Launch the app — UNITS card appears next to SKIN TYPE, both half-width
  2. Tap UNITS — display switches from IU to mcg across rate, session, and today total
  3. Tap again — switches back to IU
  4. Kill and relaunch — preference is remembered
  5. Complete a session — the session complete sheet shows the amount in the selected unit

Jesse Wales and others added 2 commits June 7, 2026 10:07
Adds a UNITS card alongside skin type so all four per-session
controls (clothing, sunscreen, skin type, units) sit in two
symmetric rows. Tapping UNITS toggles between IU and mcg
(1 mcg = 40 IU), persisted via AppStorage. The vitamin D
rate, session, and daily total displays in ContentView and
the session completion sheet all respect the selected unit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… mcg to PR jackjackbits#24

PR jackjackbits#24 includes a comprehensive rewrite of SessionCompletionSheet that
already handles IU/mcg display using currentAmount. Keeping the same
changes in PR jackjackbits#25 would cause a duplicate @AppStorage declaration
(compile error) when both PRs are merged.

PR jackjackbits#25 now only touches ContentView: the UNITS toggle card, convertUnit()
helper, and updated rate/session/today displays.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
JWAY21 added a commit to JWAY21/sunday that referenced this pull request Jun 8, 2026
…e to ContentView only

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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