Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | import { useQuery } from "@tanstack/react-query";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import { Progress } from "@/components/ui/progress";
import { Map, Cpu, Beaker, BookOpen, ArrowRight, Star, TrendingUp, Trophy, Target } from "lucide-react";
import { apiRequest } from "@/lib/queryClient";
import type { AiModel, UseCase, ModelTest, ModelRecommendation, UserModel, UserTool } from "@shared/schema";
import { Link } from "wouter";
const categoryColors: Record<string, string> = {
"Strategic Analysis": "bg-purple-500",
"Writing": "bg-blue-500",
"Code": "bg-green-500",
"Research": "bg-amber-500",
"Automation": "bg-cyan-500",
"Visual Design": "bg-pink-500",
"Audio/Video": "bg-red-500",
"Other": "bg-gray-500",
};
export default function MyMapPage() {
// Fetch user's models
const { data: userModels = [] } = useQuery<(UserModel & { model: AiModel })[]>({
queryKey: ["/api/model-map/user/models"],
queryFn: async () => {
const res = await apiRequest("GET", "/api/model-map/user/models");
return res.json();
},
});
// Fetch user's tools
const { data: userTools = [] } = useQuery<(UserTool & { tool: any })[]>({
queryKey: ["/api/model-map/user/tools"],
queryFn: async () => {
const res = await apiRequest("GET", "/api/model-map/user/tools");
return res.json();
},
});
// Fetch user's test history
const { data: tests = [] } = useQuery<ModelTest[]>({
queryKey: ["/api/model-map/tests"],
queryFn: async () => {
const res = await apiRequest("GET", "/api/model-map/tests");
return res.json();
},
});
// Fetch recommendations
const { data: recommendations = [] } = useQuery<(ModelRecommendation & { model: AiModel })[]>({
queryKey: ["/api/model-map/recommendations"],
queryFn: async () => {
const res = await apiRequest("GET", "/api/model-map/recommendations");
return res.json();
},
});
// Fetch curated use cases
const { data: curatedUseCases = [] } = useQuery<UseCase[]>({
queryKey: ["/api/model-map/use-cases", "curated"],
queryFn: async () => {
const res = await apiRequest("GET", "/api/model-map/use-cases?curated=true");
return res.json();
},
});
// Calculate progress
const totalUseCases = curatedUseCases.length;
const completedTests = tests.length;
const progressPercent = totalUseCases > 0 ? Math.min((completedTests / totalUseCases) * 100, 100) : 0;
// Track which use cases have been tested
const testedUseCaseIds = new Set(
tests
.filter(t => t.useCaseId)
.map(t => t.useCaseId)
);
// Get category breakdown
const categoryBreakdown = curatedUseCases.reduce<Record<string, { total: number; tested: number }>>((acc, uc) => {
if (!acc[uc.category]) {
acc[uc.category] = { total: 0, tested: 0 };
}
acc[uc.category].total++;
if (testedUseCaseIds.has(uc.id)) {
acc[uc.category].tested++;
}
return acc;
}, {});
return (
<div className="container max-w-6xl mx-auto py-8 px-4">
<div className="mb-8">
<h1 className="text-3xl font-bold mb-2 flex items-center gap-3">
<Map className="h-8 w-8" />
My Model Map
</h1>
<p className="text-muted-foreground">
Your personalized AI strategy guide. Track your models, run tests, and discover which models work best for your tasks.
</p>
</div>
{/* Quick Stats */}
<div className="grid grid-cols-1 md:grid-cols-4 gap-4 mb-8">
<Card>
<CardContent className="pt-6">
<div className="flex items-center justify-between">
<div>
<p className="text-sm text-muted-foreground">My Models</p>
<p className="text-2xl font-bold">{userModels.length}</p>
</div>
<Cpu className="h-8 w-8 text-muted-foreground" />
</div>
</CardContent>
</Card>
<Card>
<CardContent className="pt-6">
<div className="flex items-center justify-between">
<div>
<p className="text-sm text-muted-foreground">My Tools</p>
<p className="text-2xl font-bold">{userTools.length}</p>
</div>
<Target className="h-8 w-8 text-muted-foreground" />
</div>
</CardContent>
</Card>
<Card>
<CardContent className="pt-6">
<div className="flex items-center justify-between">
<div>
<p className="text-sm text-muted-foreground">Tests Run</p>
<p className="text-2xl font-bold">{tests.length}</p>
</div>
<Beaker className="h-8 w-8 text-muted-foreground" />
</div>
</CardContent>
</Card>
<Card>
<CardContent className="pt-6">
<div className="flex items-center justify-between">
<div>
<p className="text-sm text-muted-foreground">Use Cases</p>
<p className="text-2xl font-bold">{totalUseCases}</p>
</div>
<BookOpen className="h-8 w-8 text-muted-foreground" />
</div>
</CardContent>
</Card>
</div>
{/* Main Content Grid */}
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
{/* Progress & Journey */}
<div className="lg:col-span-2 space-y-6">
{/* Journey Progress */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<TrendingUp className="h-5 w-5" />
Your Model Map Journey
</CardTitle>
<CardDescription>
Complete curated use cases to build your personalized model recommendations
</CardDescription>
</CardHeader>
<CardContent className="space-y-4">
<div className="space-y-2">
<div className="flex justify-between text-sm">
<span className="text-muted-foreground">Overall Progress</span>
<span className="font-medium">{Math.round(progressPercent)}%</span>
</div>
<Progress value={progressPercent} className="h-3" />
</div>
{/* Category Progress */}
<div className="grid grid-cols-2 md:grid-cols-3 gap-3 pt-4">
{Object.entries(categoryBreakdown).map(([category, data]) => (
<div key={category} className="space-y-1">
<div className="flex items-center gap-2">
<div className={`w-2 h-2 rounded-full ${categoryColors[category] || categoryColors["Other"]}`} />
<span className="text-xs font-medium truncate">{category}</span>
</div>
<div className="text-xs text-muted-foreground">
{data.tested} / {data.total} tested
</div>
</div>
))}
</div>
</CardContent>
</Card>
{/* Quick Actions */}
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<Card className="hover:border-primary/50 transition-colors">
<CardHeader className="pb-2">
<CardTitle className="text-lg flex items-center gap-2">
<Beaker className="h-5 w-5" />
Test Lab
</CardTitle>
<CardDescription>
Run prompts against multiple models and compare results
</CardDescription>
</CardHeader>
<CardContent>
<Link href="/model-map/test-lab">
<Button className="w-full" variant="outline">
Open Test Lab
<ArrowRight className="h-4 w-4 ml-2" />
</Button>
</Link>
</CardContent>
</Card>
<Card className="hover:border-primary/50 transition-colors">
<CardHeader className="pb-2">
<CardTitle className="text-lg flex items-center gap-2">
<BookOpen className="h-5 w-5" />
Use Cases
</CardTitle>
<CardDescription>
Browse curated prompts to test model capabilities
</CardDescription>
</CardHeader>
<CardContent>
<Link href="/model-map/use-cases">
<Button className="w-full" variant="outline">
Explore Use Cases
<ArrowRight className="h-4 w-4 ml-2" />
</Button>
</Link>
</CardContent>
</Card>
</div>
{/* Recent Tests */}
{tests.length > 0 && (
<Card>
<CardHeader>
<CardTitle>Recent Tests</CardTitle>
</CardHeader>
<CardContent>
<div className="space-y-3">
{tests.slice(0, 3).map((test) => (
<div
key={test.id}
className="flex items-center justify-between p-3 rounded-lg border"
>
<div>
<p className="font-medium">{test.title}</p>
<p className="text-sm text-muted-foreground">
{new Date(test.createdAt).toLocaleDateString()}
</p>
</div>
<Badge variant="outline">{test.status}</Badge>
</div>
))}
</div>
<Link href="/model-map/test-lab">
<Button variant="ghost" className="w-full mt-4">
View All Tests
<ArrowRight className="h-4 w-4 ml-2" />
</Button>
</Link>
</CardContent>
</Card>
)}
</div>
{/* Sidebar */}
<div className="space-y-6">
{/* Recommendations */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Trophy className="h-5 w-5 text-amber-500" />
Top Picks by Category
</CardTitle>
<CardDescription>
Based on your test results
</CardDescription>
</CardHeader>
<CardContent>
{recommendations.length === 0 ? (
<div className="text-center py-4">
<p className="text-sm text-muted-foreground mb-4">
Run tests to see your personalized recommendations
</p>
<Link href="/model-map/use-cases">
<Button size="sm">Start Testing</Button>
</Link>
</div>
) : (
<div className="space-y-3">
{recommendations.map((rec) => (
<div key={rec.id} className="flex items-center gap-3">
<div className={`w-1 h-10 rounded-full ${categoryColors[rec.category] || categoryColors["Other"]}`} />
<div className="flex-1 min-w-0">
<p className="text-sm font-medium truncate">{rec.category}</p>
<p className="text-xs text-muted-foreground">{rec.model?.name}</p>
</div>
<div className="flex items-center gap-1">
<Star className="h-3 w-3 text-amber-500 fill-amber-500" />
<span className="text-sm font-medium">{rec.avgRating}</span>
</div>
</div>
))}
</div>
)}
</CardContent>
</Card>
{/* My Models Preview */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Cpu className="h-5 w-5" />
My Models
</CardTitle>
</CardHeader>
<CardContent>
{userModels.length === 0 ? (
<div className="text-center py-4">
<p className="text-sm text-muted-foreground mb-4">
Add models to your toolkit
</p>
<Link href="/model-map/my-models">
<Button size="sm">Add Models</Button>
</Link>
</div>
) : (
<>
<div className="flex flex-wrap gap-2 mb-4">
{userModels.slice(0, 5).map((um) => (
<Badge key={um.id} variant="secondary">
{um.model.name}
</Badge>
))}
{userModels.length > 5 && (
<Badge variant="outline">+{userModels.length - 5} more</Badge>
)}
</div>
<Link href="/model-map/my-models">
<Button variant="ghost" size="sm" className="w-full">
Manage Models
<ArrowRight className="h-4 w-4 ml-2" />
</Button>
</Link>
</>
)}
</CardContent>
</Card>
{/* Getting Started */}
{tests.length === 0 && (
<Card className="bg-gradient-to-br from-primary/5 to-primary/10 border-primary/20">
<CardHeader>
<CardTitle className="text-lg">Getting Started</CardTitle>
</CardHeader>
<CardContent className="space-y-3">
<div className="flex items-start gap-3">
<div className="w-6 h-6 rounded-full bg-primary/20 flex items-center justify-center text-xs font-bold">
1
</div>
<div>
<p className="font-medium text-sm">Add your models</p>
<p className="text-xs text-muted-foreground">
Select the AI models you want to test
</p>
</div>
</div>
<div className="flex items-start gap-3">
<div className="w-6 h-6 rounded-full bg-primary/20 flex items-center justify-center text-xs font-bold">
2
</div>
<div>
<p className="font-medium text-sm">Pick a use case</p>
<p className="text-xs text-muted-foreground">
Browse curated prompts by category
</p>
</div>
</div>
<div className="flex items-start gap-3">
<div className="w-6 h-6 rounded-full bg-primary/20 flex items-center justify-center text-xs font-bold">
3
</div>
<div>
<p className="font-medium text-sm">Run & compare</p>
<p className="text-xs text-muted-foreground">
Test and rate results to build your map
</p>
</div>
</div>
</CardContent>
</Card>
)}
</div>
</div>
</div>
);
}
|