Skip to content

Commit 81b6dbb

Browse files
committed
Align Achievements with project data and clarify Colors disabled swatches - PR_26159_030-achievements-project-data-alignment
1 parent 674ec8c commit 81b6dbb

11 files changed

Lines changed: 312 additions & 139 deletions

File tree

account/achievements.html

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ <h2>Build, Play and Share progress</h2>
4646
<section id="build-achievements-panel" data-achievements-panel="build" aria-labelledby="build-achievements-title" aria-hidden="false">
4747
<div class="content-stack">
4848
<div class="grid cols-4" aria-label="Build stats">
49-
<article class="mini-stat"><strong>12</strong>Created games</article>
50-
<article class="mini-stat"><strong>8</strong>Playable builds</article>
51-
<article class="mini-stat"><strong>4.7</strong>Average creator rating</article>
52-
<article class="mini-stat"><strong>3</strong>Ready to publish</article>
49+
<article class="mini-stat"><strong data-achievements-build-created-count>0</strong>Created projects</article>
50+
<article class="mini-stat"><strong>Not tracked yet</strong>Playable builds</article>
51+
<article class="mini-stat"><strong>Not tracked yet</strong>Average creator rating</article>
52+
<article class="mini-stat"><strong data-achievements-build-ready-count>0</strong>Ready to publish</article>
5353
</div>
5454
<div class="card">
5555
<div class="card-body content-stack">
@@ -62,39 +62,21 @@ <h2 id="build-achievements-title">Created games</h2>
6262
<caption>Build achievements and ratings</caption>
6363
<thead>
6464
<tr>
65-
<th scope="col">Game</th>
65+
<th scope="col">Project</th>
6666
<th scope="col">Status</th>
6767
<th scope="col">Stats</th>
6868
<th scope="col">Rating</th>
6969
<th scope="col">Quick actions</th>
7070
</tr>
7171
</thead>
72-
<tbody>
73-
<tr>
74-
<td>Sky Forge Sprint</td>
75-
<td>Playable</td>
76-
<td>18 builds, 6 releases</td>
77-
<td>4.8</td>
78-
<td><button class="btn" type="button">Open build</button></td>
79-
</tr>
72+
<tbody data-achievements-build-rows>
8073
<tr>
81-
<td>Crystal Circuit</td>
82-
<td>Draft</td>
83-
<td>9 builds, 2 release checks</td>
84-
<td>4.5</td>
85-
<td><button class="btn" type="button">Review stats</button></td>
86-
</tr>
87-
<tr>
88-
<td>Moonlit Maze</td>
89-
<td>Ready</td>
90-
<td>21 builds, 8 ratings</td>
91-
<td>4.9</td>
92-
<td><button class="btn" type="button">Prepare publish</button></td>
74+
<td colspan="5">Loading Project Workspace projects...</td>
9375
</tr>
9476
</tbody>
9577
</table>
9678
</div>
97-
<div class="status" role="status">Build wireframe only: quick actions are enabled placeholders for future account workflows.</div>
79+
<div class="status" role="status" data-achievements-build-status>Build project rows load from Project Workspace data.</div>
9880
</div>
9981
</div>
10082
</div>
@@ -174,7 +156,7 @@ <h3>Top share source</h3>
174156
</article>
175157
<article class="callout">
176158
<h3>Best shared game</h3>
177-
<p>Sky Forge Sprint leads shared launches and profile follows this month.</p>
159+
<p>Shared project performance is not tracked yet.</p>
178160
</article>
179161
<article class="callout">
180162
<h3>Next milestone</h3>
@@ -195,24 +177,24 @@ <h3>Next milestone</h3>
195177
</thead>
196178
<tbody>
197179
<tr>
198-
<td>Sky Forge Sprint</td>
199-
<td>4.2K</td>
200-
<td>840</td>
201-
<td>+0.4</td>
180+
<td>Demo Project</td>
181+
<td>Not tracked yet</td>
182+
<td>Not tracked yet</td>
183+
<td>Not tracked yet</td>
202184
<td><button class="btn" type="button">Copy share link</button></td>
203185
</tr>
204186
<tr>
205-
<td>Moonlit Maze</td>
206-
<td>2.7K</td>
207-
<td>510</td>
208-
<td>+0.3</td>
187+
<td>Gravity Demo</td>
188+
<td>Not tracked yet</td>
189+
<td>Not tracked yet</td>
190+
<td>Not tracked yet</td>
209191
<td><button class="btn" type="button">View analytics</button></td>
210192
</tr>
211193
<tr>
212-
<td>Crystal Circuit</td>
213-
<td>1.5K</td>
214-
<td>320</td>
215-
<td>+0.2</td>
194+
<td>Collision Demo</td>
195+
<td>Not tracked yet</td>
196+
<td>Not tracked yet</td>
197+
<td>Not tracked yet</td>
216198
<td><button class="btn" type="button">Share again</button></td>
217199
</tr>
218200
</tbody>
@@ -229,7 +211,7 @@ <h3>Next milestone</h3>
229211
</main>
230212
<div data-partial="footer"></div>
231213
<script src="../assets/theme-v2/js/gamefoundry-partials.js" defer></script>
232-
<script src="../assets/theme-v2/js/account-achievements.js" defer></script>
214+
<script type="module" src="../assets/theme-v2/js/account-achievements.js"></script>
233215
</body>
234216

