-
Notifications
You must be signed in to change notification settings - Fork 1
✨ Add Market Categories Filter and Sorting #42
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
The market-core contract supports categories (Crypto, Sports, Politics, Economics, Other) but the frontend doesn't utilize this for filtering or display.
Contract Support
;; market-core.clar (Lines 20-26)
(define-constant CATEGORY-CRYPTO u1)
(define-constant CATEGORY-SPORTS u2)
(define-constant CATEGORY-POLITICS u3)
(define-constant CATEGORY-ECONOMICS u4)
(define-constant CATEGORY-OTHER u5)Current Frontend
The MarketsPage only has status filters (All, Active, Resolved) but no category filters.
Proposed Features
1. Category Filter Tabs
[All] [🪙 Crypto] [⚽ Sports] [🏛️ Politics] [📈 Economics] [📦 Other]
2. Category Badge on MarketCard
Show the category with an icon on each market card.
3. Sorting Options
- Newest first (current default)
- Largest pool
- Ending soon
- Most participants
4. Combined Filters
Allow both category AND status filtering:
Category: [Crypto ▾] Status: [Active ▾] Sort: [Ending Soon ▾]
UI Mockup
┌─ Markets ────────────────────────────────┐
│ [All] [🪙 Crypto] [⚽ Sports] [🏛️ Politics]│
│ │
│ Status: [All ▾] Sort: [Newest ▾] │
│ │
│ ┌─────────────────────────────────────┐ │
│ │ 🪙 Crypto │ │
│ │ Will BTC reach $100k by Dec 2026? │ │
│ │ Pool: 245 STX Ends: 3 days │ │
│ └─────────────────────────────────────┘ │
└──────────────────────────────────────────┘
Files to Modify
frontend/src/types/market.ts- Add category to Market typefrontend/src/utils/helpers.ts- Add category parsingfrontend/src/pages/MarketsPage.tsx- Add filter UIfrontend/src/components/MarketCard.tsx- Show category badge
Priority
🟢 Low - UX enhancement
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request