Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions docs/app/[lang]/worlds/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ export default async function WorldsPage() {
<div className="flex items-center gap-3 text-xs text-muted-foreground uppercase tracking-wider">
<div className="w-16" />
<div className="flex-1" />
<div className="w-14 text-right text-gray-1000 font-medium font-mono">
Perf
</div>
</div>

{/* Benchmark bars */}
Expand Down
83 changes: 2 additions & 81 deletions docs/components/worlds/WorldCard.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
'use client';

import {
AlertCircle,
CheckCircle2,
Clock,
ExternalLinkIcon,
XCircle,
} from 'lucide-react';
import { ExternalLinkIcon } from 'lucide-react';
import Link from 'next/link';
import { Badge } from '@/components/ui/badge';
import {
Expand All @@ -16,62 +10,21 @@ import {
CardHeader,
CardTitle,
} from '@/components/ui/card';
import { Progress } from '@/components/ui/progress';
import { cn } from '@/lib/utils';
import type { World } from './types';

interface WorldCardProps {
id: string;
world: World;
}

const statusConfig = {
passing: {
label: 'Passing',
icon: CheckCircle2,
variant: 'default' as const,
className: 'bg-green-500/10 text-green-600 border-green-500/20',
},
partial: {
label: 'Partial',
icon: AlertCircle,
variant: 'secondary' as const,
className: 'bg-yellow-500/10 text-yellow-600 border-yellow-500/20',
},
failing: {
label: 'Failing',
icon: XCircle,
variant: 'destructive' as const,
className: 'bg-red-500/10 text-red-600 border-red-500/20',
},
pending: {
label: 'Pending',
icon: Clock,
variant: 'outline' as const,
className: 'bg-muted text-muted-foreground',
},
};

const typeEmoji = {
official: '',
community: '',
};

export function WorldCard({ id, world }: WorldCardProps) {
const e2eStatus = world.e2e?.status || 'pending';
const config = statusConfig[e2eStatus];
const StatusIcon = config.icon;

export function WorldCard({ world }: WorldCardProps) {
const isExternal = world.docs.startsWith('http');
Comment on lines 15 to 26

// Calculate E2E progress excluding skipped tests from denominator
// so pass rate reflects actual test results (not artificially lowered by skips)
const effectiveTotal = world.e2e ? world.e2e.total - world.e2e.skipped : 0;
const displayProgress =
effectiveTotal > 0 && world.e2e
? Math.round((world.e2e.passed / effectiveTotal) * 100)
: 0;

return (
<Card className="relative overflow-hidden">
<CardHeader className="pb-3">
Expand All @@ -92,45 +45,13 @@ export function WorldCard({ id, world }: WorldCardProps) {
{world.package}
</CardDescription>
</div>
<Badge className={cn('gap-1', config.className)}>
<StatusIcon className="h-3 w-3" />
{config.label}
</Badge>
</div>
</CardHeader>
<CardContent className="space-y-4">
<p className="text-sm text-muted-foreground line-clamp-2">
{world.description}
</p>

{/* E2E Progress */}
{world.e2e && (
<div className="space-y-2">
<div className="flex items-center justify-between text-sm">
<span className="text-muted-foreground">E2E Tests</span>
<span className="font-medium">
{world.e2e.passed}/{effectiveTotal} ({displayProgress}%)
</span>
</div>
<Progress
value={displayProgress}
className={cn(
'h-2',
displayProgress === 100
? '[&>div]:bg-green-500'
: displayProgress >= 75
? '[&>div]:bg-yellow-500'
: '[&>div]:bg-red-500'
)}
/>
{world.e2e.failed > 0 && (
<p className="text-xs text-muted-foreground">
{world.e2e.failed} failing, {world.e2e.skipped} skipped
</p>
)}
</div>
)}

{/* Links */}
<div className="flex items-center gap-2 pt-2">
<Link
Expand Down
52 changes: 1 addition & 51 deletions docs/components/worlds/WorldCardSimple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
CardHeader,
CardTitle,
} from '@/components/ui/card';
import { Gauge } from '@/components/ui/gauge';
import {
Tooltip,
TooltipContent,
Expand All @@ -24,24 +23,6 @@ interface WorldCardSimpleProps {
}

export function WorldCardSimple({ id, world }: WorldCardSimpleProps) {
// Use nextjs-turbopack data for scoring if available, otherwise fall back to total
const turbopackData = world.e2e?.nextjsTurbopack;

// Calculate E2E progress based on nextjs-turbopack data (canonical scoring)
// For framework data: passed + failed = tests that ran (excludes skipped)
// If failed === 0, that's 100% passing
const effectiveFailed = turbopackData
? turbopackData.failed
: (world.e2e?.failed ?? 0);
const effectivePassed = turbopackData
? turbopackData.passed
: (world.e2e?.passed ?? 0);
const effectiveTotal = effectivePassed + effectiveFailed;
const displayProgress =
effectiveTotal > 0
? Math.round((effectivePassed / effectiveTotal) * 100)
: 0;

return (
<Link href={`/worlds/${id}`} className="block group">
<Card className="h-full transition-colors cursor-pointer overflow-hidden py-0! gap-2">
Expand Down Expand Up @@ -72,38 +53,7 @@ export function WorldCardSimple({ id, world }: WorldCardSimpleProps) {
{world.description}
</p>
</CardContent>
{/* Stats footer */}
<div className="flex items-center justify-between px-4 pb-4 pt-2">
{/* E2E with gauge */}
<Tooltip>
<TooltipTrigger asChild>
<div className="flex items-center gap-2 text-sm">
<Gauge
value={world.e2e ? displayProgress : 0}
size="tiny"
colors={
!world.e2e
? { primary: 'var(--ds-gray-alpha-400)' }
: displayProgress >= 75
? { primary: 'var(--ds-green-700)' }
: displayProgress >= 50
? { primary: 'var(--ds-amber-700)' }
: { primary: 'var(--ds-red-700)' }
}
/>
<span className="font-normal text-gray-1000">
E2E:{` `}
<span className="font-mono font-normal">
{world.e2e ? `${displayProgress}%` : '—'}
</span>
</span>
</div>
</TooltipTrigger>
<TooltipContent side="bottom" className="max-w-[200px]">
<p className="text-xs">E2E Test Suite Coverage</p>
</TooltipContent>
</Tooltip>
{/* Encryption badge */}
<div className="flex min-h-8 items-center justify-end px-4 pb-4 pt-2">
{world.features.includes('encryption') && (
<Tooltip>
<TooltipTrigger asChild>
Expand Down
110 changes: 0 additions & 110 deletions docs/components/worlds/WorldDetailHero.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
'use client';

import {
AlertCircle,
BadgeCheck,
CheckCircle2,
CheckIcon,
ChevronRight,
Clock,
Code,
CopyIcon,
ExternalLink,
Github,
HeartHandshake,
Package,
ShieldCheck,
Timer,
XCircle,
} from 'lucide-react';
import Link from 'next/link';
import { useState } from 'react';
Expand All @@ -42,29 +37,6 @@ interface WorldDetailHeroProps {
world: World;
}

const statusConfig = {
passing: {
label: 'Passing',
icon: CheckCircle2,
className: 'text-green-900',
},
partial: {
label: 'Partial',
icon: AlertCircle,
className: 'text-amber-900',
},
failing: {
label: 'Failing',
icon: XCircle,
className: 'text-red-900',
},
pending: {
label: 'Pending',
icon: Clock,
className: 'text-muted-foreground',
},
};

export function WorldDetailHero({ id, world }: WorldDetailHeroProps) {
const [copied, setCopied] = useState(false);

Expand All @@ -88,25 +60,6 @@ export function WorldDetailHero({ id, world }: WorldDetailHeroProps) {

const CopyButtonIcon = copied ? CheckIcon : CopyIcon;

// E2E test calculations
const e2e = world.e2e;
const turbopackData = e2e?.nextjsTurbopack;
const scoringPassed = turbopackData
? turbopackData.passed
: (e2e?.passed ?? 0);
const scoringFailed = turbopackData
? turbopackData.failed
: (e2e?.failed ?? 0);
const testsRan = scoringPassed + scoringFailed;
const status = e2e?.status ?? 'pending';
const StatusIcon = statusConfig[status].icon;

// Benchmark calculations
const benchmark = world.benchmark;
const benchmarkCount = benchmark?.metrics
? Object.keys(benchmark.metrics).length
: 0;

// GitHub source URL for official worlds
const githubUrl =
world.repository ||
Expand Down Expand Up @@ -206,69 +159,6 @@ export function WorldDetailHero({ id, world }: WorldDetailHeroProps) {

{/* Right side - Quick links */}
<div className="space-y-2 text-sm">
{/* E2E Tests */}
<Tooltip>
<TooltipTrigger asChild>
<a
href="#testing"
className="flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors"
>
<StatusIcon
className={`h-4 w-4 shrink-0 ${statusConfig[status].className}`}
/>
<span>
{e2e ? (
<>
<span className="text-foreground">
{scoringPassed}/{testsRan}
</span>{' '}
tests passing
</>
) : (
'Tests pending'
)}
</span>
</a>
</TooltipTrigger>
<TooltipContent side="top" align="start" className="max-w-[200px]">
<p className="text-xs">E2E Test Suite Coverage</p>
</TooltipContent>
</Tooltip>

{/* Benchmarks - show PERF time as summary */}
<Tooltip>
<TooltipTrigger asChild>
<a
href="#testing"
className="flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors"
>
<Timer
className={`h-4 w-4 shrink-0 ${world.benchmark10SeqMs !== null ? 'text-purple-900' : ''}`}
/>
<span>
{world.benchmark10SeqMs !== null ? (
<>
PERF:{' '}
<span className="text-foreground">
{(world.benchmark10SeqMs / 1000).toFixed(2)}s
</span>
</>
) : benchmarkCount > 0 ? (
`${benchmarkCount} benchmarks`
) : (
'Benchmarks pending'
)}
</span>
</a>
</TooltipTrigger>
<TooltipContent side="top" align="start" className="max-w-[260px]">
<p className="text-xs">
Avg time to run a 10 step workflow where each step sleeps 1
second
</p>
</TooltipContent>
</Tooltip>

{/* NPM Package */}
<a
href={`https://www.npmjs.com/package/${world.package}`}
Expand Down
Loading
Loading