mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-25 21:08:00 +00:00
feat: Phase 1B complete - Perwerde & ValidatorPool UI
Perwerde (Education Platform): - Add hybrid backend (Supabase + Blockchain + IPFS) - Implement CourseList, CourseCreator, StudentDashboard - Create courses table with RLS policies - Add IPFS upload utility - Integrate with pallet-perwerde extrinsics ValidatorPool: - Add validator pool management UI - Implement PoolCategorySelector with 3 categories - Add ValidatorPoolDashboard with pool stats - Integrate with pallet-validator-pool extrinsics - Add to StakingDashboard as new tab Technical: - Fix all toast imports (sonner) - Fix IPFS File upload (Blob conversion) - Fix RLS policies (wallet_address → auth.uid) - Add error boundaries - Add loading states Status: UI complete, blockchain integration pending VPS deployment
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { ValidatorPoolCategory } from '@shared/lib/validator-pool';
|
||||
|
||||
interface PoolCategorySelectorProps {
|
||||
currentCategory?: ValidatorPoolCategory;
|
||||
onCategoryChange: (category: ValidatorPoolCategory) => void;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
const POOL_CATEGORIES = Object.values(ValidatorPoolCategory);
|
||||
|
||||
export function PoolCategorySelector({ currentCategory, onCategoryChange, disabled }: PoolCategorySelectorProps) {
|
||||
const [selectedCategory, setSelectedCategory] = useState<ValidatorPoolCategory>(currentCategory || POOL_CATEGORIES[0]);
|
||||
|
||||
const handleSubmit = () => {
|
||||
onCategoryChange(selectedCategory);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<Select value={selectedCategory} onValueChange={(value) => setSelectedCategory(value as ValidatorPoolCategory)} disabled={disabled}>
|
||||
<SelectTrigger className="w-full bg-gray-800 border-gray-700 text-white">
|
||||
<SelectValue placeholder="Select a pool category..." />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{POOL_CATEGORIES.map(cat => (
|
||||
<SelectItem key={cat} value={cat}>{cat.replace(/([A-Z])/g, ' $1').trim()}</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Button onClick={handleSubmit} disabled={disabled || !selectedCategory} className="w-full">
|
||||
{disabled && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
|
||||
{currentCategory ? 'Switch Category' : 'Join Pool'}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user