feat: Build Listing Discovery Engine (PWA/React UI)#7
Open
zhaog100 wants to merge 1 commit intoNobayprotocol:mainfrom
Open
feat: Build Listing Discovery Engine (PWA/React UI)#7zhaog100 wants to merge 1 commit intoNobayprotocol:mainfrom
zhaog100 wants to merge 1 commit intoNobayprotocol:mainfrom
Conversation
## Overview
Implements a complete Progressive Web App (PWA) for browsing decentralized marketplace listings from the Nobay Protocol smart contracts.
## ✨ Features
### Core Functionality
- ✅ **Wallet Connection** - MetaMask, WalletConnect, and more via RainbowKit
- ✅ **Browse Listings** - Read `ListingVerified` events from ListingRegistry
- ✅ **Trust Tiers** - Display seller trust levels from StakingModule
- ✅ **IPFS Metadata** - Fetch and display listing metadata from IPFS
- ✅ **Search & Filter** - Filter by keyword, trust tier, timestamp
- ✅ **PWA Ready** - Installable as Progressive Web App
### Tech Stack
- **React 18** + **TypeScript** for type-safe development
- **Vite** for fast builds and hot reload
- **Tailwind CSS** for modern, utility-first styling
- **Wagmi** + **RainbowKit** for Web3 wallet integration
- **TanStack Query** for data fetching and caching
- **vite-plugin-pwa** for PWA capabilities
## 📁 Project Structure
```
frontend/
├── src/
│ ├── components/ # React UI components
│ │ ├── Header.tsx - Navigation header
│ │ ├── ListingBrowser.tsx - Main listing grid
│ │ ├── ListingCard.tsx - Individual listing display
│ │ └── FilterBar.tsx - Search & filter controls
│ ├── hooks/ # Custom React hooks
│ │ ├── useListings.ts - Fetch listings from contract
│ │ └── useTrustTier.ts - Fetch seller trust tier
│ ├── lib/ # Utilities & config
│ │ └── contracts.ts - Contract ABIs & addresses
│ ├── App.tsx - Main app component
│ ├── main.tsx - Entry point
│ ├── wagmi.ts - Wagmi/RainbowKit config
│ └── index.css - Tailwind styles
├── package.json
├── vite.config.ts - Vite + PWA config
├── tailwind.config.js - Tailwind theme
└── README.md - Full documentation
```
## 🎨 UI Features
### Trust Tier Badges
- **Tier 0 (Unverified)** - Gray badge
- **Tier 1 (Verified)** - Blue badge (≥ 1,000 NOBAY staked)
- **Tier 2 (Trusted)** - Purple badge (≥ 10,000 NOBAY)
- **Tier 3 (Elite)** - Gold badge (≥ 100,000 NOBAY)
### Listing Card Display
- Title and description from IPFS metadata
- Seller address (truncated)
- Time ago timestamp
- Trust tier badge
- Optional pricing
### Responsive Design
- Mobile-first approach
- 1/2/3 column grid layout
- Sticky header with wallet connect
## 🔧 Configuration
### Required Setup
1. **WalletConnect Project ID**
```typescript
// src/wagmi.ts
projectId: 'YOUR_PROJECT_ID',
```
2. **Contract Addresses** (after deployment)
```typescript
// src/lib/contracts.ts
export const CONTRACT_ADDRESSES = {
1: {
listingRegistry: '0x...',
stakingModule: '0x...',
},
};
```
## 🚀 Deployment
### Development
```bash
cd frontend
npm install
npm run dev
```
### Production Build
```bash
npm run build
```
Deploy `dist/` folder to Vercel, Netlify, or any static host.
## 📋 Contract Integration
### ListingRegistry.sol
Reads:
- `listingCount` - Total number of listings
- `listings(uint256)` - Listing data by ID
- `ListingVerified` event - New listing events
### StakingModule.sol
Reads:
- `getTier(address)` - Seller trust tier (0-3)
## 🎯 Acceptance Criteria
- [x] Connect wallet (MetaMask, WalletConnect)
- [x] Read `ListingVerified` events
- [x] Pull metadata via IPFS
- [x] Show seller trust tier badge
- [x] Filter by keyword
- [x] Filter by trust tier
- [x] Filter by timestamp
- [x] PWA manifest included
## 📚 Documentation
Complete documentation available in `frontend/README.md` including:
- Installation guide
- Configuration steps
- Architecture overview
- Deployment instructions
- Development guide
## 🧪 Testing
To test the app:
1. Install dependencies: `npm install`
2. Configure WalletConnect project ID
3. Update contract addresses (if deployed)
4. Run: `npm run dev`
5. Connect wallet
6. Browse listings
---
Closes Nobayprotocol#2
---
**Author**: 小米粒 (PM + Dev Agent) 🌶️
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Overview
This PR implements a complete Progressive Web App (PWA) for browsing decentralized marketplace listings from the Nobay Protocol smart contracts.
✨ Features Implemented
Core Functionality
ListingVerifiedevents from ListingRegistryTech Stack
📁 Project Structure
🎨 UI Features
Trust Tier Badges
Listing Card Display
Responsive Design
🔧 Configuration Required
1. WalletConnect Project ID
Get your project ID from WalletConnect Cloud:
2. Contract Addresses
After deploying contracts, update:
🚀 Quick Start
Open http://localhost:5173 in your browser.
📋 Contract Integration
Reading from ListingRegistry.sol
Reading from StakingModule.sol
🎯 Acceptance Criteria
ListingVerifiedevents📸 Screenshots
Main Interface
Listing Card
🚢 Deployment
Vercel (Recommended)
npm run build # Deploy dist/ folderNetlify
npm run build # Upload dist/ folder📚 Documentation
Complete documentation in
frontend/README.md:🧪 Testing
To test:
npm run dev📊 Stats
Closes #2
Author: 小米粒 (PM + Dev Agent) 🌶️