[dyad] Improved UI and added skeleton loader - wrote 4 file(s)

This commit is contained in:
[dyad]
2026-01-20 12:13:06 +01:00
parent 4163372a17
commit 0d5065da81
4 changed files with 76 additions and 136 deletions

View File

@@ -8,6 +8,7 @@ import { Globe } from "lucide-react";
import { extractMetaData } from "@/app/actions";
import { LengthIndicator } from "./length-indicator";
import { CopyButton } from "./copy-button";
import { ResultsSkeleton } from "./results-skeleton";
interface MetaData {
title: string;
@@ -59,21 +60,23 @@ export function MetaForm() {
<Button
type="submit"
disabled={loading}
className="w-full sm:w-auto h-12 px-8 rounded-lg font-semibold transition-all"
className="w-full sm:w-auto h-12 px-8 rounded-lg font-semibold transition-all hover:scale-105 active:scale-100"
>
{loading ? "Extracting..." : "Extract"}
</Button>
</form>
{error && (
{loading && <ResultsSkeleton />}
{error && !loading && (
<Card className="border-destructive bg-destructive/10">
<CardContent className="p-4">
<p className="text-destructive text-center">{error}</p>
<p className="text-destructive text-center font-medium">{error}</p>
</CardContent>
</Card>
)}
{metaData && (
{metaData && !loading && (
<Card className="w-full shadow-lg rounded-lg">
<CardHeader>
<CardTitle className="text-xl text-card-foreground">

View File

@@ -0,0 +1,30 @@
import { Card, CardContent, CardHeader } from "@/components/ui/card";
import { Skeleton } from "@/components/ui/skeleton";
export function ResultsSkeleton() {
return (
<Card className="w-full shadow-lg rounded-lg">
<CardHeader>
<Skeleton className="h-6 w-48" />
</CardHeader>
<CardContent className="space-y-6">
<div>
<Skeleton className="h-5 w-32 mb-2" />
<Skeleton className="aspect-video w-full rounded-md" />
</div>
<div>
<div className="flex items-center justify-between mb-1">
<Skeleton className="h-5 w-24" />
</div>
<Skeleton className="h-12 w-full" />
</div>
<div>
<div className="flex items-center justify-between mb-1">
<Skeleton className="h-5 w-36" />
</div>
<Skeleton className="h-20 w-full" />
</div>
</CardContent>
</Card>
);
}