Skip to content

feat(formplayer): Likert scale and duration question types (#693)#695

Merged
IamLRBA merged 7 commits into
OpenDataEnsemble:devfrom
najuna-brian:feat/formplayer-likert-and-duration
Jul 2, 2026
Merged

feat(formplayer): Likert scale and duration question types (#693)#695
IamLRBA merged 7 commits into
OpenDataEnsemble:devfrom
najuna-brian:feat/formplayer-likert-and-duration

Conversation

@najuna-brian

@najuna-brian najuna-brian commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds built-in format: "likert" and format: "duration" question types to formplayer (same pattern as photo/gps/signature — not app-bundle custom types).
Closes #692
Closes #693

Likert scale

  • Displays: buttons, radio, slider, numeric, stars, emoji
  • Standard survey UX: outlined pill cells, accent on the selected option only, responsive phone/tablet layouts
  • Layouts via ui.json options.orientation: horizontal (default), vertical, flow, cols-2cols-5
  • Numeric scales auto-show verbal endpoint anchors (recommended for NPS/pain)
  • Emoji always paired with text label; optional spectrum accent
  • Inline N/A on button/numeric/emoji rows; presets; allowClear; readonly/review styling
  • Stores oneOf[].const (integer, or null for N/A)
  • FinalizeRenderer shows human-readable label in review

Duration / timer

  • Modes: stopwatch, countdown, manual
  • Value stored as seconds (JSON number); explicit Save on stopwatch

Test plan

  • pnpm exec vitest run — 162 tests pass
  • pnpm exec tsc --noEmit clean
  • pnpm run lint clean
  • Storybook variants (display modes, mobile width, readonly review, two-column, translated)
  • pnpm run build:copy and smoke test on Android emulator with AnthroCollect ode_question_types_demo

Add built-in `likert` and `duration` formats to the formplayer (same
pattern as photo/gps/signature, not app-bundle custom types).

Likert scale (format: "likert"):
- Displays: buttons, radio, slider, numeric, stars, emoji
- Standard, clean look across all variants: neutral outlined cells with
  accent (border + tint + bold) only on the selected option
- colorMode neutral | spectrum (semantic accent on selection) | stars
- Presets, endpoint-labels-only, allowClear, allowNotApplicable
- Responsive wrapping for tablet/phone widths

Duration/timer (format: "duration"):
- Stopwatch, countdown, manual modes; value stored as seconds
- Explicit Save on stopwatch before commit

Registered in App.tsx (customRenderers + addFormat) and FinalizeRenderer
for readonly/review display. Includes unit tests and Storybook stories.
- Standard survey styling: pill affordance, slider value badge (n/N),
  inline N/A with icon, review-mode de-emphasis of unselected options
- Responsive layouts: phone stacking, cols-2…cols-5 via choiceLayout,
  default horizontal when orientation omitted
- Numeric scales auto-show verbal endpoint anchors when configured
- Emoji always paired with text label; spectrum accent on selection
- Add LikertJsonSchema/LikertOneOfEntry types and schema helpers for
  Storybook/tests; fix TS2353 errors on likert/emoji properties
- Stronger integration tests asserting committed observation JSON
- Storybook: readonly review, two-column layout, mobile variants
Avoid indexing an optional parameter type (TS2339) by annotating the
story helper's likert arg as LikertConfig directly.
…rt-and-duration

# Conflicts:
#	formulus-formplayer/src/renderers/FinalizeRenderer.tsx
Move form-author configuration reference for the likert/duration
question types to the docs site; keep only dev-oriented file/Storybook
locations in the formplayer README.
Use CSS grid for word and emoji scales so every option stays the same width on tablets, normalize schemas for Not applicable validation, and wire ui.json option translations into Likert labels.
Run Prettier on Likert tests, stories, and related source so formplayer format:check passes in CI.
@najuna-brian najuna-brian requested a review from r0ssing July 2, 2026 16:04
@najuna-brian najuna-brian marked this pull request as ready for review July 2, 2026 16:04
@najuna-brian najuna-brian requested a review from IamLRBA July 2, 2026 16:06
@IamLRBA IamLRBA merged commit f6c06f7 into OpenDataEnsemble:dev Jul 2, 2026
20 checks passed
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.

[Formplayer] Likert scale question type [Formplayer] Add stopwatch/timer question type

2 participants