Skip to content

refactor: decouple mock API data into separate fixtures file and upda… - #396

Merged
Lakes41 merged 1 commit into
Adamantine-guild:mainfrom
GiftedGiftB:Separate-static-mock-fixtures-from-mock-API-behavior
Aug 19, 2026
Merged

refactor: decouple mock API data into separate fixtures file and upda…#396
Lakes41 merged 1 commit into
Adamantine-guild:mainfrom
GiftedGiftB:Separate-static-mock-fixtures-from-mock-API-behavior

Conversation

@GiftedGiftB

Copy link
Copy Markdown
Contributor

Closed #389

Description

This PR refactors the frontend mock database by decoupling static data fixtures from the mock API behavior. It also fixes several UI/UX bugs in the Admin Settings dashboard, resolving malformed component structures and fixing broken toast notification bindings.

Type of Change

  • 🐛 Bug fix (UI or API integration)
  • ✨ New feature / component
  • 🎨 UI/UX improvement
  • 📝 Documentation update
  • 🔧 Chore / refactor / dependency update
  • 🧪 Tests only

Changes Made

  • lib/api/mock/fixtures.ts: [New File] Extracted all static mock fixtures (members, resources, policies, communities, webhook events, and seed naming pools) into a dedicated file.
  • lib/api/mock.ts: Refactored to import static fixtures rather than declaring them inline, drastically simplifying the file and strictly separating state mutation behavior from data.
  • app/[communitySlug]/admin/settings/page.tsx:
    • Fixed a build-breaking JSX error caused by an unclosed <Card> component and a duplicated Workflow & Approvals section.
    • Fixed useToasts() hook usage by properly destructuring toasts and dismissToast.
    • Added required toasts and onDismiss props to the <ToastViewport /> component to prevent invisible toast errors.
    • Corrected addToast options to use the valid tone property instead of variant.
  • test/pending-actions.test.ts: Fixed severe test file corruption (duplicated imports and redefined block-scoped variables) that was failing the test suite.

Screenshots / Recordings

Before After
Admin Settings failing to render / missing toasts Admin Settings renders correctly with functioning toast notifications

Test Evidence

  • Tested in mock mode (NEXT_PUBLIC_MOCK_MODE=true)
  • Tested against live guildpass-core (if applicable)

Checklist

  • I have read CONTRIBUTING.md
  • This PR is linked to an open issue
  • npm run typecheck passes
  • npm run lint passes
  • New components work in mock mode
  • Loading, empty, and error states are handled in new feature modules
  • No inline styles — Tailwind classes used throughout
  • No secrets or API keys included
  • .env.example updated if new environment variables were added
  • Accessibility: interactive elements are keyboard-navigable and have ARIA labels where needed

Additional Notes

The Typescript configuration deprecation warnings from TS 5.x were also suppressed in the root and test tsconfig.json files to ensure a cleaner build output pipeline.

@Lakes41
Lakes41 merged commit 9e761fb into Adamantine-guild:main Aug 19, 2026
1 check passed
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.

Separate static mock fixtures from mock API behavior

2 participants