Admin Portal: add stable CSS hooks for Participation Summary rows#2608
Admin Portal: add stable CSS hooks for Participation Summary rows#2608
Conversation
Agent-Logs-Url: https://github.com/sequentech/step/sessions/79bacc54-9154-4f05-8ef8-dbe739c04b6f Co-authored-by: edulix <81968+edulix@users.noreply.github.com>
Agent-Logs-Url: https://github.com/sequentech/step/sessions/79bacc54-9154-4f05-8ef8-dbe739c04b6f Co-authored-by: edulix <81968+edulix@users.noreply.github.com>
There was a problem hiding this comment.
are you serious? create a new page to explains this properly, with a section for Tally Results, a subsection for this widget and an image explaining where it will appear etc.
There was a problem hiding this comment.
Done in 04d8929. I moved this into a dedicated Tally Results developer page with a Tally Results section, a Participation Summary widget subsection, and the screenshot here: https://github.com/user-attachments/assets/86e5d174-be07-435b-9169-2c237af54b1f
| // SPDX-FileCopyrightText: 2025 Sequent Tech Inc <legal@sequentech.io> | ||
| // | ||
| // SPDX-License-Identifier: AGPL-3.0-only | ||
| module.exports = { |
There was a problem hiding this comment.
ensure this is tested by github actions and it works
There was a problem hiding this comment.
Addressed in 04d8929. The admin-portal Jest test is now wired into GitHub Actions via .github/workflows/lint_prettify.yml, and it passes locally with yarn --cwd ./admin-portal test. Screenshot: https://github.com/user-attachments/assets/86e5d174-be07-435b-9169-2c237af54b1f
| "blank-votes", | ||
| "weight", | ||
| ]) { | ||
| expect(markup).toMatch(new RegExp(`participation-summary-row[^"]*${rowClassName}`)) |
There was a problem hiding this comment.
ensure each data point matches the expected value
There was a problem hiding this comment.
Done in 04d8929. The test now checks each Participation Summary row for the expected class, label, total, and percentage/value. Screenshot: https://github.com/user-attachments/assets/86e5d174-be07-435b-9169-2c237af54b1f
| @@ -0,0 +1,15 @@ | |||
| --- | |||
There was a problem hiding this comment.
remove this markdown page, we are not using this anymore
There was a problem hiding this comment.
Removed in 04d8929. Screenshot reference used in the dedicated docs page instead: https://github.com/user-attachments/assets/86e5d174-be07-435b-9169-2c237af54b1f
|
Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement (CLA). You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
|
|
@copilot why did you create a new PR? just work in the old PR |
Agent-Logs-Url: https://github.com/sequentech/step/sessions/31b0d341-4d69-4232-9cbf-ba2a6481ae9d Co-authored-by: edulix <81968+edulix@users.noreply.github.com>
Continuing on the existing PR. The follow-up changes are in 04d8929. Screenshot: https://github.com/user-attachments/assets/86e5d174-be07-435b-9169-2c237af54b1f |
There was a problem hiding this comment.
Pull request overview
This PR adds stable CSS hooks to the Admin Portal tally participation summary so integrators can target whole metric rows, documents those hooks in the developer docs, and wires a new regression test into frontend CI.
Changes:
- Add shared and metric-specific CSS classes to Participation Summary table rows, plus a table-level class.
- Add a focused Jest test for the summary markup and run admin-portal tests in the frontend CI workflow.
- Replace the Admin Portal developer placeholder page with navigation to a new Tally Results developer doc page.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
packages/admin-portal/src/resources/Tally/TallyResultsSummary.tsx |
Adds stable row and table CSS classes to the participation summary markup. |
packages/admin-portal/src/resources/Tally/TallyResultsSummary.test.js |
Adds regression coverage for rendered summary rows and their CSS hooks. |
packages/admin-portal/package.json |
Introduces an admin-portal test script for Jest. |
packages/admin-portal/jest.config.cjs |
Adds Jest configuration for running admin-portal unit tests. |
docs/docusaurus/docs/07-developers/04-admin-portal/developers_admin-portal.md |
Replaces the section placeholder with an overview and page links. |
docs/docusaurus/docs/07-developers/04-admin-portal/01-tally-results.md |
Documents the Tally Results view, Participation Summary widget, and available selectors. |
.github/workflows/lint_prettify.yml |
Runs the new admin-portal test step in frontend CI after shared package builds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| expect(markup).toMatch( | ||
| new RegExp( | ||
| `<tr[^>]*class="[^"]*participation-summary-row[^"]*${escapeRegExp(rowClassName)}[^"]*"[^>]*>[\\s\\S]*?${escapeRegExp(label)}[\\s\\S]*?${escapeRegExp(total)}[\\s\\S]*?${escapeRegExp(percent)}[\\s\\S]*?<\\/tr>` | ||
| ) | ||
| ) |
| The results screen is organized into widgets. In the example below, the **Participation Summary** | ||
| widget appears above **Candidate Results** and next to the participation chart. | ||
|
|
||
|  |
| for (const {rowClassName, label, total, percent} of expectedRows) { | ||
| expect(markup).toMatch( | ||
| new RegExp( | ||
| `<tr[^>]*class="[^"]*participation-summary-row[^"]*${escapeRegExp(rowClassName)}[^"]*"[^>]*>[\\s\\S]*?${escapeRegExp(label)}[\\s\\S]*?${escapeRegExp(total)}[\\s\\S]*?${escapeRegExp(percent)}[\\s\\S]*?<\\/tr>` |
| "^.+\\.[jt]sx?$": [ | ||
| "babel-jest", | ||
| { | ||
| presets: [ | ||
| "@babel/preset-env", | ||
| ["@babel/preset-react", {runtime: "automatic"}], | ||
| "@babel/preset-typescript", | ||
| ], | ||
| }, | ||
| ], |
Parent issue: https://github.com/sequentech/meta/issues/11968
The Admin Portal tally view did not expose row-level selectors for the Participation Summary table, making custom CSS overrides brittle and cell-specific. This updates the summary table to publish stable row classes for each metric, documents the available hooks in a dedicated Tally Results developer page, and adds automated coverage that is exercised in GitHub Actions.
UI hooks
.participation-summary-rowclass to Participation Summary rows..eligible-voters.total-auditable-votes.total-votes-counted.total-valid-votes.total-invalid-votes.explicitly-invalid-votes.implicitly-invalid-votes.blank-votes.weight(when rendered)Developer docs
Regression coverage
Example selector usage:
> [!WARNING]
>
>