fix(tool-page): eliminate excessive whitespace and optimize layout density

This commit is contained in:
2026-11-11 12:41:09 +05:30
parent f7486162c6
commit bfaaa90f17
2 changed files with 159 additions and 147 deletions
+70 -65
View File
@@ -358,18 +358,18 @@ export function DynamicToolWorkspace({
</div>
{/* Studio Workspace Canvas */}
<div className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 pt-8 space-y-8">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 pt-5 space-y-5">
{/* Error Banner */}
{errorMessage && (
<div className="p-4 rounded-2xl bg-red-500/10 border border-red-500/20 text-red-600 text-xs font-body flex items-center gap-2">
<div className="p-3.5 rounded-xl bg-red-500/10 border border-red-500/20 text-red-600 text-xs font-sans flex items-center gap-2">
<AlertCircle className="w-4 h-4 shrink-0" />
<span>{errorMessage}</span>
</div>
)}
{/* Archetype Studio Layout */}
<div className="studio-sheet p-6 sm:p-8 rounded-3xl bg-paper-hi border border-rule shadow-sheet space-y-6">
<div className="studio-sheet p-5 sm:p-6 rounded-2xl bg-paper-hi border border-rule shadow-sheet space-y-5">
{/* POST-EDIT RESULT COMPARISON VIEW (If inference succeeded) */}
{status === 'success' && resultUrl ? (
@@ -716,62 +716,67 @@ export function DynamicToolWorkspace({
<div className="min-h-screen bg-paper">
{/* ================= HERO SECTION ================= */}
<section className="relative pt-24 sm:pt-28 pb-16 sm:pb-20 bg-paper border-b border-rule overflow-hidden">
<section className="relative pt-6 sm:pt-8 pb-10 sm:pb-12 bg-paper border-b border-rule overflow-hidden">
{/* Ambient Radial Spotlight */}
<div
className="pointer-events-none absolute top-0 left-1/2 -translate-x-1/2 w-[800px] h-[450px] [background:radial-gradient(ellipse_at_top,color-mix(in_oklab,var(--color-accent)_10%,transparent)_0%,transparent_70%)]"
className="pointer-events-none absolute top-0 left-1/2 -translate-x-1/2 w-[800px] h-[350px] [background:radial-gradient(ellipse_at_top,color-mix(in_oklab,var(--color-accent)_10%,transparent)_0%,transparent_70%)]"
aria-hidden="true"
/>
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 relative z-10">
{/* Breadcrumb row */}
<div className="flex items-center gap-2 text-xs font-body text-muted mb-6">
<Link href="/" className="hover:text-ink hover:underline">Home</Link>
<div className="flex items-center gap-2 text-xs font-sans text-slate-500 mb-3">
<Link href="/" className="hover:text-slate-900 hover:underline">Home</Link>
<span>/</span>
<Link href="/tools" className="hover:text-ink hover:underline">Tools</Link>
<Link href="/tools" className="hover:text-slate-900 hover:underline">Tools</Link>
<span>/</span>
<span className="text-accent font-semibold">{toolName}</span>
</div>
{/* Header Title & Summary */}
<div className="max-w-3xl mb-12 space-y-3">
<div className="inline-flex items-center gap-2 px-3.5 py-1 rounded-full bg-paper-hi border border-rule text-xs font-body text-ink shadow-xs">
<Sparkles className="w-3.5 h-3.5 text-accent" />
<span>Studio Vision Model</span>
<div className="max-w-5xl mb-6 sm:mb-8 space-y-2">
<div className="flex flex-wrap items-center gap-2 text-xs font-sans">
<div className="inline-flex items-center gap-1.5 px-3 py-0.5 rounded-full bg-paper-hi border border-rule text-slate-800 shadow-2xs font-medium">
<Sparkles className="w-3.5 h-3.5 text-accent" />
<span>Studio Vision Model</span>
</div>
<span className="px-2.5 py-0.5 rounded-full bg-emerald-500/10 border border-emerald-500/20 text-emerald-700 font-medium text-[11px]">
Volatile GPU RAM · Zero server retention
</span>
</div>
<h1 className="text-3xl sm:text-5xl font-display font-extrabold text-ink tracking-tight">
<h1 className="text-2xl sm:text-4xl font-display font-extrabold text-ink tracking-tight">
<AnimatedShinyText>{toolName}</AnimatedShinyText>
</h1>
<p className="text-base sm:text-lg text-ink-2 font-body max-w-2xl leading-relaxed">
<p className="text-sm sm:text-base text-ink-2 font-sans max-w-4xl leading-relaxed">
{toolSummary}
</p>
</div>
{/* Studio Workspace: Upload Box on Left, Specimen on Right */}
<div className="grid grid-cols-1 lg:grid-cols-12 gap-8 items-start">
<div className="grid grid-cols-1 lg:grid-cols-12 gap-6 lg:gap-8 items-start">
{/* Upload Box: Configured Dynamically by pageType */}
<div id="studio-upload-box" className="lg:col-span-6 bg-paper-hi border border-rule rounded-card p-6 sm:p-8 shadow-sheet relative overflow-hidden">
<div id="studio-upload-box" className="lg:col-span-6 bg-paper-hi border border-rule rounded-2xl p-5 sm:p-6 shadow-sheet relative overflow-hidden">
<BorderBeam size={120} duration={10} borderWidth={1.5} colorFrom="var(--color-accent)" colorTo="var(--color-accent-hi)" />
<div className="border-b border-rule pb-3.5 mb-6 flex items-center justify-between">
<span className="studio-label font-semibold text-ink">
<div className="border-b border-rule pb-2.5 mb-4 flex items-center justify-between">
<span className="text-xs font-bold font-sans text-slate-900">
{pageType === 'text-to-image' ? 'Text prompt studio' : 'Interactive tool studio'}
</span>
<span className="text-xs text-muted font-body">Zero server retention</span>
<span className="text-[11px] text-slate-500 font-sans">Zero server retention</span>
</div>
{/* Dynamic Upload Input by Type */}
<div className="space-y-5">
<div className="space-y-4">
{/* Style Thumbnail Selector on Landing Card (Before-Upload / Both) */}
{tool.thumbnails && tool.thumbnails.length > 0 && tool.thumbnailPlacement !== 'after-upload' && (
<div className="space-y-2 pb-2 border-b border-rule/60">
<div className="flex items-center justify-between text-xs">
<span className="font-semibold text-ink font-body">1. Select Effect Style</span>
<div className="flex items-center justify-between text-xs font-sans">
<span className="font-semibold text-slate-900">1. Select Effect Style</span>
{selectedThumbnail && (
<span className="text-accent font-semibold font-body">
<span className="text-accent font-semibold">
{resolveLocalised(selectedThumbnail.label, locale)}
</span>
)}
@@ -784,10 +789,10 @@ export function DynamicToolWorkspace({
key={t.id}
type="button"
onClick={() => setSelectedThumbnail(t)}
className={`shrink-0 flex items-center gap-2 px-3 py-1.5 rounded-xl border text-xs font-body font-semibold transition-all cursor-pointer ${
className={`shrink-0 flex items-center gap-2 px-3 py-1.5 rounded-xl border text-xs font-sans font-semibold transition-all cursor-pointer ${
isSelected
? 'bg-accent/10 border-accent text-accent shadow-xs'
: 'bg-paper border-rule text-ink-2 hover:border-rule-2'
: 'bg-paper border-rule text-slate-800 hover:border-rule-2'
}`}
>
{(t.thumbnail || t.preview) && (
@@ -804,7 +809,7 @@ export function DynamicToolWorkspace({
{/* Type 1, 2, 3: Single Drag & Drop Dropzone with Prominent Buttons Below */}
{pageType !== 'text-to-image' && pageType !== 'two-images' && (
<div className="space-y-4">
<div className="space-y-3.5">
<div
onDragOver={(e) => e.preventDefault()}
onDrop={(e) => {
@@ -812,7 +817,7 @@ export function DynamicToolWorkspace({
if (e.dataTransfer.files?.[0]) handlePrimaryFileSelect(e.dataTransfer.files[0]);
}}
onClick={() => fileInputRef.current?.click()}
className="border-2 border-dashed border-rule hover:border-accent rounded-3xl p-7 sm:p-9 text-center bg-paper/60 hover:bg-accent/5 transition-all cursor-pointer group"
className="border-2 border-dashed border-rule hover:border-accent rounded-2xl p-5 sm:p-6 text-center bg-paper/60 hover:bg-accent/5 transition-all cursor-pointer group"
>
<input
ref={fileInputRef}
@@ -824,24 +829,24 @@ export function DynamicToolWorkspace({
}}
/>
<div className="w-16 h-16 rounded-2xl bg-paper-hi border border-rule flex items-center justify-center text-accent mx-auto mb-3.5 group-hover:scale-110 group-hover:border-accent transition-transform shadow-xs">
<UploadCloud className="w-8 h-8" />
<div className="w-12 h-12 rounded-xl bg-paper-hi border border-rule flex items-center justify-center text-accent mx-auto mb-2.5 group-hover:scale-110 group-hover:border-accent transition-transform shadow-xs">
<UploadCloud className="w-6 h-6" />
</div>
<h4 className="text-base sm:text-lg font-display font-bold text-ink">
<h4 className="text-sm sm:text-base font-display font-bold text-ink">
Drag and drop your image here
</h4>
<p className="text-xs text-muted font-body mt-1 max-w-xs mx-auto">
<p className="text-xs text-muted font-sans mt-0.5 max-w-xs mx-auto">
Supports JPG, PNG, WebP up to 12MB. Zero server retention.
</p>
</div>
{/* PROMINENT ACTION BUTTONS DIRECTLY BELOW PHOTO UPLOAD */}
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1">
<div className="grid grid-cols-1 sm:grid-cols-2 gap-2.5 pt-1">
<button
type="button"
onClick={() => fileInputRef.current?.click()}
className="w-full inline-flex items-center justify-center gap-2.5 px-6 py-4 rounded-2xl bg-accent hover:bg-accent-hi text-white font-display font-bold text-sm shadow-md hover:shadow-lg hover:scale-[1.01] active:scale-98 transition-all cursor-pointer group"
className="w-full inline-flex items-center justify-center gap-2 px-5 py-3 rounded-xl bg-accent hover:bg-accent-hi text-white font-display font-bold text-xs sm:text-sm shadow-md hover:shadow-lg hover:scale-[1.01] active:scale-98 transition-all cursor-pointer group"
>
<FolderOpen className="w-4 h-4 text-white group-hover:scale-110 transition-transform" />
<span>Select Photo to Upload</span>
@@ -851,7 +856,7 @@ export function DynamicToolWorkspace({
<button
type="button"
onClick={() => handleLoadSample(samplePresets[0].url, samplePresets[0].resultUrl)}
className="w-full inline-flex items-center justify-center gap-2.5 px-6 py-4 rounded-2xl bg-paper-hi hover:bg-paper-2 border border-rule hover:border-accent text-ink font-body text-xs sm:text-sm font-semibold shadow-2xs hover:shadow-xs active:scale-98 transition-all cursor-pointer group"
className="w-full inline-flex items-center justify-center gap-2 px-5 py-3 rounded-xl bg-paper-hi hover:bg-paper-2 border border-rule hover:border-accent text-slate-800 font-sans text-xs sm:text-sm font-semibold shadow-2xs hover:shadow-xs active:scale-98 transition-all cursor-pointer group"
>
<Sparkles className="w-4 h-4 text-accent group-hover:rotate-12 transition-transform" />
<span>Try Demo Portrait</span>
@@ -1025,12 +1030,12 @@ export function DynamicToolWorkspace({
{/* Specimen View: Interactive Before/After Slider */}
<div className="lg:col-span-6">
<div className="studio-sheet p-5 rounded-card">
<div className="mb-3.5 flex items-center justify-between text-xs text-muted font-body">
<span className="font-medium text-ink">Transformation specimen</span>
<span>Drag slider to inspect details</span>
<div className="studio-sheet p-4 sm:p-5 rounded-2xl">
<div className="mb-2.5 flex items-center justify-between text-xs text-muted font-sans">
<span className="font-semibold text-slate-900">Transformation specimen</span>
<span className="text-[11px] text-slate-500">Drag slider to inspect details</span>
</div>
<div className="aspect-[4/3] rounded-2xl overflow-hidden bg-paper-2 border border-rule">
<div className="aspect-[4/3] rounded-xl overflow-hidden bg-paper-2 border border-rule">
<CardBeforeAfterSlider
beforeUrl={primaryExample.before}
afterUrl={primaryExample.after}
@@ -1039,8 +1044,8 @@ export function DynamicToolWorkspace({
aspectRatio="aspect-[4/3]"
/>
</div>
<div className="mt-3.5 text-xs text-muted font-body text-center">
Full 4K batch processing available in the {homeApp ? resolveLocalised(homeApp.name, locale) : 'mobile app'}.
<div className="mt-2.5 text-xs text-muted font-sans text-center">
Full 4K batch processing available in {homeApp ? resolveLocalised(homeApp.name, locale) : 'the mobile app'}.
</div>
</div>
</div>
@@ -1085,10 +1090,10 @@ export function DynamicToolWorkspace({
{/* ================= HOW IT WORKS STEPS ================= */}
{tool.content?.steps && tool.content.steps.length > 0 && (
<section className="py-16 sm:py-24 border-t border-rule bg-paper">
<div className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 space-y-12">
<div className="text-center max-w-2xl mx-auto space-y-2">
<span className="text-xs font-semibold text-accent uppercase tracking-wider font-body">
<section className="py-10 sm:py-14 border-t border-rule bg-paper">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 space-y-6 sm:space-y-8">
<div className="text-center max-w-2xl mx-auto space-y-1.5">
<span className="text-xs font-semibold text-accent uppercase tracking-wider font-sans">
Step-by-step
</span>
<h2 className="text-2xl sm:text-3xl font-display font-bold text-ink">
@@ -1096,19 +1101,19 @@ export function DynamicToolWorkspace({
</h2>
</div>
<div className="grid grid-cols-1 md:grid-cols-3 gap-6 sm:gap-8">
<div className="grid grid-cols-1 md:grid-cols-3 gap-5 sm:gap-6">
{tool.content.steps.map((step, idx) => (
<div
key={idx}
className="studio-sheet p-6 rounded-3xl bg-paper-hi border border-rule shadow-xs space-y-3"
className="studio-sheet p-5 rounded-2xl bg-paper-hi border border-rule shadow-xs space-y-2.5"
>
<div className="w-10 h-10 rounded-2xl bg-ink text-paper-hi flex items-center justify-center font-display font-bold text-sm">
<div className="w-9 h-9 rounded-xl bg-slate-900 text-white flex items-center justify-center font-display font-bold text-xs">
0{idx + 1}
</div>
<h3 className="text-base font-display font-bold text-ink">
<h3 className="text-sm sm:text-base font-display font-bold text-ink">
{resolveLocalised(step.title, locale)}
</h3>
<p className="text-xs sm:text-sm text-ink-2 font-body leading-relaxed">
<p className="text-xs text-ink-2 font-sans leading-relaxed">
{resolveLocalised(step.desc, locale)}
</p>
</div>
@@ -1120,27 +1125,27 @@ export function DynamicToolWorkspace({
{/* ================= FAQS ACCORDION ================= */}
{tool.content?.faqs && tool.content.faqs.length > 0 && (
<section className="py-16 sm:py-24 border-t border-rule bg-paper-2">
<div className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 space-y-10">
<div className="text-center space-y-2">
<section className="py-10 sm:py-14 border-t border-rule bg-paper-2">
<div className="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 space-y-6 sm:space-y-8">
<div className="text-center space-y-1.5">
<h2 className="text-2xl sm:text-3xl font-display font-bold text-ink">
Frequently Asked Questions
</h2>
<p className="text-xs sm:text-sm text-ink-2 font-body">
<p className="text-xs text-ink-2 font-sans">
Everything you need to know about inference, privacy, and output resolutions.
</p>
</div>
<div className="space-y-4">
<div className="space-y-3">
{tool.content.faqs.map((faq, idx) => (
<div
key={idx}
className="p-5 sm:p-6 rounded-2xl bg-paper-hi border border-rule shadow-2xs space-y-2"
className="p-4 sm:p-5 rounded-xl bg-paper-hi border border-rule shadow-2xs space-y-1.5"
>
<h4 className="text-sm sm:text-base font-display font-bold text-ink">
<h4 className="text-sm font-display font-bold text-ink">
{faq.q}
</h4>
<p className="text-xs sm:text-sm text-ink-2 font-body leading-relaxed">
<p className="text-xs text-ink-2 font-sans leading-relaxed">
{faq.a}
</p>
</div>
@@ -1151,21 +1156,21 @@ export function DynamicToolWorkspace({
)}
{/* ================= NATIVE APP HANDOFF CTA ================= */}
<section className="py-16 border-t border-rule bg-paper">
<div className="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="studio-sheet p-8 sm:p-10 rounded-3xl bg-paper-hi border border-rule shadow-sheet flex flex-col sm:flex-row items-center justify-between gap-6">
<div className="space-y-2 max-w-xl text-center sm:text-left">
<h3 className="text-xl sm:text-2xl font-display font-bold text-ink">
<section className="py-10 sm:py-12 border-t border-rule bg-paper">
<div className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="studio-sheet p-6 sm:p-8 rounded-2xl bg-paper-hi border border-rule shadow-sheet flex flex-col sm:flex-row items-center justify-between gap-6">
<div className="space-y-1.5 max-w-xl text-center sm:text-left">
<h3 className="text-lg sm:text-xl font-display font-bold text-ink">
Need Batch Processing or 4K Lossless Export?
</h3>
<p className="text-xs sm:text-sm text-ink-2 font-body leading-relaxed">
<p className="text-xs text-ink-2 font-sans leading-relaxed">
Open {toolName} in {homeApp ? resolveLocalised(homeApp.name, locale) : 'our native apps'} with GPU acceleration and RAW format export.
</p>
</div>
<Link
href="/apps"
className="shrink-0 inline-flex items-center gap-2 px-6 py-3 rounded-full bg-ink text-paper-hi text-xs sm:text-sm font-semibold shadow-md hover:bg-slate-900 transition-colors"
className="shrink-0 inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-slate-900 hover:bg-slate-800 text-white text-xs font-semibold shadow-md transition-colors"
>
<Smartphone className="w-4 h-4 text-accent" />
<span>Explore Mobile Apps Suite</span>