Skip to content

feat(demo-admin-dashboard): Campaign draft snapshot support and restore confirmation#304

Open
Agbasimere wants to merge 3 commits into
Stellar-Mail:mainfrom
Agbasimere:campaign-issue-26-snapshots
Open

feat(demo-admin-dashboard): Campaign draft snapshot support and restore confirmation#304
Agbasimere wants to merge 3 commits into
Stellar-Mail:mainfrom
Agbasimere:campaign-issue-26-snapshots

Conversation

@Agbasimere

Copy link
Copy Markdown

Labels

demo-admin-dashboard, demo-data, Campaign

Closes #277

Description

This PR implements Campaign Draft Snapshot Support for the Demo Admin Dashboard initiative (Campaign issue 26 of 50). It allows maintainers to save snapshots of the currently built draft dataset, list existing snapshots, inspect detailed metadata (target audience, timestamp, tags, draft list), and restore previous campaign draft states with a restore confirmation prompt.

Scope & Constraints

  • All changes are strictly confined to src/features/demo-admin-dashboard/.
  • No files outside src/features/demo-admin-dashboard/ were modified.
  • Resolved pre-existing merge conflict markers in src/features/demo-admin-dashboard/index.ts and src/features/demo-admin-dashboard/README.md.
  • Cleared pre-existing TypeScript compilation issues in src/features/demo-admin-dashboard/DemoDashboard.tsx by declaring the missing DemoUser and DemoItem types in types.ts.

Deliverables & Key Changes

  1. Types: Created types/campaignSnapshot.ts containing the CampaignSnapshot schema.
  2. Fixtures: Created fixtures/campaignSnapshotFixtures.ts containing three public-safe, deterministic, and fake default campaign snapshots (Welcome Series, Security Onboarding, Monthly Newsletter).
  3. Persistence: Updated persistence/localStorageAdapter.ts with convenience get/save/clear helpers for the active draft dataset and campaign snapshots (falling back to preloaded defaults when empty).
  4. UI Components:
    • Built components/CampaignSnapshots.tsx representing the new Campaigns dashboard section. It allows saving, viewing metadata, deleting, and restoring snapshots with a confirmation step detailing active vs target draft counts.
    • Lifted dataset state in DemoAdminDashboard.tsx to keep the Templates tab and Campaigns tab in sync.
  5. Documentation: Updated README.md to resolve conflicts and document the new Campaign Snapshots feature.
  6. Tests:
    • Added unit tests in __tests__/campaignSnapshots.test.ts to test default fallback snapshots, custom saving, retrieval, deletion, and schema validations.
    • Added unit tests in __tests__/localStorageAdapter.test.ts to check storage adapter get/save operations.
    • All 37 feature tests pass successfully.

Testing Checklist

  • Unit tests pass: npx vitest run src/features/demo-admin-dashboard/__tests__/
  • Codebase formatting matches Prettier: npx prettier --check src/features/demo-admin-dashboard/
  • Compilation completes without issues: npm run build

…onfirmation support

Confined changes entirely under src/features/demo-admin-dashboard/. Added CampaignSnapshots UI component, fixtures, storage persistence helpers, and automated unit tests. Resolved pre-existing merge conflict markers.
@kryputh

kryputh commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Fix conflict

@Agbasimere Agbasimere force-pushed the campaign-issue-26-snapshots branch from cd4a7bb to 2565b4d Compare June 17, 2026 00:33
@Agbasimere

Copy link
Copy Markdown
Author

@kryputh Resolved.

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.

Add campaign rollback snapshots

2 participants