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 { Icon } from '@tpmjs/ui/Icon/Icon';
import Link from 'next/link';
import { useCallback, useState } from 'react';
import { useState } from 'react';
import { AppHeader } from '~/components/AppHeader';
import { ForkButton } from '~/components/ForkButton';
import { ForkedFromBadge } from '~/components/ForkedFromBadge';
@ -13,7 +13,6 @@ import { LikeButton } from '~/components/LikeButton';
import { ScenariosSection } from '~/components/ScenariosSection';
import { ShareButton } from '~/components/ShareButton';
import { SkillsSection } from '~/components/skills/SkillsSection';
import { UseCasesSection } from '~/components/UseCasesSection';
import { useSession } from '~/lib/auth-client';
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 {
id: string;
slug: string; // Already coerced to empty string if null in server component
@ -72,8 +57,6 @@ export interface PublicCollection {
username: string;
};
} | null;
useCases: UseCase[] | null;
useCasesGeneratedAt: string | null;
}
function McpUrlSection({
@ -257,28 +240,12 @@ interface CollectionDetailClientProps {
username: string;
}
export function CollectionDetailClient({
collection: initialCollection,
username,
}: CollectionDetailClientProps) {
export function CollectionDetailClient({ collection, username }: CollectionDetailClientProps) {
const { data: session } = useSession();
const [collection, setCollection] = useState(initialCollection);
// Check if current user is the owner
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
const tweetText = collection.description
? `${collection.name} - ${collection.description.slice(0, 100)}${collection.description.length > 100 ? '...' : ''}`
@ -394,16 +361,6 @@ export function CollectionDetailClient({
</div>
)}
{/* Use Cases Section */}
{collection.tools.length > 0 && (
<UseCasesSection
collectionId={collection.id}
useCases={collection.useCases}
generatedAt={collection.useCasesGeneratedAt}
onUseCasesGenerated={handleUseCasesGenerated}
/>
)}
{/* Scenarios Section */}
{collection.tools.length > 0 && (
<ScenariosSection

View file

@ -60,21 +60,6 @@ async function getCollection(username: string, slug: string): Promise<PublicColl
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 {
id: collection.id,
slug: collection.slug || '',
@ -117,8 +102,6 @@ async function getCollection(username: string, slug: string): Promise<PublicColl
},
}
: null,
useCases: useCases ?? null,
useCasesGeneratedAt: collection.useCasesGeneratedAt?.toISOString() ?? null,
};
}