Skip to content

feat(offline): show queued drafts badge (#795) - #848

Merged
Jaydbrown merged 5 commits into
conduit-protocol:mainfrom
aratass:feat/795-offline-queue-badge
Oct 22, 2026
Merged

Jaydbrown merged 5 commits into
conduit-protocol:mainfrom
aratass:feat/795-offline-queue-badge

Conversation

@aratass

@aratass aratass commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Shows how many offline transactions are waiting to be sent. The floating notice now reads "N drafts queued offline" ("1 draft queued offline" for one) with the count in a pill, and the count stays in sync across tabs.

Type of change

  • Bug fix
  • New feature / page / component
  • Refactor
  • Style / design fix
  • Test coverage
  • Documentation
  • Dependency update

Related issue

Closes #795

Changes

File Change
lib/offline-transactions.ts New queuedDraftsLabel(count) (singular or plural; negative or NaN counts read as 0) and exported OFFLINE_QUEUE_STORAGE_KEY
components/OfflineTransactionSync.tsx Renders the count pill and the label. Refreshes the count on storage events for the queue key, so a draft queued or flushed in another tab updates this tab too (the existing offline-transactions-changed event only fires in the same tab). Black and white classes instead of the old blue ones, inverted in dark mode. The status region's aria-label reads the whole sentence once. The reconnect retry message is unchanged.
lib/__tests__/offline-transactions-badge.test.ts New: 4 tests for the label
components/__tests__/OfflineTransactionSync.test.tsx 5 new badge tests (empty queue renders nothing, plural, singular, update in the same tab, update from another tab). The mock now defines queuedTransactions; without it the 3 existing tests in this file failed on main. All 8 pass now.
CHANGELOG.md Entry under [Unreleased], Added

Checklist

  • npm run typecheck — no errors in the changed files; the 7 errors left are in app/dashboard/page.tsx and are the same on main
  • npm run lint — no warnings in the changed files
  • npm test — no new failures: main has 26 failing test files, this branch has 25 (OfflineTransactionSync.test.tsx passes now); the others fail the same way on main, for example the dashboard tests that hit the syntax error in app/dashboard/page.tsx around line 681
  • npm run build — not run, because of the existing errors in app/dashboard/page.tsx
  • Tested in browser with Freighter on testnet — not done; the change is the badge text and styling, covered by the render tests
  • No hue-named Tailwind colour classes added (black/white/gray only)
  • Loading state handled for any new data-fetching UI (no data fetching added)
  • Error state handled and displayed inline (no alert()) (no new error paths)
  • 'use client' added only where genuinely needed (none added; the component already had it)
  • CHANGELOG.md updated under [Unreleased]

Screenshots

The badge rendered on its own with the repo's Tailwind config (wallet mocked; 1 and 3 queued drafts; light and dark). Before is main, after is this branch.

Before: blue notice reading 1 transaction queued for retry and 3 transactions queued for retry After: black and white notice with the count in a pill, reading 1 draft queued offline and 3 drafts queued offline

Notes for reviewers

  • Five commits in the CONTRIBUTING order: test, logic (with Closes #795), UI, style, chore. Each body says why.
  • Commit 1 fails on main, where the label helper does not exist yet.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RcnHnXiw2CqnpbuFR5q6VA

aratass and others added 5 commits October 22, 2026 14:16
…otocol#795)

Pending offline transactions sit in the queue with no count the user can
trust. These tests pin the badge: the 'N drafts queued offline' label
(singular for one), nothing rendered for an empty queue, and live updates
when the queue changes in this tab or in another tab. They fail on main,
where the label helper does not exist yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcnHnXiw2CqnpbuFR5q6VA
Users need to see that their offline drafts are kept and waiting for the
connection to come back. queuedDraftsLabel() gives the badge its wording
('1 draft queued offline', '3 drafts queued offline') in one tested place,
and the component now also refreshes the count on storage events for the
queue key, because a draft queued or flushed in another tab never fires
this tab's offline-transactions-changed event.

Closes conduit-protocol#795

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcnHnXiw2CqnpbuFR5q6VA
The floating notice said 'N transactions queued for retry', which reads as
an error rather than as reassurance that offline drafts are safe. It now
shows the count on its own followed by 'drafts queued offline', using the
label from queuedDraftsLabel(); the reconnect retry message is unchanged.
Layout only: the black-and-white styling and accessible name follow in the
next commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcnHnXiw2CqnpbuFR5q6VA
The notice used blue utility classes, which the design system rules out
(the app is black and white only). The badge is now a black pill with the
count inside a bordered white box, inverted in dark mode, using tabular
numbers so the width stays steady as the count changes. Screen readers get
the whole sentence once through aria-label on the status region instead of
the count and the words as separate fragments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcnHnXiw2CqnpbuFR5q6VA
Records the queued drafts badge under Unreleased so the next release notes
mention it. next lint reports no warnings or errors for the changed files,
and tsc reports no errors in them (the only tsc errors on this branch are
the existing ones in app/dashboard/page.tsx, which main has too).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcnHnXiw2CqnpbuFR5q6VA
@drips-wave

drips-wave Bot commented Oct 22, 2026

Copy link
Copy Markdown

@aratass Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Jaydbrown
Jaydbrown merged commit ed4da15 into conduit-protocol:main Oct 22, 2026
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.

components/OfflineTransactionSync.tsx: show queue count badge of pending offline transactions

2 participants