Skip to content

Commit ae44d16

Browse files
committed
Create user control profiles only for the selected device - PR_26163_058-user-control-profile-selected-device-only
1 parent dddcdbb commit ae44d16

7 files changed

Lines changed: 429 additions & 309 deletions

account/user-controls-page.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,9 @@ export class AccountUserControlsPage {
644644
}
645645
this.devicePollingTimer = window.setInterval(() => {
646646
this.renderDeviceSelect();
647+
if (!this.editingProfile) {
648+
this.renderProfiles();
649+
}
647650
}, DEVICE_POLL_INTERVAL_MS);
648651
window.addEventListener("pagehide", () => {
649652
if (this.devicePollingTimer) {
@@ -1118,9 +1121,20 @@ export class AccountUserControlsPage {
11181121
}
11191122

11201123
addProfileForSelectedDevice() {
1121-
const device = this.selectedControllerDevice();
1124+
const selectedDeviceInput = this.root.querySelector(
1125+
"[data-account-user-controls-list-family='Gamepad'] [data-account-user-controls-selected-device]:checked",
1126+
);
1127+
const selectionKey = normalizeText(selectedDeviceInput?.value || this.selectedInputDevice?.selectionKey);
1128+
const selectedChoice = this.selectedInputDeviceChoices().find((choice) =>
1129+
choice.selectionType === "device"
1130+
&& choice.deviceType === "Gamepad"
1131+
&& choice.selectionKey === selectionKey,
1132+
);
1133+
const device = selectedChoice
1134+
? this.deviceOptions().find((candidate) => candidate.controllerId === selectedChoice.controllerId)
1135+
: null;
11221136
if (!device) {
1123-
this.setStatus("WARN: Choose a physical controller before creating a user control profile.");
1137+
this.setStatus("WARN: Select a detected game controller row before creating a user control profile.");
11241138
return;
11251139
}
11261140
this.createProfile(device);
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# PR_26163_057-account-aside-color-alignment
2+
3+
## Branch Validation
4+
5+
- Current branch: `main`
6+
- Expected branch: `main`
7+
- Branch validation: PASS
8+
9+
## Requirement Checklist
10+
11+
- PASS - Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` before implementation.
12+
- PASS - Created PR scope `PR_26163_057-account-aside-color-alignment`.
13+
- PASS - Verified the account left-column accordion uses the center card/page color treatment.
14+
- PASS - Reused existing Theme V2 tokens/classes; the active partial uses the neutral `side-menu tool-column` treatment without platform accent styling.
15+
- PASS - Did not change accordion structure, layout, spacing, behavior, or runtime JavaScript.
16+
- PASS - Did not add page-local CSS, inline styles, hardcoded colors, or a new accordion system.
17+
- PASS - No Theme V2 design-system gap was found; existing reusable neutral card/column styling covers the needed color treatment.
18+
- PASS - Scope stayed limited to account left-column color styling validation and reports.
19+
20+
## Changed Files
21+
22+
- `docs_build/dev/reports/PR_26163_057-account-aside-color-alignment.md`
23+
- `docs_build/dev/reports/codex_review.diff`
24+
- `docs_build/dev/reports/codex_changed_files.txt`
25+
26+
## Implementation Notes
27+
28+
- Final source state already has `tool-group-platform` removed from the Account side nav partial.
29+
- The active Account side nav uses the shared `side-menu tool-column` pattern without the platform blue accent.
30+
- The left column inherits the same neutral card background and border treatment as the center card, and keeps the existing gold header/toggle treatment.
31+
- No new CSS token or reusable class was required.
32+
- No additional source delta was needed after final repo-state verification.
33+
34+
## Impacted Lanes
35+
36+
- Account/User Controls color styling lane.
37+
- Account side-nav partial validation lane.
38+
- Targeted Playwright account navigation validation lane.
39+
- Workspace V2 validation lane.
40+
41+
## Skipped Lanes
42+
43+
- Full samples smoke: SKIP. This PR does not change samples, sample JSON contracts, game runtime behavior, or sample launch paths; the user explicitly requested not to run full samples smoke.
44+
- Engine lane: SKIP. No engine or input runtime behavior changed.
45+
- Runtime JavaScript V8 coverage: SKIP/N/A. No runtime JavaScript changed.
46+
47+
## Validation Performed
48+
49+
- PASS - Branch check: `git branch --show-current` returned `main`.
50+
- PASS - Syntax check: `node --check tests/playwright/tools/InputMappingV2Tool.spec.mjs`.
51+
- PASS - Static patch check: `git diff --check -- assets/theme-v2/partials/account-side-nav.html tests/playwright/tools/InputMappingV2Tool.spec.mjs`.
52+
- PASS - Targeted Playwright: `npx playwright test tests/playwright/tools/InputMappingV2Tool.spec.mjs --grep "Account navigation"` passed 1 test.
53+
- PASS - Workspace V2 validation: `npm run test:workspace-v2` passed 5 tests.
54+
55+
## Playwright Result
56+
57+
- PASS - Existing account accordion expand/collapse behavior still passes.
58+
- PASS - Account side nav no longer uses the `tool-group-platform` accent class.
59+
- PASS - Account side nav background image matches the center card background image.
60+
- PASS - Account side nav border color matches the center card border color.
61+
- PASS - Account accordion summary text uses the same computed text color as the center card.
62+
- PASS - Account collapse toggle color matches the Account header title color.
63+
64+
## Coverage
65+
66+
- PASS/N/A - No runtime JavaScript changed, so no changed-runtime-JS Playwright V8 coverage report was required.
67+
68+
## Search Evidence
69+
70+
- PASS - `rg -n "tool-group-platform|accountColorTreatment|side-menu tool-column|style=|<style|onclick=" assets/theme-v2/partials/account-side-nav.html account/user-controls.html tests/playwright/tools/InputMappingV2Tool.spec.mjs` confirms the platform accent is absent from the partial, targeted color assertions exist, and no page-local style or inline handler additions exist.
71+
- PASS - `git diff -- assets/theme-v2/partials/account-side-nav.html tests/playwright/tools/InputMappingV2Tool.spec.mjs` is empty in the final tree because the active source/test state already contains the requested color alignment.
72+
73+
## Manual Validation Steps
74+
75+
1. Open `/account/user-controls.html`.
76+
2. Confirm the Account left column uses the same neutral panel/card treatment as the User Controls center card.
77+
3. Confirm the Account heading/toggle no longer uses the platform blue accent.
78+
4. Confirm Account Pages and Account Guidance remain stacked top/bottom.
79+
5. Collapse and expand the Account side column.
80+
6. Collapse and expand Account Pages and Account Guidance.
81+
82+
## Samples Validation Decision
83+
84+
- SKIP - Full samples smoke was not run because this PR is scoped to account left-column color alignment only.
85+
86+
## Completion
87+
88+
- PASS - Every requested item was implemented, validated, and explicitly marked PASS or documented as N/A/skipped where applicable.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# PR_26163_058-user-control-profile-selected-device-only
2+
3+
## Branch Validation
4+
5+
- Current branch: `main`
6+
- Expected branch: `main`
7+
- Branch validation: PASS
8+
9+
## Requirement Checklist
10+
11+
- PASS - Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` before implementation.
12+
- PASS - Created PR scope `PR_26163_058-user-control-profile-selected-device-only`.
13+
- PASS - Fixed `account/user-controls.html` Game Controller profile creation behavior through the external `account/user-controls-page.js` runtime.
14+
- PASS - `Create User Control Profile` now creates exactly one profile from the selected detected game controller row.
15+
- PASS - Unselected controllers are not created as additional profiles.
16+
- PASS - Unselected controllers are not added as detached profiles.
17+
- PASS - The new profile keeps the selected physical controller/device `controllerId`, `controllerName`, and `deviceType`.
18+
- PASS - Only the newly created selected-device profile opens in edit mode.
19+
- PASS - Scope stayed limited to account User Controls profile creation behavior, targeted tests, runtime coverage, and reports.
20+
21+
## Changed Files
22+
23+
- `account/user-controls-page.js`
24+
- `tests/playwright/tools/InputMappingV2Tool.spec.mjs`
25+
- `docs_build/dev/reports/playwright_v8_coverage_report.txt`
26+
- `docs_build/dev/reports/PR_26163_058-user-control-profile-selected-device-only.md`
27+
- `docs_build/dev/reports/codex_review.diff`
28+
- `docs_build/dev/reports/codex_changed_files.txt`
29+
30+
## Implementation Notes
31+
32+
- `Create User Control Profile` now reads the checked game controller row radio (`data-account-user-controls-selected-device`) instead of the separate controller dropdown.
33+
- The selected row must be a detected game controller device choice; default/profile rows do not create new controller profiles.
34+
- Device polling now refreshes visible controller rows while no profile is being edited, so newly detected controllers can be selected from the table without manual refresh.
35+
- Existing edit-mode protection is preserved: polling does not rerender profile rows while a profile is being edited.
36+
37+
## Impacted Lane
38+
39+
- Account/User Controls runtime lane.
40+
- Account/User Controls Playwright behavior lane.
41+
- Workspace V2 command lane, required by request.
42+
43+
## Skipped Lanes
44+
45+
- Full samples smoke: SKIP. This PR is limited to Account/User Controls profile creation and does not touch samples, sample JSON, game runtime launch, or sample smoke behavior.
46+
- Engine lane: SKIP. No `src/engine/input` files or engine contracts changed.
47+
- Toolbox Controls lane beyond existing Account/User Controls coverage: SKIP. Toolbox Controls source was not changed.
48+
49+
## Validation Performed
50+
51+
- PASS - Branch check: `git branch --show-current` returned `main`.
52+
- PASS - Syntax check: `node --check account/user-controls-page.js`.
53+
- PASS - Syntax check: `node --check tests/playwright/tools/InputMappingV2Tool.spec.mjs`.
54+
- PASS - Static patch check: `git diff --check -- account/user-controls-page.js tests/playwright/tools/InputMappingV2Tool.spec.mjs`.
55+
- PASS - Targeted regression: `npx playwright test tests/playwright/tools/InputMappingV2Tool.spec.mjs --grep "selected game controller row" --reporter=line` passed 1 test.
56+
- PASS - Targeted Account/User Controls slice: `npx playwright test tests/playwright/tools/InputMappingV2Tool.spec.mjs --grep "User Controls owns|selected game controller row|scopes profiles" --reporter=line` passed 3 tests.
57+
- PASS - Required workspace validation: `npm run test:workspace-v2` passed 5 tests.
58+
59+
## Playwright Result
60+
61+
- PASS - Selecting one detected game controller row is required for profile creation.
62+
- PASS - `Create User Control Profile` creates exactly one `player_controller_profiles` record.
63+
- PASS - The unselected controller does not create an extra profile.
64+
- PASS - The unselected controller remains a detected row rather than a detached saved profile.
65+
- PASS - The newly created selected-device profile opens in edit mode.
66+
- PASS - Existing User Controls profile defaults, editing, persistence, and ownership coverage still passes.
67+
68+
## Coverage
69+
70+
- PASS - `docs_build/dev/reports/playwright_v8_coverage_report.txt` was produced after the targeted Account/User Controls Playwright run.
71+
- PASS - Changed runtime JavaScript coverage includes `(93%) account/user-controls-page.js - changed runtime JS file with browser V8 coverage`.
72+
73+
## Manual Validation Steps
74+
75+
1. Open `/account/user-controls.html`.
76+
2. Ensure two game controllers are detected or exposed by the browser test harness.
77+
3. Select one detected controller row in the Game Controllers table.
78+
4. Click `Create User Control Profile`.
79+
5. Confirm exactly one profile is created for the selected controller.
80+
6. Confirm the unselected controller remains a detected row and is not saved as a profile.
81+
7. Confirm the selected controller profile opens in edit mode.
82+
8. Confirm clicking create without a selected detected controller row shows the warning status.
83+
84+
## Samples Validation Decision
85+
86+
- SKIP - Full samples smoke was not run because the request explicitly excluded it and the PR does not affect sample contracts or sample runtime behavior.
87+
88+
## Completion
89+
90+
- PASS - Every requested item was implemented, validated, and explicitly marked PASS or documented as skipped where applicable.
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
assets/theme-v2/css/layout.css
2-
assets/theme-v2/js/gamefoundry-partials.js
1+
account/user-controls-page.js
32
tests/playwright/tools/InputMappingV2Tool.spec.mjs
43
docs_build/dev/reports/playwright_v8_coverage_report.txt
5-
docs_build/dev/reports/PR_26163_056-account-aside-template-toggle-alignment.md
4+
docs_build/dev/reports/PR_26163_058-user-control-profile-selected-device-only.md
65
docs_build/dev/reports/codex_review.diff
76
docs_build/dev/reports/codex_changed_files.txt

0 commit comments

Comments
 (0)