Skip to content

Admin Portal: add stable CSS hooks for Participation Summary rows#2608

Open
Copilot wants to merge 5 commits intomainfrom
copilot/add-css-class-to-participation-summary
Open

Admin Portal: add stable CSS hooks for Participation Summary rows#2608
Copilot wants to merge 5 commits intomainfrom
copilot/add-css-class-to-participation-summary

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 1, 2026

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

    • Add a shared .participation-summary-row class to Participation Summary rows.
    • Add metric-specific row classes so custom CSS can target the full row:
      • .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

    • Document the new selectors in a dedicated Admin Portal Tally Results developer page.
    • Add a Participation Summary subsection explaining where the widget appears.
    • Include a screenshot of the widget in the Tally Results screen.
  • Regression coverage

    • Add focused automated coverage to ensure the Participation Summary markup continues to expose the expected row classes.
    • Validate each data point’s expected label, total, and percentage/value.
    • Run the admin-portal Jest test in GitHub Actions.

Example selector usage:

.total-valid-votes td,
.total-valid-votes th {
  font-weight: 700;
}

> [!WARNING]
>
>

Copilot AI and others added 2 commits May 1, 2026 15:38
Copilot AI changed the title [WIP] Add CSS class to Participation Summary table rows for targeting Admin Portal: add stable CSS hooks for Participation Summary rows May 1, 2026
Copilot finished work on behalf of edulix May 1, 2026 15:43
Copilot AI requested a review from edulix May 1, 2026 15:43
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensure this is tested by github actions and it works

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}`))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensure each data point matches the expected value

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 @@
---
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this markdown page, we are not using this anymore

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 04d8929. Screenshot reference used in the dedicated docs page instead: https://github.com/user-attachments/assets/86e5d174-be07-435b-9169-2c237af54b1f

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 1, 2026

@edulix I've opened a new pull request, #2609, to work on those changes. Once the pull request is ready, I'll request review from you.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement (CLA).

To sign the CLA, please comment on this PR with:
I have read the CLA Document and I hereby sign the CLA

This is a one-time requirement. Once you have signed, all future contributions will be covered.

You can read the full CLA document here: https://github.com/sequentech/step/blob/main/.github/cla/CLA.md


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://docs.sequentech.io/docusaurus/pr-preview/pr-2608/

Built to branch doc-previews at 2026-05-03 13:45 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@edulix
Copy link
Copy Markdown
Contributor

edulix commented May 3, 2026

@copilot why did you create a new PR? just work in the old PR

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 3, 2026

@copilot why did you create a new PR? just work in the old PR

Continuing on the existing PR. The follow-up changes are in 04d8929. Screenshot: https://github.com/user-attachments/assets/86e5d174-be07-435b-9169-2c237af54b1f

Copilot finished work on behalf of edulix May 3, 2026 11:06
Copilot AI requested a review from edulix May 3, 2026 11:06
@edulix edulix marked this pull request as ready for review May 3, 2026 22:12
Copilot AI review requested due to automatic review settings May 3, 2026 22:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +115 to +119
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.

![Participation Summary widget inside the Admin Portal Tally Results screen](https://github.com/user-attachments/assets/86e5d174-be07-435b-9169-2c237af54b1f)
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>`
Comment on lines +14 to +23
"^.+\\.[jt]sx?$": [
"babel-jest",
{
presets: [
"@babel/preset-env",
["@babel/preset-react", {runtime: "automatic"}],
"@babel/preset-typescript",
],
},
],
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.

3 participants