Spaces:
Runtime error
Runtime error
Commit ·
a0009e3
1
Parent(s): 6ad6dca
feat: enhance public vault UI with clearer descriptions and add an Admin Dashboard PRD.
Browse files- ADMINDASHBOARD_PRD.md +90 -0
- src/features/vault/components/quick-analyze-tool.tsx +11 -4
- token.txt +1 -0
ADMINDASHBOARD_PRD.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Product Requirement Document: Admin Dashboard & Manual Analysis Workflow
|
| 2 |
+
|
| 3 |
+
## 1. Overview
|
| 4 |
+
The goal is to create a comprehensive Admin Dashboard for "Vault" that allows operations admins to monitor key platform metrics (users, videos, products) and manage a "Wizard of Oz" style workflow for AI product analysis.
|
| 5 |
+
|
| 6 |
+
Currently, AI analysis can be tracked via technical logs, but this change shifts control to a user-friendly admin interface. It introduces a manual review step ("Wizard of Oz" method) where admins must approve or manually add products before they are visible to the end user.
|
| 7 |
+
|
| 8 |
+
## 2. User Roles & Permissions
|
| 9 |
+
- **Admin**: Users with emails listed in the `ADMIN_EMAILS` environment variable.
|
| 10 |
+
- **User**: Standard platform user (Creator/Viewer).
|
| 11 |
+
|
| 12 |
+
## 3. Features
|
| 13 |
+
|
| 14 |
+
### 3.1 Admin Dashboard (`/admin/dashboard`)
|
| 15 |
+
A central hub for monitoring platform health and activity.
|
| 16 |
+
|
| 17 |
+
#### Key Metrics:
|
| 18 |
+
1. **User Stats**:
|
| 19 |
+
- Total registered users.
|
| 20 |
+
- New users (last 24h/7d).
|
| 21 |
+
2. **Video Stats**:
|
| 22 |
+
- Total videos submitted.
|
| 23 |
+
- **Status Breakdown**: Pending Review, In Progress, Completed, Failed.
|
| 24 |
+
3. **Product Stats**:
|
| 25 |
+
- **Matched Products** (With Links): Number of detected objects matched to a marketplace product.
|
| 26 |
+
- **Unmatched Products** (Without Links): Detected objects pending a match.
|
| 27 |
+
- **Interest Pledges**: Count of user "I want this" interactions.
|
| 28 |
+
- **Suggestions**: Count of product suggestions from viewers (product requests) and affiliate proposals (suppliers).
|
| 29 |
+
|
| 30 |
+
### 3.2 Manual "AI" Analysis Workflow
|
| 31 |
+
Replace the fully automated trigger with a human-in-the-loop review process.
|
| 32 |
+
|
| 33 |
+
#### Workflow Steps:
|
| 34 |
+
1. **User Trigger**:
|
| 35 |
+
- User clicks "Analyze Video" (or auto-trigger on upload).
|
| 36 |
+
- **System Update**: Sets video `scan_status` to `pending_manual_review` (or similar status).
|
| 37 |
+
- **User Feedback**: Video shows "Analysis in Progress". Results are hidden until approved.
|
| 38 |
+
|
| 39 |
+
2. **Admin Queue (`/admin/analysis-queue`)**:
|
| 40 |
+
- Display list of videos with status `pending_manual_review`.
|
| 41 |
+
- Columns: Video Title, Creator, Submission Date, Current Status.
|
| 42 |
+
- Action: "Start Review".
|
| 43 |
+
|
| 44 |
+
3. **Analysis Interface**:
|
| 45 |
+
- **Video Player**: Watch the submitted video.
|
| 46 |
+
- **Manual Product Entry**:
|
| 47 |
+
- Form to add a "Detected Object" (Time, Category, Name).
|
| 48 |
+
- Form to add "Marketplace Match" (Affiliate Link, Product Name, Price, Image).
|
| 49 |
+
- **AI Assistance (Optional)**: "Run Auto-Analysis" button to pre-fill the list for admin review/editing.
|
| 50 |
+
- **Complete Review**:
|
| 51 |
+
- Button: "Publish Analysis".
|
| 52 |
+
- **System Update**: Sets `scan_status` to `completed`.
|
| 53 |
+
- **User Feedback**: Notification sent (optional), results become visible on the video page.
|
| 54 |
+
|
| 55 |
+
### 3.3 Product Status Monitoring (`/admin/products`)
|
| 56 |
+
A view to manage and improve product data quality.
|
| 57 |
+
|
| 58 |
+
* **Filterable List**:
|
| 59 |
+
- "Missing Link": Objects without marketplace matches.
|
| 60 |
+
- "Has Interest": Objects with high user interest pledges.
|
| 61 |
+
- "User Suggestion": Pending product requests/proposals.
|
| 62 |
+
* **Actions**:
|
| 63 |
+
- **Add Link**: Quick entry for affiliate URL.
|
| 64 |
+
- **Approve/Reject Suggestion**: Move a suggestion to a confirmed match.
|
| 65 |
+
|
| 66 |
+
## 4. Technical Requirements
|
| 67 |
+
|
| 68 |
+
### 4.1 Database Changes
|
| 69 |
+
* **Schema**:
|
| 70 |
+
- Ensure `video_scan_status` enum supports a manual review state (e.g., `pending_review`).
|
| 71 |
+
- Reuse existing `admin_moderation` table for logging admin actions, or create `admin_analysis_log`.
|
| 72 |
+
* **API**:
|
| 73 |
+
- `GET /api/admin/stats`: Aggregate counts for dashboard.
|
| 74 |
+
- `GET /api/admin/queue`: Fetch pending videos.
|
| 75 |
+
- `POST /api/admin/analysis/complete`: Publish results.
|
| 76 |
+
|
| 77 |
+
### 4.2 UI Components
|
| 78 |
+
* **Dashboard**: Use `shadcn/ui` Cards for metrics.
|
| 79 |
+
* **Data Table**: Use `shadcn/ui` DataTable for video/product lists with filtering/sorting.
|
| 80 |
+
* **Forms**: `react-hook-form` and `zod` for validation of manual product entry.
|
| 81 |
+
|
| 82 |
+
## 5. Future / Additional Suggestions
|
| 83 |
+
1. **Revenue & Click Tracking**:
|
| 84 |
+
- Visualize `affiliateRevenue` and `productClicks` data.
|
| 85 |
+
- Chart: Daily Clicks vs. Revenue.
|
| 86 |
+
2. **User Management**:
|
| 87 |
+
- Searchable user list.
|
| 88 |
+
- "Ban User" functionality for spam prevention.
|
| 89 |
+
3. **Performance Metrics**:
|
| 90 |
+
- Track "Time to Review" (Submission Time vs. Completion Time) to identify bottlenecks in the manual workflow.
|
src/features/vault/components/quick-analyze-tool.tsx
CHANGED
|
@@ -80,11 +80,18 @@ export function QuickAnalyzeTool() {
|
|
| 80 |
return (
|
| 81 |
<Card className="glass overflow-hidden shadow-sm hover:shadow-md transition-all duration-300">
|
| 82 |
<CardContent className="p-4 space-y-4">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
<form onSubmit={handleSubmit} className="flex flex-col sm:flex-row items-center gap-3">
|
| 84 |
<div className="relative flex-1 w-full">
|
| 85 |
<Sparkles className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-amber-400/80" />
|
| 86 |
<Input
|
| 87 |
-
placeholder="Paste
|
| 88 |
value={url}
|
| 89 |
onChange={(e) => setUrl(e.target.value)}
|
| 90 |
className="pl-10 h-11 bg-secondary/50 border-border focus:border-primary/50 transition-all font-medium"
|
|
@@ -100,7 +107,7 @@ export function QuickAnalyzeTool() {
|
|
| 100 |
<Loader2 className="h-4 w-4 animate-spin" />
|
| 101 |
) : (
|
| 102 |
<span className="flex items-center gap-2">
|
| 103 |
-
|
| 104 |
</span>
|
| 105 |
)}
|
| 106 |
</Button>
|
|
@@ -112,7 +119,7 @@ export function QuickAnalyzeTool() {
|
|
| 112 |
<div className="flex items-center gap-2 mb-3">
|
| 113 |
<Users className="h-3.5 w-3.5 text-primary" />
|
| 114 |
<span className="text-[10px] uppercase tracking-widest font-bold text-muted-foreground">
|
| 115 |
-
|
| 116 |
</span>
|
| 117 |
</div>
|
| 118 |
|
|
@@ -151,7 +158,7 @@ export function QuickAnalyzeTool() {
|
|
| 151 |
<div className="flex items-center justify-between px-1">
|
| 152 |
<div className="flex items-center gap-2 text-[10px] uppercase tracking-wider font-bold text-muted-foreground/60">
|
| 153 |
<div className="h-1 w-1 rounded-full bg-emerald-500" />
|
| 154 |
-
Instant
|
| 155 |
</div>
|
| 156 |
</div>
|
| 157 |
|
|
|
|
| 80 |
return (
|
| 81 |
<Card className="glass overflow-hidden shadow-sm hover:shadow-md transition-all duration-300">
|
| 82 |
<CardContent className="p-4 space-y-4">
|
| 83 |
+
<div className="space-y-1">
|
| 84 |
+
<h3 className="font-semibold text-lg tracking-tight">Create & Share a Public Vault</h3>
|
| 85 |
+
<p className="text-sm text-muted-foreground">
|
| 86 |
+
Add products to any YouTube video instantly. Your contributions are saved to the public vault for everyone to see. Create an account to claim any video for your own personal vault.
|
| 87 |
+
</p>
|
| 88 |
+
</div>
|
| 89 |
+
|
| 90 |
<form onSubmit={handleSubmit} className="flex flex-col sm:flex-row items-center gap-3">
|
| 91 |
<div className="relative flex-1 w-full">
|
| 92 |
<Sparkles className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-amber-400/80" />
|
| 93 |
<Input
|
| 94 |
+
placeholder="Paste a YouTube link to add products & build a vault..."
|
| 95 |
value={url}
|
| 96 |
onChange={(e) => setUrl(e.target.value)}
|
| 97 |
className="pl-10 h-11 bg-secondary/50 border-border focus:border-primary/50 transition-all font-medium"
|
|
|
|
| 107 |
<Loader2 className="h-4 w-4 animate-spin" />
|
| 108 |
) : (
|
| 109 |
<span className="flex items-center gap-2">
|
| 110 |
+
Create Public Vault
|
| 111 |
</span>
|
| 112 |
)}
|
| 113 |
</Button>
|
|
|
|
| 119 |
<div className="flex items-center gap-2 mb-3">
|
| 120 |
<Users className="h-3.5 w-3.5 text-primary" />
|
| 121 |
<span className="text-[10px] uppercase tracking-widest font-bold text-muted-foreground">
|
| 122 |
+
View Public Vaults created by others
|
| 123 |
</span>
|
| 124 |
</div>
|
| 125 |
|
|
|
|
| 158 |
<div className="flex items-center justify-between px-1">
|
| 159 |
<div className="flex items-center gap-2 text-[10px] uppercase tracking-wider font-bold text-muted-foreground/60">
|
| 160 |
<div className="h-1 w-1 rounded-full bg-emerald-500" />
|
| 161 |
+
Instant Access • Public Vault • No Sign-up
|
| 162 |
</div>
|
| 163 |
</div>
|
| 164 |
|
token.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
rw_Fe26.2**697f4b3bc35ad47e30ed7b47caebab2f0b5fe6123b0c2e955619ff10d25afcd4*JdDh0I8b-Y0QD-8fscbaVQ*zNQztyWi6dfFMTxFaLxSqkyv5E9O1j7m1_EYHfdfQb7ZugO9_-siGysXRtU8Erd1pLbqKOJP4EWKsNdH3JXr6g*1771815081405*85be130ca8d17ce9de8c54567d932782ea8aff7f84c3f9b35193483b6445f8bf*mHVmPbon5WFHa9DjC01hTmTQYBTCmZx6mgl8_79O5pY
|