Skip to content

feat: refresh snippet table, preview and notice presentation - #422

Merged
imantsk merged 44 commits into
fix/166-ui-review-fixesfrom
feat/community-cloud-polish
Jul 28, 2026
Merged

feat: refresh snippet table, preview and notice presentation#422
imantsk merged 44 commits into
fix/166-ui-review-fixesfrom
feat/community-cloud-polish

Conversation

@imantsk

@imantsk imantsk commented Jul 23, 2026

Copy link
Copy Markdown
Member

Summary

Community Cloud

  • show page-level loading and error notices for Community Cloud requests, announced through live regions
  • share download state across cards, table rows and the preview so every action reflects a completed download
  • add download or edit actions to cloud snippet previews

Preview modal

  • move the type badge into the modal header, and style the modal actions with the plugin control tokens

Snippet tables

  • apply one canonical checkbox style across cards, tables, the toolbar and settings
  • line checkbox cells up across the header, footer and both row states, and reserve the active-row accent border so rows no longer shift when toggled
  • centre row contents and the activate column, and match column padding between the snippets and cloud tables
  • unify row action colours, including hover, and add a focus ring to snippet type badges

Admin chrome

  • hide foreign admin notices on every plugin screen, keeping notices owned by the plugin and by WordPress settings visible
  • mark notices rendered by the plugin as its own, so the filter cannot hide them
  • match the add new button to the other plugin buttons, and align the upgrade button icon

Tests

  • consolidate the end-to-end coverage added here into fewer page loads, and stub the cloud requests before the first navigation
  • cover row alignment, badge focus, cross-mount download state and the notice filtering rules

Compatibility

  • WordPress 6.4 and newer display the preview type badge in the modal header. WordPress 5.5–6.3 ignore the unsupported header action prop; the modal remains functional without the badge.

Verification

  • npx eslint src tests
  • npx stylelint "src/css/**/*.scss"
  • phpcs
  • npm run build
  • Playwright: full suite across both storage targets, 168 checks

Note

  • The preview modal trash action uses the destructive colours as literals, matching the twenty existing occurrences across the stylesheets. _theme.scss has no destructive token yet; adding one and converting every occurrence is tracked separately, so that this change does not leave a token and a literal in use for the same colour.

Comment thread src/css/common/_modal.scss Outdated
inset-block-start: 18px;
inset-block-start: 35px;
inset-inline-end: 56px;
transform: translateY(-50%);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

there should be abetter solution imo

@imantsk imantsk Jul 24, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

the absolute positioning and magic offsets are gone. The badge now renders as the first row of the modal content, aligned to the inline end under the title, plain flex flow (f740d76). Placement is covered by the geometry assertions in the preview spec.

@code-snippets-bot

Copy link
Copy Markdown
Contributor
  • Medium — tests/e2e/code-snippets-community-featured.spec.ts:106: The new loading test does not type-check because releaseRequest is inferred as () => undefined and cannot receive the Promise resolver. Give it an explicit () => void type and assign a zero-argument wrapper around resolve.

  • Medium — src/js/components/common/LoadingStatusNotices.tsx:21: Loading and error updates are inserted as plain region landmarks, so assistive technology is not notified when either state changes. Reuse the existing Notice component with status/polite semantics for loading and alert/assertive semantics for errors, then update the E2E roles.

  • Medium — src/js/components/common/cloud/CloudSnippetPreviewModal.tsx:20: The preview and card/table mount independent download-button state, so downloading in the preview leaves the underlying action as Download and a second click creates another local copy. Share the resolved local snippet ID with sibling actions or refresh cloud results after success.

@imantsk

imantsk commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

Addressed all three findings: the loading and error notices now use live-region semantics (role="status" polite / role="alert") so state changes are announced; downloading from the preview refreshes the shared cloud results, so every action for that snippet flips to Edit and repeat downloads are prevented, with e2e coverage; and releaseRequest is explicitly typed () => void with a zero-argument resolver wrapper. Verified with lint, PHPUnit (single and multisite), the build, and the featured + preview Playwright suites.

@code-snippets-bot

Copy link
Copy Markdown
Contributor
  • Medium — src/js/components/common/cloud/CloudSnippetDownloadButton.tsx:28: Each button still owns its downloaded ID, while onDownloaded only starts an asynchronous refresh; closing the preview before that refresh completes—or after it fails—leaves the sibling Download action enabled and permits another download POST. Lift the resolved ID and pending state to the row/card and share them between both buttons, with a delayed/failed-refresh test.

@imantsk

imantsk commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

Download state is now owned by a shared per-snippet provider rather than each button: card, table, and preview actions read the same pending/downloaded record, so a download in the preview immediately flips every sibling action and repeat downloads are prevented even before the results refresh completes or if it fails. Covered by e2e cases for the delayed-refresh and failed-refresh paths. Verified with lint, PHPUnit (single and multisite), the build, and the featured + preview Playwright suites.

@imantsk imantsk added the build Adding this label will trigger the zip build action label Jul 24, 2026
@imantsk imantsk self-assigned this Jul 24, 2026
@imantsk
imantsk marked this pull request as ready for review July 24, 2026 15:34
@code-snippets-bot

code-snippets-bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Download and install

📦 code-snippets.4.0.0-beta.2.zip

@imantsk imantsk changed the title feat: polish community cloud interactions feat: refresh snippet table, preview and notice presentation Jul 27, 2026
@imantsk
imantsk merged commit c12c94b into fix/166-ui-review-fixes Jul 28, 2026
6 checks passed
@imantsk imantsk mentioned this pull request Jul 28, 2026
@sheabunge
sheabunge deleted the feat/community-cloud-polish branch July 29, 2026 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Adding this label will trigger the zip build action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants