feat: tool page front screen dedicated upload interface and section 2 transformation results

This commit is contained in:
2026-11-04 11:47:43 +05:30
parent 63d850330e
commit 378f5c40a9
4 changed files with 79 additions and 147 deletions
+6 -9
View File
@@ -11,20 +11,17 @@
"breadcrumbs": true
}
},
{
"id": "tool-tryit",
"type": "tryItWidget",
"props": {
"toolRef": "{{tool.id}}"
}
},
{
"id": "tool-beforeafter",
"type": "beforeAfter",
"props": {
"title": {
"en": "Real Before & After Comparisons",
"hi": "वास्तविक पहले और बाद की तुलना"
"en": "Real Before & After Results",
"hi": "वास्तविक पहले और बाद के परिणाम"
},
"subtitle": {
"en": "Inspect sub-pixel neural transformation details with the interactive comparison slider.",
"hi": "इंटरैक्टिव तुलना स्लाइडर के साथ विवरणों का निरीक्षण करें।"
},
"items": "{{tool.content.examples}}"
}
+12 -37
View File
@@ -138,23 +138,17 @@ export function HeroSection({
</span>
</div>
{/* CTAs */}
<div className="mt-8 flex flex-wrap gap-3.5">
<a
href="#tool-tryit"
className="group inline-flex items-center gap-2.5 rounded-full bg-blue-600 px-6 py-3.5 text-sm font-semibold text-white shadow-lg shadow-blue-600/25 transition-all hover:-translate-y-0.5 hover:bg-blue-700 hover:shadow-xl"
>
<Sparkles className="h-4 w-4" /> Try with your photo <ArrowRight className="h-4 w-4 transition-transform group-hover:translate-x-1" />
</a>
{homeApp && (
{/* App Availability */}
{homeApp && (
<div className="mt-7">
<Link
href={`/apps/${homeApp.slug}`}
className="inline-flex items-center gap-2 rounded-full border border-slate-300/80 bg-white/80 px-5 py-3.5 text-sm font-semibold text-slate-800 shadow-sm transition-all hover:-translate-y-0.5 hover:border-slate-400 hover:bg-white"
className="inline-flex items-center gap-2 rounded-full border border-slate-300/80 bg-white/80 px-5 py-3 text-xs sm:text-sm font-semibold text-slate-800 shadow-sm transition-all hover:-translate-y-0.5 hover:border-slate-400 hover:bg-white"
>
<Smartphone className="h-4 w-4 text-blue-700" /> {appName} App
<Smartphone className="h-4 w-4 text-blue-700" /> Available in {appName} for iOS & Android
</Link>
)}
</div>
</div>
)}
{/* Trust Badges */}
<div className="mt-8 flex flex-wrap gap-x-5 gap-y-2 text-xs font-medium text-slate-500">
@@ -164,30 +158,11 @@ export function HeroSection({
</div>
</div>
{/* Right Column: Hero Interactive Transformation Showcase */}
<div className="relative min-w-0">
<div className="absolute -inset-4 rounded-[2.5rem] bg-gradient-to-br from-blue-300/30 via-amber-200/20 to-indigo-300/30 blur-2xl pointer-events-none" />
<div className="relative rounded-[2rem] border border-slate-900/[0.1] bg-white p-2.5 sm:p-3 shadow-cinematic-3d">
{example?.before && example?.after ? (
<div className="space-y-2.5">
<CardBeforeAfterSlider
beforeUrl={example.before}
afterUrl={example.after}
beforeLabel="ORIGINAL"
afterLabel="AI RESULT"
aspectRatio="aspect-[4/3] sm:aspect-[16/10]"
/>
{example.caption && (
<p className="px-2 py-1 text-center text-xs font-medium text-slate-500">
{example.caption}
</p>
)}
</div>
) : (
<div className="aspect-[16/10] bg-slate-100 rounded-2xl grid place-items-center text-slate-400 text-sm">
Interactive transformation preview
</div>
)}
{/* Right Column: Front Screen ONLY Upload Image Option (No before/after) */}
<div className="relative min-w-0" id="tool-tryit">
<div className="absolute -inset-4 rounded-[2.5rem] bg-gradient-to-br from-blue-200/40 via-white/30 to-amber-100/50 blur-2xl pointer-events-none" />
<div className="relative rounded-[2rem] border border-slate-900/[0.1] bg-white p-1 sm:p-2 shadow-cinematic-3d">
<TryItWidget tool={tool} homeApp={homeApp} variants={variants} locale={locale} />
</div>
</div>
</div>
+60 -100
View File
@@ -207,111 +207,71 @@ export function TryItWidget({
{/* Main Body per Status */}
<div className="mt-7">
{status === 'idle' && (
<div className="grid grid-cols-1 lg:grid-cols-[1.1fr_.9fr] gap-8 items-center">
{/* Left Column: Interactive Before/After Transformation Preview */}
<div className="space-y-3">
<div className="flex items-center justify-between">
<span className="text-xs font-mono uppercase tracking-wider text-slate-500 font-bold flex items-center gap-1.5">
<Sparkles className="w-3.5 h-3.5 text-blue-600" /> Real AI Transformation Output
</span>
<span className="text-[10px] font-mono font-semibold text-blue-700 bg-blue-50 px-2 py-0.5 rounded-full border border-blue-200">
Auto-sliding & scrubber
</span>
<div className="space-y-6">
{/* Drag & Drop Upload Zone */}
<div
onDrop={handleDrop}
onDragOver={(e) => {
e.preventDefault();
setIsDragOver(true);
}}
onDragLeave={() => setIsDragOver(false)}
onClick={() => fileInputRef.current?.click()}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
fileInputRef.current?.click();
}
}}
role="button"
tabIndex={0}
aria-label="Upload photo to edit"
className={`border-2 border-dashed rounded-3xl p-8 sm:p-12 text-center cursor-pointer transition-all duration-300 group ${
isDragOver
? 'border-blue-500 bg-blue-50/60 scale-[1.01]'
: 'border-slate-300 hover:border-blue-500 bg-slate-50/50 hover:bg-blue-50/20'
}`}
>
<input
ref={fileInputRef}
type="file"
accept="image/jpeg,image/png,image/webp"
className="hidden"
onChange={(e) => e.target.files?.[0] && handleFileChange(e.target.files[0])}
/>
<div className="w-16 h-16 sm:w-20 sm:h-20 mx-auto mb-4 rounded-3xl bg-blue-50 border border-blue-100 flex items-center justify-center text-blue-600 group-hover:scale-110 transition-all duration-300 shadow-sm">
<UploadCloud className="w-8 h-8 sm:w-10 sm:h-10" />
</div>
{tool.content?.examples?.[0]?.before && tool.content?.examples?.[0]?.after ? (
<div className="rounded-2xl overflow-hidden border border-slate-900/10 shadow-cream-sm">
<CardBeforeAfterSlider
beforeUrl={tool.content.examples[0].before}
afterUrl={tool.content.examples[0].after}
beforeLabel="ORIGINAL"
afterLabel="AI RESULT"
aspectRatio="aspect-[4/3] sm:aspect-[16/10]"
/>
</div>
) : (
<div className="aspect-[16/10] bg-slate-100 rounded-2xl grid place-items-center text-slate-400 text-sm">
Transformation preview
</div>
)}
<div className="inline-flex items-center gap-2 px-6 py-3 rounded-full bg-blue-600 hover:bg-blue-700 text-white font-semibold text-sm shadow-md shadow-blue-500/20 group-hover:shadow-lg transition-all mb-3">
<UploadCloud className="w-4 h-4" />
<span>Upload Image</span>
</div>
{tool.content?.examples?.[0]?.caption && (
<p className="text-center text-xs font-medium text-slate-500 px-1">
{tool.content.examples[0].caption}
</p>
)}
<p className="text-sm sm:text-base font-display font-medium text-slate-700">
or drag and drop your photo here
</p>
<p className="mt-2 text-xs font-mono text-slate-500">
Supports JPG, PNG, WEBP up to {tool.tryIt?.limits?.maxMB || 12}MB • High-res 4K processing
</p>
</div>
{/* Right Column: Upload Zone & Instant Samples */}
<div className="space-y-5">
<div>
<h4 className="font-display font-bold text-slate-900 text-lg sm:text-xl">
Try with your photo
</h4>
<p className="text-xs text-slate-500 mt-1">
Test {resolveLocalised(tool.name, locale)} in your browser with zero setup or sign-in.
</p>
</div>
{/* Drag & Drop Upload Zone */}
<div
onDrop={handleDrop}
onDragOver={(e) => {
e.preventDefault();
setIsDragOver(true);
}}
onDragLeave={() => setIsDragOver(false)}
onClick={() => fileInputRef.current?.click()}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
fileInputRef.current?.click();
}
}}
role="button"
tabIndex={0}
aria-label="Choose a JPG, PNG, or WebP photo to edit"
className={`border-2 border-dashed rounded-2xl p-6 sm:p-8 text-center cursor-pointer transition-all duration-300 group ${
isDragOver
? 'border-blue-500 bg-blue-50/50 scale-[1.01]'
: 'border-slate-300 hover:border-blue-500 bg-slate-50/60 hover:bg-blue-50/30'
}`}
>
<input
ref={fileInputRef}
type="file"
accept="image/jpeg,image/png,image/webp"
className="hidden"
onChange={(e) => e.target.files?.[0] && handleFileChange(e.target.files[0])}
/>
<div className="w-12 h-12 mx-auto mb-3 rounded-2xl bg-blue-50 border border-blue-100 flex items-center justify-center text-blue-600 group-hover:scale-110 transition-all duration-300 shadow-sm">
<UploadCloud className="w-6 h-6" />
</div>
<p className="text-sm sm:text-base font-display font-bold text-slate-900">
Drop your photo here, or <span className="text-blue-600 underline decoration-blue-300 underline-offset-4 group-hover:text-blue-700">browse</span>
</p>
<p className="mt-1 text-[11px] font-mono text-slate-500">
JPG, PNG, WebP up to {tool.tryIt?.limits?.maxMB || 12}MB
</p>
</div>
{/* Quick Sample Presets */}
<div>
<p className="text-xs font-mono uppercase tracking-wider text-slate-500 font-semibold mb-2.5">
Or test instantly with a sample photo:
</p>
<div className="flex flex-wrap gap-2">
{samplePresets.map((preset, idx) => (
<button
key={idx}
onClick={() => loadSamplePreset(preset.url)}
className="inline-flex items-center gap-1.5 px-3 py-2 rounded-xl text-xs font-semibold bg-white border border-slate-200 text-slate-700 hover:bg-blue-50 hover:border-blue-300 hover:text-blue-700 transition-all active:scale-95 shadow-2xs"
>
<ImageIcon className="w-3.5 h-3.5 text-slate-400" />
<span>{preset.label}</span>
</button>
))}
</div>
{/* Quick Sample Presets */}
<div className="pt-1">
<p className="text-xs font-mono uppercase tracking-wider text-slate-500 font-semibold mb-3">
Or test instantly with a sample photo:
</p>
<div className="flex flex-wrap gap-2.5">
{samplePresets.map((preset, idx) => (
<button
key={idx}
onClick={() => loadSamplePreset(preset.url)}
className="inline-flex items-center gap-2 px-4 py-2.5 rounded-xl text-xs font-semibold bg-white border border-slate-200 text-slate-700 hover:bg-blue-50 hover:border-blue-300 hover:text-blue-700 transition-all active:scale-95 shadow-2xs"
>
<ImageIcon className="w-3.5 h-3.5 text-slate-400" />
<span>{preset.label}</span>
</button>
))}
</div>
</div>
</div>
+1 -1
View File
@@ -21,7 +21,7 @@ export function BeforeAfterSlider({
afterLabel,
caption,
aspectRatio = 'aspect-[4/3] sm:aspect-[16/10]',
autoSlide = false,
autoSlide = true,
className = '',
}: BeforeAfterSliderProps) {
return (