Skip to content

feat(profile): default spectrum tab preference for NMRium viewers#1467

Open
vcnainala wants to merge 1 commit into
developmentfrom
feat/default-spectrum-tab-preference
Open

feat(profile): default spectrum tab preference for NMRium viewers#1467
vcnainala wants to merge 1 commit into
developmentfrom
feat/default-spectrum-tab-preference

Conversation

@vcnainala

Copy link
Copy Markdown
Member

Summary

  • Adds a JSON preferences column to users and a DefaultSpectrumTab enum (1D/2D nuclei tabs), with accessor/mutator helpers on the User model.
  • New PUT /user/preferences endpoint (auth + verified, rate limited) validated through UpdateUserPreferencesRequest; available tab options are shared with the frontend via Inertia props.
  • Profile page gains an "Spectra preferences" form, and the spectra editor/viewer/snapshot components apply the preferred tab when NMRium finishes loading, with an inline selector to change it on the spot.
  • Hardens NMRium messaging: postMessage calls now target the resolved NMRium origin instead of "*", and incoming messages are checked against an allow-list of origins.

Test plan

  • sail artisan test tests/Feature/UserPreferencesTest.php (9 passed)
  • Manually verify the preferred tab is selected after loading a study with 1D and 2D spectra
  • Requires npm run build / npm run dev after merge to see the UI changes

Store per-user preferences as JSON on users, expose a profile form and
an inline selector to pick a default 1D/2D spectrum tab, validate the
value through a form request against the new DefaultSpectrumTab enum,
and apply the preferred tab when NMRium loads in the editor, viewer and
snapshot components (with postMessage now scoped to the NMRium origin
instead of *).
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.63%. Comparing base (6ee0a22) to head (bfe991e).

Files with missing lines Patch % Lines
app/Models/User.php 40.00% 6 Missing ⚠️
app/Http/Requests/UpdateUserPreferencesRequest.php 80.00% 3 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##             development    #1467      +/-   ##
=================================================
+ Coverage          76.59%   76.63%   +0.03%     
- Complexity          3593     3611      +18     
=================================================
  Files                250      253       +3     
  Lines              13521    13575      +54     
=================================================
+ Hits               10357    10403      +46     
- Misses              3164     3172       +8     
Flag Coverage Δ
unittests 76.63% <83.33%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vcnainala vcnainala linked an issue Jul 17, 2026 that may be closed by this pull request
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.

for samples with many spectra, open the 1H first, if present

1 participant