-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Problem
Documentation for @betswirl/ui-react library is written in old format inside the library itself. A new documentation website has been created using Nextra. Currently ui-react documentation is not reflected on the website, making it difficult for users to find information about how to use the library.
Desired result
Documentation for @betswirl/ui-react is available on the official documentation website in the Developer Hub → SDKs → React section. Users can easily find information about:
- Installation and setup
- Betting hooks
- Game components
- Context providers
Solution
Migrate documentation from old markdown files in packages/ui-react/docs/ to new structure documentation/app/developer-hub/sdks/react/ using Nextra MDX format.
Documentation structure:
documentation/app/developer-hub/sdks/react/
├── getting-started/page.mdx # Installation and basic setup
├── hooks/
│ ├── overview/page.mdx # Overview of all hooks
│ ├── betting/page.mdx # Betting hooks (usePlaceBet, etc.)
│ ├── game/page.mdx # Game logic hooks (useGameLogic)
│ ├── token/page.mdx # Token operation hooks
│ └── leaderboard/page.mdx # Leaderboard hooks
├── components/
│ ├── games/page.mdx # Game components (CoinToss, Dice, etc.)
│ └── ui/page.mdx # UI components (BettingPanel, etc.)
└── providers/page.mdx # Context providers
Done when
Phase 1: Structure and basic pages
- Created folder structure in documentation/app/developer-hub/sdks/react/
- Updated navigation in _meta.global.tsx to display new pages
- getting-started page contains installation and setup instructions
- All other pages contain "Documentation coming soon" placeholders
Phase 2: Betting hooks documentation
- hooks/betting/page.mdx documents all betting hooks:
- usePlaceBet (internal)
- useBetRequirements
- useBetCalculations
- useBetResultWatcher
- All code examples verified for correctness
- All imports are correct (exported from package)
- All return values verified against source code
- JSDoc in source code usePlaceBet.ts fixed (marked @internal)
Phase 3: Other hooks documentation
- hooks/game/page.mdx documents game hooks (exported):
- useGameLogic (main hook for game logic)
- useGameHistory
- useIsGamePaused
- useEstimateVRFFees
- useGasPrice
- useHouseEdge
- hooks/token/page.mdx documents token hooks (exported):
- useTokenAllowance
- hooks/leaderboard/page.mdx documents leaderboard hooks (exported):
- useClaimableLeaderboardAmount
- useLeaderboardRefresher
- hooks/utility/page.mdx documents utility hooks (exported):
- useDebounce
Phase 4: Components documentation
- components/games/page.mdx documents all game components
- components/ui/page.mdx documents UI components
- providers/page.mdx documents all context providers
Phase 5: Verification and publishing
- All pages open without errors on dev server
- Navigation works correctly
- Code examples have proper indentation in browser