Skip to content

Enhancement: Achievement/Association award types, misc fixes#454

Open
baltinerdist wants to merge 5 commits intoamtgard:masterfrom
baltinerdist:feature/misc-fixes-04-08
Open

Enhancement: Achievement/Association award types, misc fixes#454
baltinerdist wants to merge 5 commits intoamtgard:masterfrom
baltinerdist:feature/misc-fixes-04-08

Conversation

@baltinerdist
Copy link
Copy Markdown
Contributor

@baltinerdist baltinerdist commented Apr 8, 2026

Summary

  • Achievement Titles & Associations award tabs — Player, Kingdom, and Park award entry modals now have two additional type buttons: Achievement Titles (Knighthoods, Masterhoods, Paragons, Noble Titles) and Associations (Associate Titles). Each filters the award select to its bucket and updates the modal title/label. Buttons auto-hide when the kingdom has no awards in that category. An info note appears for Association grants explaining the "given by" field.
  • Award type row layout — Changed from flex to a 2-column CSS grid with min-height: 44px for consistent sizing across 2 or 4 buttons; responsive font-size at ≤400 px.
  • Recommendation pickers — Associate Titles removed from rec award selects (not recommendable). Added null-guard around Kingdom rec overlay IIFE.
  • awCloseDropdown exported — Dropdown closes when switching award type mid-flow.
  • Parknew/Kingdomnew kingdom-id seeding — Hidden kingdom-id input now seeded from PkConfig.kingdomId / KnConfig.kingdomId on modal reset and search clear, fixing missing kingdom on submitted awards.
  • Attendance location display — Guard against empty KingdomName to avoid trailing , when park name is present.
  • Ladder tally deduplication — When counting a player's ladder level, duplicate-ranked entries (e.g. two Crown 3 entries) no longer inflate the estimate. Now uses distinct ranked entry count + unranked count instead of raw total, so the displayed level is always max(highest actual rank, effective count).
  • Event RSVP tab improvements — Sign-in Credits input added to the actions column header (integer field, default 1, synced with quick check-in and attendance form via localStorage); pulses 3× at 1s duration when the RSVP tab opens to draw attention. Kingdom and Park split out of parenthetical into their own columns. New Waivered? column shows green check / gray circle per player profile; column header has a (?) tooltip noting that the column reflects profile-level waiver status and that event/park/kingdom policy governs actual check-in requirements.
  • Player profile officer badges — Removed home-park scope restriction from the OfficerRoles query so all current offices are shown (not just home park + kingdom level). ork_officer is a current-state table so filtering by mundane_id alone is authoritative.
  • Email spell-checker on player email fields — Integrates @zootools/email-spell-checker (esbuild IIFE bundle, 6.6 KB) on the email input in the Kingdomnew/Parknew Add Player modals and the Playernew Edit Account section. On blur, if a domain typo is detected (e.g. gmial.comgmail.com), a soft blue suggestion banner appears with "Did you mean X? [Use it] [Dismiss]". Bundle is committed to the script directory; package.json includes the dep, esbuild devDep, and a build-email-spell-checker postinstall step.
  • Email prompt modal for players with no recovery email — When a logged-in player has no email address on file, a modal prompts them to add one on next page load. Includes AJAX save endpoint (PlayerAjax/save_my_email), client-side validation, spell-checker suggestion banner, and "Skip for now" option (sessionStorage-gated so it doesn't re-prompt within the same session). Modal is fully self-contained — no dependency on revised-frontend stylesheets or scripts.

Test plan

  • Open Player, Kingdom, and Park award modals — verify 4 type buttons appear; Achievement and Association buttons hide when no matching awards exist
  • Select each type — confirm award select, modal title, and label update correctly; Association type shows info note next to Given By
  • Submit an award of each type and confirm it saves correctly with the right KingdomId
  • Open a player with duplicate-ranked ladder awards and verify the tally widget shows the correct (non-inflated) level
  • Verify rec pickers on Player/Kingdom/Park do not include Associate Titles
  • Open an event RSVP tab — verify Sign-in Credits input pulses 3× on load; changing the value syncs to the check-in modal and attendance form
  • Verify RSVP table shows Kingdom, Park as separate columns and Waivered? column with correct icons; hover (?) for tooltip
  • Open a player profile for someone who holds offices at non-home parks — verify all current offices appear as badges
  • On the Kingdomnew/Parknew Add Player modal and Playernew Edit Account, type a misspelled email (e.g. [email protected]) and tab out — verify the suggestion banner appears with the corrected address; click "Use it" and confirm the field updates; click Dismiss to hide
  • Log in as a player with no email on file — verify the email prompt modal appears after ~400ms; enter a valid email and save; confirm it persists and the modal does not reappear on next load
  • On the email prompt modal, type a misspelled email and tab out — verify the spell-checker suggestion banner appears; dismiss or use it, then save
  • Click "Skip for now" — verify modal does not reappear in the same session; verify it does reappear in a new session (clear sessionStorage)

Notes

  • Branch rebased onto upstream amtgard/ork3 master as of 2026-04-09 (includes stale session detection, unit page modal dialog improvements, Dragon banner removal)
  • class.Authorization.php is intentionally excluded from this PR (contains a local dev login bypass)

🤖 Generated with Claude Code

@baltinerdist
Copy link
Copy Markdown
Contributor Author

Pushed additional changes to this branch:

Event RSVP tab

  • Added a Sign-in Credits input in the actions column header (default 1, supports decimals). Syncs with the check-in modal and the manual attendance form via localStorage so all three stay in lockstep. Pulses 3× (1s each) when the tab opens to draw attention to it.
  • Split Kingdom and Park out of the parenthetical in the Player column into their own dedicated columns.
  • Added a Waivered? column showing a green check-circle or gray circle based on the player's profile waiver flag. Column header has a (?) tooltip: "This column indicates that the player's profile is marked as having a waiver. Please follow your kingdom, park, and/or event policy for confirming or completing waivers at check-in if necessary."

Player profile officer badges

  • Removed the (park_id = homePark OR park_id = 0) scope restriction from the OfficerRoles query. ork_officer is a current-state table (one row per entity+role, updated in-place, vacated = mundane_id = 0), so filtering solely by mundane_id is the correct and complete definition of current offices. Previously, offices held at any park other than the player's registered home park were silently dropped.

🤖 Generated with Claude Code

@baltinerdist
Copy link
Copy Markdown
Contributor Author

Added email spell-checker to the three player email fields.

What it does: On blur of any email input, @zootools/email-spell-checker checks the domain for common typos (e.g. gmial.comgmail.com, yaho.comyahoo.com). If a suggestion exists, a soft blue banner appears below the field — "Did you mean [email protected]? [Use it] [Dismiss]" — with no friction if the email is already correct.

Applied to:

  • Kingdomnew Add Player modal (#kn-addplayer-email)
  • Parknew Add Player modal (#pk-addplayer-email)
  • Playernew Edit Account section (#pn-acct-email)

Implementation: The package (@zootools/email-spell-checker, the current home of the smashsend/email-spell-checker repo) ships CommonJS only, so it's bundled via esbuild into a 6.6 KB IIFE (email-spell-checker.min.js) committed to the script directory. package.json adds the dep, esbuild as a devDep, and a build-email-spell-checker script + postinstall step so the bundle stays in sync after npm install.

🤖 Generated with Claude Code

@baltinerdist
Copy link
Copy Markdown
Contributor Author

Bugfix: Email prompt modal suggestion banner (just pushed)

The email spell-checker suggestion div inside the email-prompt modal was visible with empty content on page load for any page that doesn't load the revised-frontend stylesheet (revised.css).

Root causes:

  1. The suggestion div used class esc-suggestion (with display:none defined in revised.css), which is not globally loaded. On non-revised pages, the div rendered immediately visible with no content.
  2. The spell-checker wiring called window.initEmailSpellCheck (from revised.js, also not globally loaded), so the blur handler was never attached.

Fix: Made the modal completely self-contained — no dependencies on revised.css or revised.js:

  • Changed div class from esc-suggestionemp-suggestion with own inline display:none CSS
  • Added explicit IDs to all suggestion child elements (emp-suggestion-val, emp-suggestion-use, emp-suggestion-dismiss)
  • Inlined runSpellCheck() + hideSugg() logic directly in the modal's <script> block
  • Bundle lazy-loaded only if window.EmailSpellChecker is not already defined on the page

Avery Krouse and others added 5 commits April 9, 2026 10:02
- Add Achievement Titles and Associations as distinct award type tabs in the
  Player, Kingdom, and Park award entry modals; splits the award option list
  by optgroup (Knighthoods/Masterhoods/Paragons/Noble Titles → achievements,
  Associate Titles → associations). Hidden when no options exist.
- Award type row changed from flex to 2-col grid with min-height for cleaner
  layout at all sizes; responsive font-size at ≤400 px.
- Associate Titles removed from award recommendation pickers.
- Expose awCloseDropdown globally so switching award type closes any open AC.
- Seed kingdom-id hidden input from PkConfig/KnConfig on reset and search clear.
- Player attendance: guard against empty KingdomName when displaying location.
- Ladder tally: deduplicate ranked entries — count distinct ranks + unranked
  instead of raw entry count, so duplicate-ranked awards don't inflate level.
- Add KnConfig guard to Kingdom rec overlay IIFE to prevent JS errors on pages
  without that section.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…ark columns, officer badge fix

- Event RSVP tab: add Sign-in Credits input in actions column header (synced with
  quick check-in and attendance form via localStorage); pulses 3x on tab open
- Event RSVP tab: split kingdom/park out of parenthetical into own columns
- Event RSVP tab: add Waivered? column (green check / gray circle) with (?) tooltip
- model.Event: include m.waivered in get_rsvp_list query
- controller.Player (Playernew profile): remove home-park scope restriction from
  OfficerRoles query so all current offices are shown, not just home park + kingdom

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…ayer email fields

Integrates @zootools/email-spell-checker (via esbuild IIFE bundle) to surface
typo corrections on email inputs in the three player-facing forms:
- Kingdomnew / Parknew "Add Player" modals (#kn-addplayer-email, #pk-addplayer-email)
- Playernew "Edit Account" section (#pn-acct-email)

On blur, if the checker suggests a correction (e.g. gmial.com → gmail.com), a
soft blue suggestion banner appears below the field with "Did you mean X? [Use it]
[Dismiss]". Clicking "Use it" fills the input; Dismiss hides the banner.

- Adds email-spell-checker.min.js (esbuild IIFE bundle, 6.6 KB) to script dir
- Adds window.initEmailSpellCheck() helper to revised.js
- Adds .esc-suggestion styles to revised.css
- Updates package.json: @zootools/email-spell-checker dep, esbuild devDep,
  postinstall + build-email-spell-checker scripts

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
… file

On page load, players who have no email address in ork_mundane are shown a
modal asking them to add one. The modal auto-opens after 400ms (so the page
settles first), can be skipped for the browser session via sessionStorage, and
submits via AJAX to the new PlayerAjax/save_my_email endpoint.

- PlayerAjax::save_my_email(): validates with FILTER_VALIDATE_EMAIL, saves via
  PDO-bound UPDATE on ork_mundane.email for the logged-in user
- default.theme: queries email for the logged-in user; renders modal HTML + CSS
  + JS only when email is empty; lazy-loads email-spell-checker.min.js if not
  already present on the page (reuses initEmailSpellCheck from revised.js)
- "Skip for now" sets sessionStorage flag to suppress for the rest of the session;
  modal re-appears on next login session until email is saved

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…ible on load

The suggestion div was using class esc-suggestion (from revised.css, not
loaded globally) and wiring via initEmailSpellCheck (from revised.js, also
not globally loaded). This caused the banner to render visible with empty
content on any page that doesn't load the revised-frontend stylesheet.

Fix: rename div class to emp-suggestion with own inline display:none CSS,
add explicit IDs to all suggestion elements, inline runSpellCheck() logic
directly — no dependency on revised.css or revised.js. Bundle lazy-loaded
if EmailSpellChecker not already defined on the page.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@baltinerdist baltinerdist force-pushed the feature/misc-fixes-04-08 branch from 84eacf3 to ff79678 Compare April 9, 2026 14:02
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