235217
</html>
Lines changed: 108 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,121 @@
1-
(function () {
2-
const tabs = Array.from(document.querySelectorAll("[data-achievements-tab]"));
3-
const panels = Array.from(document.querySelectorAll("[data-achievements-panel]"));
4-
if (!tabs.length || !panels.length) {
1+
import { createServerRepositoryClient } from "../../../src/engine/api/server-api-client.js";
2+
3+
const CREATOR_USER_ID = "creator-user";
4+
5+
const tabs = Array.from(document.querySelectorAll("[data-achievements-tab]"));
6+
const panels = Array.from(document.querySelectorAll("[data-achievements-panel]"));
7+
const buildRows = document.querySelector("[data-achievements-build-rows]");
8+
const buildStatus = document.querySelector("[data-achievements-build-status]");
9+
const createdCount = document.querySelector("[data-achievements-build-created-count]");
10+
const readyCount = document.querySelector("[data-achievements-build-ready-count]");
11+
const repository = createServerRepositoryClient("project-workspace");
12+
13+
function setText(element, value) {
14+
if (element) {
15+
element.textContent = value;
16+
}
17+
}
18+
19+
function showTab(tabName) {
20+
tabs.forEach((tab) => {
21+
const isActive = tab.dataset.achievementsTab === tabName;
22+
tab.setAttribute("aria-pressed", String(isActive));
23+
tab.classList.toggle("primary", isActive);
24+
});
25+
26+
panels.forEach((panel) => {
27+
const isActive = panel.dataset.achievementsPanel === tabName;
28+
panel.hidden = !isActive;
29+
panel.setAttribute("aria-hidden", String(!isActive));
30+
});
31+
}
32+
33+
function createCell(text) {
34+
const cell = document.createElement("td");
35+
cell.textContent = text;
36+
return cell;
37+
}
38+
39+
function createActionCell(project) {
40+
const cell = document.createElement("td");
41+
const button = document.createElement("button");
42+
button.className = "btn";
43+
button.type = "button";
44+
button.textContent = `Open ${project.name}`;
45+
cell.append(button);
46+
return cell;
47+
}
48+
49+
function renderBuildRows(projects) {
50+
if (!buildRows) {
551
return;
652
}
753

8-
function showTab(tabName) {
9-
tabs.forEach((tab) => {
10-
const isActive = tab.dataset.achievementsTab === tabName;
11-
tab.setAttribute("aria-pressed", String(isActive));
12-
tab.classList.toggle("primary", isActive);
13-
});
54+
buildRows.replaceChildren();
55+
if (!projects.length) {
56+
const row = document.createElement("tr");
57+
const cell = createCell("No Project Workspace projects are available.");
58+
cell.colSpan = 5;
59+
row.append(cell);
60+
buildRows.append(row);
61+
setText(buildStatus, "No Project Workspace projects are available for Build achievements.");
62+
return;
63+
}
1464

15-
panels.forEach((panel) => {
16-
const isActive = panel.dataset.achievementsPanel === tabName;
17-
panel.hidden = !isActive;
18-
panel.setAttribute("aria-hidden", String(!isActive));
19-
});
65+
projects.forEach((project) => {
66+
const row = document.createElement("tr");
67+
row.dataset.achievementsBuildProject = project.id || "";
68+
row.append(
69+
createCell(project.name || "Untitled Project"),
70+
createCell(project.status || "Not tracked yet"),
71+
createCell("Not tracked yet"),
72+
createCell("Not tracked yet"),
73+
createActionCell(project),
74+
);
75+
buildRows.append(row);
76+
});
77+
78+
const readyProjects = projects.filter((project) => project.status === "Ready for Publish").length;
79+
setText(createdCount, String(projects.length));
80+
setText(readyCount, String(readyProjects));
81+
setText(buildStatus, "Build project rows use the Project Workspace project source. Stats and ratings are not tracked yet.");
82+
}
83+
84+
function renderBuildError(message) {
85+
if (!buildRows) {
86+
return;
87+
}
88+
buildRows.replaceChildren();
89+
const row = document.createElement("tr");
90+
const cell = createCell(message || "Project Workspace data is unavailable.");
91+
cell.colSpan = 5;
92+
row.append(cell);
93+
buildRows.append(row);
94+
setText(createdCount, "0");
95+
setText(readyCount, "0");
96+
setText(buildStatus, message || "Project Workspace data is unavailable.");
97+
}
98+
99+
function loadBuildProjects() {
100+
const result = repository.listProjects({ userId: CREATOR_USER_ID });
101+
if (result?.error) {
102+
renderBuildError(result.message || "Project Workspace data is unavailable.");
103+
return;
104+
}
105+
if (!Array.isArray(result)) {
106+
renderBuildError("Project Workspace did not return project rows.");
107+
return;
20108
}
109+
renderBuildRows(result);
110+
}
21111

112+
if (tabs.length && panels.length) {
22113
tabs.forEach((tab) => {
23114
tab.addEventListener("click", () => {
24115
showTab(tab.dataset.achievementsTab);
25116
});
26117
});
27118

119+
loadBuildProjects();
28120
showTab("build");
29-
}());
121+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[ ] add an assign to column,
2+
[ ] when clicking My notes. have a radio input for filter My Notes : Created by me & Assigned to me.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# PR_26159_030 Achievements Project Data Alignment Report
2+
3+
## Executive Summary
4+
5+
Status: PASS
6+
Playwright impacted: Yes
7+
Full samples validation: Skipped, not impacted.
8+
9+
Account Achievements Build now renders project rows from the Project Workspace server repository source instead of a separate hardcoded achievement/demo game list. Colors Picker Preview no longer has a global enable/disable checkbox; it now uses a narrower checkbox that only includes already selected swatches.
10+
11+
## Why Achievements And Project Workspace Differed
12+
13+
The Account Achievements Build tab previously owned its own hardcoded table in `account/achievements.html`. Those rows used unrelated demo game names and achievement-specific status/stat/rating values:
14+
15+
- Sky Forge Sprint
16+
- Crystal Circuit
17+
- Moonlit Maze
18+
19+
Project Workspace uses the `project-workspace` server repository source, seeded with:
20+
21+
- Demo Project
22+
- Gravity Demo
23+
- Collision Demo
24+
- Camera Follow Demo
25+
26+
Because the Account page did not read from the Project Workspace repository/API boundary, the two surfaces drifted. This PR moves the Build rows into `assets/theme-v2/js/account-achievements.js` and reads them through `createServerRepositoryClient("project-workspace")`.
27+
28+
## Colors Disabled / Grayed Swatch Explanation
29+
30+
The meaningful disabled subset is picker swatches that are already pinned into Project Swatches. Those swatches are not invalid colors; they are already selected. They are dimmed/disabled by default in Picker Preview so clicking the picker grid adds new swatches instead of toggling already selected ones.
31+
32+
The checkbox is now labeled `Include already selected swatches`, which describes exactly what it controls:
33+
34+
- Off: already selected picker swatches are dimmed/disabled in the picker.
35+
- On: only that already-selected subset is included/enabled so the user can toggle pinned picker swatches from the picker.
36+
- It does not globally enable or disable every picker swatch.
37+
38+
## Requirement Checklist
39+
40+
| Requirement | Status | Evidence |
41+
| --- | --- | --- |
42+
| Read `PROJECT_INSTRUCTIONS.md` first | PASS | Read before implementation. |
43+
| Use PR_26159_029 as base context | PASS | Preserved PR_029 Symbol cleanup and Colors context. |
44+
| Achievements Build no longer uses separate hardcoded achievement/demo game data | PASS | Build table rows are rendered by `assets/theme-v2/js/account-achievements.js` from the Project Workspace server repository. |
45+
| Achievements Build rows align with Project Workspace source | PASS | Playwright validates rows: Demo Project, Gravity Demo, Collision Demo, Camera Follow Demo. |
46+
| Build rows show same statuses as Project Workspace | PASS | Playwright validates Under Construction and Wireframe statuses. |
47+
| Preserve achievement columns only with derived or placeholder values | PASS | Project/status derive from project rows; stats and rating show `Not tracked yet`. |
48+
| Do not show Sky Forge Sprint, Crystal Circuit, or Moonlit Maze in Build | PASS | Active Achievements source no longer contains those names; Playwright asserts they are absent from Build/body. |
49+
| Missing stats/ratings show honest placeholders | PASS | Playwright validates `Not tracked yet` for stats and rating. |
50+
| Project Workspace still renders cards/list | PASS | Scoped Project Workspace render test passed. |
51+
| Explain why Achievements and Project Workspace differed | PASS | Report section above. |
52+
| Revert global Picker Preview checkbox behavior | PASS | Removed `data-palette-enable-picker-swatches` and global enable/disable state. |
53+
| Investigate prior disabled/grayed subset | PASS | Identified already selected/pinned picker swatches as the valid dimmed subset. |
54+
| Rename checkbox to meaningful label | PASS | Label is `Include already selected swatches`. |
55+
| Checkbox does not blindly enable/disable every swatch | PASS | Palette Playwright validates only the pinned subset is disabled/enabled. |
56+
| Preserve Symbol cleanup and Add/Update without Symbol validation | PASS | Active Symbol scan clean; Palette Playwright Add/Update passes. |
57+
| Validate no console errors | PASS | Achievements and Palette Playwright collect console errors and passed. |
58+
| Playwright impacted | PASS | Account Achievements, Project Workspace render, and Palette lanes run. |
59+
| Do not run full samples validation | PASS | Full samples skipped with reason. |
60+
| Produce repo-structured ZIP | PASS | Created under `tmp/PR_26159_030-achievements-project-data-alignment_delta.zip`. |
61+
62+
## Validation Evidence
63+
64+
Commands run:
65+
66+
- `node --check assets/theme-v2/js/account-achievements.js`
67+
- `node --check toolbox/colors/colors.js`
68+
- `node --check tests/playwright/account/AchievementsPage.spec.mjs`
69+
- `node --check tests/playwright/tools/PaletteToolMockRepository.spec.mjs`
70+
- `npx playwright test tests/playwright/account/AchievementsPage.spec.mjs` - PASS, 2 passed
71+
- `npx playwright test tests/playwright/tools/ProjectWorkspaceMockRepository.spec.mjs -g "Project Workspace creates, opens, and deletes mock projects"` - PASS, 1 passed
72+
- `npx playwright test tests/playwright/tools/PaletteToolMockRepository.spec.mjs` - PASS, 6 passed
73+
- `npx playwright test tests/playwright/account/AchievementsPage.spec.mjs tests/playwright/tools/PaletteToolMockRepository.spec.mjs --workers=1` - PASS, 8 passed and final V8 coverage
74+
- `git diff --check` - PASS
75+
- Active scans for old Achievements mock names, Colors Symbol validation, and old global picker checkbox naming - PASS
76+
77+
## Skipped Lanes
78+
79+
- Full samples validation: skipped because no sample JSON contract or shared sample loader/framework changed.
80+
- Full Playwright suite: skipped because targeted impacted lanes covered account achievements, Project Workspace render, Colors picker behavior, and runtime console checks.
81+
82+
## Known Adjacent Warning
83+
84+
Running the full `ProjectWorkspaceMockRepository.spec.mjs` file produced one unrelated warning/failure in `Toolbox member-role filters focus tools without exposing admin-only controls`: the test expects `Tool Count: 5/38`, while the current toolbox shows `Tool Count: 6/38`. This appears to be existing Toolbox visibility drift from the current stacked base, not caused by the Achievements Build alignment. The directly requested Project Workspace render/cards/list test passed.

0 commit comments

Comments
 (0)