UI Components & Layouts
Relevant source files
The following files were used as context for generating this wiki page:
- src/app/[locale]/admin/integrations/_components/AdminIntegrationsForm.tsx
- src/app/[locale]/(platform)/_components/HowItWorks.tsx/_components/HowItWorks.tsx)
- src/app/[locale]/admin/events/calendar/_components/AdminCreateEventStepBasics.tsx
- src/app/[locale]/admin/events/calendar/_components/AdminCreateEventStepResolution.tsx
- src/app/[locale]/(platform)/event/[slug]/_components/EventRules.tsx/event/%5Bslug%5D/_components/EventRules.tsx)
- src/app/[locale]/admin/(general)/page.tsx/page.tsx)
- src/app/[locale]/admin/categories/_components/SportsSidebarCategoriesManager.tsx
- tests/unit/CategorySidebar.test.tsx
The UI framework of the prediction market platform is built using a component-based architecture designed for both administrative management and public market interaction. It utilizes a modular approach where complex views are composed of reusable primitive components (buttons, inputs, cards) and specialized feature components (rules panels, sidebar managers). The system leverages a hybrid of server-side rendering for metadata and public shell performance, and client-side interactivity for real-time trading updates and administrative forms.
Sources: src/app/[locale]/admin/(general)/page.tsx, src/app/[locale]/(platform)/event/[slug]/_components/EventRules.tsx
Administrative Layouts & Dashboards
The administrative interface is organized into functional modules such as event creation, integration management, and category organization. These layouts typically employ a grid-based system for metrics and form-heavy sections for configuration.
Metric Visualization
The admin dashboard uses MetricCard and ChartMetricCard components to display platform health and activity. These components provide at-a-glance information such as pending resolutions, registered user growth, and site trading volume. ChartMetricCard integrates with AdminDashboardSparkline to render historical trends.
Sources: src/app/[locale]/admin/(general)/page.tsx:32-101
Admin Form Structures
Complex configuration is handled through a combination of Accordion sections and multi-step forms. The AdminIntegrationsForm utilizes SettingsAccordionSection to group third-party integrations like Google Analytics, OpenRouter, and Sumsub.
Navigation & Sidebar Systems
The platform features a dynamic sidebar system that adapts based on the category (e.g., Crypto, Finance, Sports).
Category Sidebars
The CategorySidebar component renders navigation links, counts of active markets, and dividers. It supports nested structures, such as a "Temperature" branch within "Weather" that can be expanded or collapsed.
| Sidebar Feature | Description | Source |
|---|---|---|
| Branded Icons | Supports both vector SVGs and branded image logos (e.g., Bitcoin/Ethereum logos). | tests/unit/CategorySidebar.test.tsx:88-109 |
| Market Counts | Displays real-time counts of active events per subcategory. | tests/unit/CategorySidebar.test.tsx:33-55 |
| Nested Items | Supports sub-items that can be toggled via an aria-expanded state. | tests/unit/CategorySidebar.test.tsx:111-150 |
Sidebar Management
Administrative users can manage sidebars through the SportsSidebarCategoriesManager. This component uses a Drawer (mobile) or Dialog (desktop) to allow reordering, enabling/disabling, and featuring specific categories.
Sources: src/app/[locale]/admin/categories/_components/SportsSidebarCategoriesManager.tsx:340-420
Event Management Components
Creating and viewing events involves specialized components for defining rules, resolution logic, and metadata.
Event Rules & Resolution Panel
The EventRules component provides a detailed view of how a market is resolved. It includes:
- Accordion/Inline Modes: Supports being embedded in a panel or displayed as a standalone section.
- Resolver Details: Shows the oracle address and a color-coded gradient based on the address checksum.
- Dynamic Resolution: Supports "Propose Resolution" buttons for UMA or Direct Resolution flows.
Sources: src/app/[locale]/(platform)/event/[slug]/_components/EventRules.tsx:150-515
Multi-Step Event Creation
Event creation is split into steps, notably "Basics" and "Resolution."
- Basics Step: Handles title/slug templates (for recurring events), image uploads, and category assignment. It includes a specific sports context sub-form for games and player props.
- Resolution Step: Focuses on defining the source URL and the specific rules of resolution, often leveraging AI generation.
Sources: src/app/[locale]/admin/events/calendar/_components/AdminCreateEventStepBasics.tsx:64-150, src/app/[locale]/admin/events/calendar/_components/AdminCreateEventStepResolution.tsx:35-80
Interactive UI Patterns
Modals and Drawers (How It Works)
The HowItWorks component demonstrates a responsive pattern where content is displayed in a Dialog on desktop and a Drawer on mobile. It uses a stepped navigation flow to onboard users.
Sources: src/app/[locale]/(platform)/_components/HowItWorks.tsx:85-130
Content Persistence & Drafts
The integration and category managers maintain a "draft" state (draftOverride or local component state) to allow users to make multiple changes before persisting them via a single "Save" action.
Sources: src/app/[locale]/admin/categories/_components/SportsSidebarCategoriesManager.tsx:210-250, src/app/[locale]/admin/integrations/_components/AdminIntegrationsForm.tsx:120-150
Technical Summary
The UI architecture relies on next-intl for localization, lucide-react for iconography, and standard accessibility patterns (ARIA labels, roles). Layouts are responsive, frequently switching between Drawer and Dialog based on the useIsMobile hook.
Sources: src/app/[locale]/(platform)/_components/HowItWorks.tsx:85-100, package.json:54-90