refactor: remove UseCasesSection from collection pages

Scenarios now replace use cases as the primary way to demonstrate
collection capabilities. Removes unused state and callback handlers.
This commit is contained in:
Ajax Davis 2026-01-25 04:13:59 +10:00
parent 9f0d7a2b17
commit 9995d73052
2 changed files with 2 additions and 62 deletions

View file

@ -5,7 +5,7 @@ import { Button } from '@tpmjs/ui/Button/Button';
import { CodeBlock } from '@tpmjs/ui/CodeBlock/CodeBlock'; import { CodeBlock } from '@tpmjs/ui/CodeBlock/CodeBlock';
import { Icon } from '@tpmjs/ui/Icon/Icon'; import { Icon } from '@tpmjs/ui/Icon/Icon';
import Link from 'next/link'; import Link from 'next/link';
import { useCallback, useState } from 'react'; import { useState } from 'react';
import { AppHeader } from '~/components/AppHeader'; import { AppHeader } from '~/components/AppHeader';
import { ForkButton } from '~/components/ForkButton'; import { ForkButton } from '~/components/ForkButton';
import { ForkedFromBadge } from '~/components/ForkedFromBadge'; import { ForkedFromBadge } from '~/components/ForkedFromBadge';
@ -13,7 +13,6 @@ import { LikeButton } from '~/components/LikeButton';
import { ScenariosSection } from '~/components/ScenariosSection'; import { ScenariosSection } from '~/components/ScenariosSection';
import { ShareButton } from '~/components/ShareButton'; import { ShareButton } from '~/components/ShareButton';
import { SkillsSection } from '~/components/skills/SkillsSection'; import { SkillsSection } from '~/components/skills/SkillsSection';
import { UseCasesSection } from '~/components/UseCasesSection';
import { useSession } from '~/lib/auth-client'; import { useSession } from '~/lib/auth-client';
export interface CollectionTool { export interface CollectionTool {
@ -33,20 +32,6 @@ export interface CollectionTool {
}; };
} }
export interface UseCaseToolStep {
toolName: string;
packageName: string;
purpose: string;
order: number;
}
export interface UseCase {
id: string;
userPrompt: string;
description: string;
toolSequence: UseCaseToolStep[];
}
export interface PublicCollection { export interface PublicCollection {
id: string; id: string;
slug: string; // Already coerced to empty string if null in server component slug: string; // Already coerced to empty string if null in server component
@ -72,8 +57,6 @@ export interface PublicCollection {
username: string; username: string;
}; };
} | null; } | null;
useCases: UseCase[] | null;
useCasesGeneratedAt: string | null;
} }
function McpUrlSection({ function McpUrlSection({
@ -257,28 +240,12 @@ interface CollectionDetailClientProps {
username: string; username: string;
} }
export function CollectionDetailClient({ export function CollectionDetailClient({ collection, username }: CollectionDetailClientProps) {
collection: initialCollection,
username,
}: CollectionDetailClientProps) {
const { data: session } = useSession(); const { data: session } = useSession();
const [collection, setCollection] = useState(initialCollection);
// Check if current user is the owner // Check if current user is the owner
const isOwner = session?.user?.id && collection.createdBy?.id === session.user.id; const isOwner = session?.user?.id && collection.createdBy?.id === session.user.id;
// Handler for when use cases are generated
const handleUseCasesGenerated = useCallback(
(useCases: UseCase[], generatedAt: string) => {
setCollection({
...collection,
useCases,
useCasesGeneratedAt: generatedAt,
});
},
[collection]
);
// Generate tweet text // Generate tweet text
const tweetText = collection.description const tweetText = collection.description
? `${collection.name} - ${collection.description.slice(0, 100)}${collection.description.length > 100 ? '...' : ''}` ? `${collection.name} - ${collection.description.slice(0, 100)}${collection.description.length > 100 ? '...' : ''}`
@ -394,16 +361,6 @@ export function CollectionDetailClient({
</div> </div>
)} )}
{/* Use Cases Section */}
{collection.tools.length > 0 && (
<UseCasesSection
collectionId={collection.id}
useCases={collection.useCases}
generatedAt={collection.useCasesGeneratedAt}
onUseCasesGenerated={handleUseCasesGenerated}
/>
)}
{/* Scenarios Section */} {/* Scenarios Section */}
{collection.tools.length > 0 && ( {collection.tools.length > 0 && (
<ScenariosSection <ScenariosSection

View file

@ -60,21 +60,6 @@ async function getCollection(username: string, slug: string): Promise<PublicColl
return null; return null;
} }
// Parse useCases from Json field
const useCases = collection.useCases as
| {
id: string;
userPrompt: string;
description: string;
toolSequence: {
toolName: string;
packageName: string;
purpose: string;
order: number;
}[];
}[]
| null;
return { return {
id: collection.id, id: collection.id,
slug: collection.slug || '', slug: collection.slug || '',
@ -117,8 +102,6 @@ async function getCollection(username: string, slug: string): Promise<PublicColl
}, },
} }
: null, : null,
useCases: useCases ?? null,
useCasesGeneratedAt: collection.useCasesGeneratedAt?.toISOString() ?? null,
}; };
} }