[dyad] Added headline extraction and display - wrote 4 file(s)
This commit is contained in:
51
src/components/headlines-display.tsx
Normal file
51
src/components/headlines-display.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
|
||||
interface HeadlinesDisplayProps {
|
||||
headlines: {
|
||||
tag: string;
|
||||
text: string;
|
||||
length: number;
|
||||
}[];
|
||||
}
|
||||
|
||||
export function HeadlinesDisplay({ headlines }: HeadlinesDisplayProps) {
|
||||
return (
|
||||
<div>
|
||||
<h3 className="font-semibold text-card-foreground mb-2">Headlines</h3>
|
||||
<div className="border rounded-lg max-h-80 overflow-y-auto relative">
|
||||
<Table>
|
||||
<TableHeader className="sticky top-0 bg-muted/95 backdrop-blur-sm">
|
||||
<TableRow>
|
||||
<TableHead className="w-[80px]">Tag</TableHead>
|
||||
<TableHead>Text</TableHead>
|
||||
<TableHead className="text-right w-[100px]">Length</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{headlines.map((headline, index) => (
|
||||
<TableRow key={index}>
|
||||
<TableCell>
|
||||
<Badge variant="secondary" className="uppercase">
|
||||
{headline.tag}
|
||||
</Badge>
|
||||
</TableCell>
|
||||
<TableCell className="font-medium">{headline.text}</TableCell>
|
||||
<TableCell className="text-right">{headline.length}</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -12,12 +12,14 @@ import { CopyButton } from "./copy-button";
|
||||
import { SerpPreview } from "./serp-preview";
|
||||
import { ResultsSkeleton } from "./results-skeleton";
|
||||
import { FaqDisplay } from "./faq-display";
|
||||
import { HeadlinesDisplay } from "./headlines-display";
|
||||
|
||||
interface MetaData {
|
||||
title: string;
|
||||
description: string;
|
||||
image?: string | null;
|
||||
faq?: { question: string; answer: string }[] | null;
|
||||
headlines?: { tag: string; text: string; length: number }[] | null;
|
||||
}
|
||||
|
||||
export function MetaForm() {
|
||||
@@ -161,7 +163,7 @@ export function MetaForm() {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
{metaData.faq && metaData.faq.length > 0 && (
|
||||
<FaqDisplay faqs={metaData.faq} />
|
||||
)}
|
||||
@@ -271,6 +273,9 @@ export function MetaForm() {
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
{metaData.headlines && metaData.headlines.length > 0 && (
|
||||
<HeadlinesDisplay headlines={metaData.headlines} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
|
||||
@@ -63,6 +63,15 @@ export function ResultsSkeleton() {
|
||||
<Skeleton className="h-4 w-full mb-2" />
|
||||
<Skeleton className="h-24 w-full" />
|
||||
</div>
|
||||
<div>
|
||||
<Skeleton className="h-5 w-24 mb-2" />
|
||||
<div className="border rounded-lg p-2 space-y-2">
|
||||
<Skeleton className="h-8 w-full" />
|
||||
<Skeleton className="h-8 w-full" />
|
||||
<Skeleton className="h-8 w-full" />
|
||||
<Skeleton className="h-8 w-full" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
|
||||
Reference in New Issue
Block a user