feat(ui): complete redesign of tools pages, prominent buttons below photo upload, and futuristic processing animations

This commit is contained in:
2026-11-11 10:47:00 +05:30
parent 4eff5ae66c
commit d035f48319
6 changed files with 520 additions and 111 deletions
+65
View File
@@ -525,5 +525,70 @@ button:disabled,
scrollbar-width: none; scrollbar-width: none;
} }
/* Futuristic AI Processing Scanner & HUD Keyframes */
@keyframes laser-sweep {
0% {
top: -5%;
opacity: 0;
}
15% {
opacity: 1;
}
85% {
opacity: 1;
}
100% {
top: 105%;
opacity: 0;
}
}
@keyframes laser-glow-pulse {
0%, 100% {
filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.7)) drop-shadow(0 0 20px rgba(99, 102, 241, 0.5));
}
50% {
filter: drop-shadow(0 0 16px rgba(56, 189, 248, 0.95)) drop-shadow(0 0 35px rgba(168, 85, 247, 0.7));
}
}
@keyframes hud-shimmer {
0% {
background-position: -200% 0;
}
100% {
background-position: 200% 0;
}
}
.laser-scanner {
position: absolute;
left: 0;
right: 0;
height: 60px;
background: linear-gradient(
180deg,
transparent 0%,
rgba(56, 189, 248, 0.08) 30%,
rgba(99, 102, 241, 0.35) 75%,
rgba(56, 189, 248, 0.95) 96%,
#ffffff 100%
);
box-shadow: 0 4px 20px -2px rgba(56, 189, 248, 0.7), 0 0 30px rgba(99, 102, 241, 0.5);
animation: laser-sweep 2.4s cubic-bezier(0.45, 0, 0.55, 1) infinite, laser-glow-pulse 1.8s ease-in-out infinite;
pointer-events: none;
z-index: 20;
}
.laser-scanner-line {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 2px;
background: #ffffff;
box-shadow: 0 0 8px #ffffff, 0 0 16px rgba(56, 189, 248, 1), 0 0 24px rgba(99, 102, 241, 0.9);
}
+27 -6
View File
@@ -394,6 +394,17 @@ function ToolCard({
const toolName = resolveLocalised(tool.name, locale); const toolName = resolveLocalised(tool.name, locale);
const toolSummary = resolveLocalised(tool.summary, locale); const toolSummary = resolveLocalised(tool.summary, locale);
const archetypeBadge =
tool.pageType === 'masking'
? 'Smart Masking'
: tool.pageType === 'image-thumbnail'
? 'Style Presets'
: tool.pageType === 'text-to-image'
? 'Text-to-Image'
: tool.pageType === 'two-images'
? 'Dual Fusion'
: 'Single-Click';
return ( return (
<div className="group studio-sheet p-4 sm:p-5 rounded-3xl bg-paper-hi border border-rule shadow-[0_4px_24px_-4px_rgba(0,0,0,0.03)] hover:border-accent hover:shadow-glow motion-safe:transition-[border-color,box-shadow,transform] duration-300 hover:-translate-y-1 flex flex-col justify-between h-full"> <div className="group studio-sheet p-4 sm:p-5 rounded-3xl bg-paper-hi border border-rule shadow-[0_4px_24px_-4px_rgba(0,0,0,0.03)] hover:border-accent hover:shadow-glow motion-safe:transition-[border-color,box-shadow,transform] duration-300 hover:-translate-y-1 flex flex-col justify-between h-full">
{/* Image Dominant Preview Frame */} {/* Image Dominant Preview Frame */}
@@ -402,9 +413,16 @@ function ToolCard({
{/* Info Area: Title, Subtitle, and Direct Action Button */} {/* Info Area: Title, Subtitle, and Direct Action Button */}
<div className="mt-4 flex-1 flex flex-col justify-between space-y-3.5"> <div className="mt-4 flex-1 flex flex-col justify-between space-y-3.5">
<div> <div>
{/* Tool Title */} {/* Badge & Tool Title */}
<div className="flex items-center justify-between gap-2 mb-1.5">
<span className="px-2.5 py-0.5 rounded-full bg-accent/10 border border-accent/20 text-[10px] font-semibold text-accent font-body uppercase tracking-wider">
{archetypeBadge}
</span>
<span className="text-[11px] text-muted font-body">Free browser trial</span>
</div>
<Link href={`/tools/${tool.slug}`} className="block"> <Link href={`/tools/${tool.slug}`} className="block">
<h4 className="text-base sm:text-lg font-display font-bold text-ink tracking-tight leading-snug"> <h4 className="text-base sm:text-lg font-display font-bold text-ink tracking-tight leading-snug group-hover:text-accent transition-colors">
<AnimatedShinyText>{toolName}</AnimatedShinyText> <AnimatedShinyText>{toolName}</AnimatedShinyText>
</h4> </h4>
</Link> </Link>
@@ -415,15 +433,18 @@ function ToolCard({
</p> </p>
</div> </div>
{/* Action Button Row */} {/* Action Button Row: Highly Visible Prominent Primary Button */}
<div className="pt-3 border-t border-rule"> <div className="pt-3 border-t border-rule">
<Link <Link
href={`/tools/${tool.slug}`} href={`/tools/${tool.slug}`}
className="w-full inline-flex items-center justify-between px-4 py-2.5 rounded-full bg-paper-2 text-ink hover:bg-ink hover:text-paper-hi font-body text-xs font-semibold transition-colors duration-150 shadow-2xs group/btn active:scale-98" className="w-full inline-flex items-center justify-between px-5 py-3 rounded-2xl bg-ink hover:bg-accent text-paper-hi font-display font-bold text-xs sm:text-sm transition-all duration-200 shadow-xs hover:shadow-md group/btn active:scale-98"
aria-label={`Open interactive studio for ${toolName}`} aria-label={`Open interactive studio for ${toolName}`}
> >
<span>Try tool in browser</span> <span className="flex items-center gap-2">
<ArrowRight className="w-3.5 h-3.5 text-accent group-hover/btn:text-paper-hi group-hover/btn:translate-x-0.5 transition-all" aria-hidden="true" /> <Sparkles className="w-4 h-4 text-accent group-hover/btn:text-white transition-colors" />
<span>Launch Tool Studio</span>
</span>
<ArrowRight className="w-4 h-4 text-paper-hi group-hover/btn:translate-x-1 transition-transform" aria-hidden="true" />
</Link> </Link>
</div> </div>
</div> </div>
+278 -103
View File
@@ -20,7 +20,10 @@ import {
Image as ImageIcon, Image as ImageIcon,
Check, Check,
ChevronRight, ChevronRight,
Smartphone Smartphone,
FolderOpen,
Zap,
ShieldCheck
} from 'lucide-react'; } from 'lucide-react';
import { import {
ToolItem, ToolItem,
@@ -34,6 +37,7 @@ import { CardBeforeAfterSlider } from '@/components/ui/CardBeforeAfterSlider';
import { MaskCanvasEditor } from './MaskCanvasEditor'; import { MaskCanvasEditor } from './MaskCanvasEditor';
import { ThumbnailsSection } from './ThumbnailsSection'; import { ThumbnailsSection } from './ThumbnailsSection';
import { AlternatingFeaturesSection } from './AlternatingFeaturesSection'; import { AlternatingFeaturesSection } from './AlternatingFeaturesSection';
import { ProcessingOverlay } from './ProcessingOverlay';
import { KineticText } from '@/components/magicui/kinetic-text'; import { KineticText } from '@/components/magicui/kinetic-text';
import { AnimatedShinyText } from '@/components/magicui/animated-shiny-text'; import { AnimatedShinyText } from '@/components/magicui/animated-shiny-text';
import { BorderBeam } from '@/components/magicui/border-beam'; import { BorderBeam } from '@/components/magicui/border-beam';
@@ -400,13 +404,46 @@ export function DynamicToolWorkspace({
afterLabel="RESULT" afterLabel="RESULT"
/> />
</div> </div>
{/* POST-EDIT ACTION BAR: DIRECTLY BELOW THE RESULT SLIDER */}
<div className="pt-6 border-t border-rule space-y-4">
<div className="flex flex-col sm:flex-row items-center justify-between gap-4">
<div className="flex items-center gap-2.5 w-full sm:w-auto order-2 sm:order-1">
<button
type="button"
onClick={() => setStatus('idle')}
className="flex-1 sm:flex-none inline-flex items-center justify-center gap-2 px-6 py-3.5 rounded-2xl bg-paper-2 hover:bg-paper text-ink font-body text-xs sm:text-sm font-semibold border border-rule transition-colors cursor-pointer shadow-2xs"
>
<RefreshCw className="w-4 h-4 text-accent" />
<span>Re-edit / Adjust</span>
</button>
<button
type="button"
onClick={handleResetStudio}
className="flex-1 sm:flex-none inline-flex items-center justify-center gap-2 px-6 py-3.5 rounded-2xl bg-paper-2 hover:bg-paper text-ink font-body text-xs sm:text-sm font-semibold border border-rule transition-colors cursor-pointer shadow-2xs"
>
<UploadCloud className="w-4 h-4 text-muted" />
<span>Try Another Photo</span>
</button>
</div>
<a
href={resultUrl}
download={`${tool.slug}-result.png`}
className="w-full sm:w-auto inline-flex items-center justify-center gap-3 px-8 sm:px-12 py-4 rounded-2xl sm:rounded-full bg-ink hover:bg-slate-900 text-paper-hi font-display font-bold text-sm sm:text-base shadow-xl hover:scale-[1.02] active:scale-98 transition-all cursor-pointer order-1 sm:order-2"
>
<Download className="w-5 h-5 text-accent" />
<span>Download Result (HD PNG)</span>
</a>
</div>
</div>
</div> </div>
) : ( ) : (
/* PRE-EDIT WORKSPACE (Interactive Editing by Page Type) */ /* PRE-EDIT WORKSPACE (Interactive Editing by Page Type) */
<div> <div className="space-y-6">
{/* 1. MASKING STUDIO (Auto-mask + Custom Mask Brush) */} {/* 1. MASKING STUDIO (Auto-mask + Custom Mask Brush) */}
{pageType === 'masking' && primaryPreview && ( {pageType === 'masking' && primaryPreview && (
<div className="space-y-6"> <div className="space-y-4">
<div className="flex items-center justify-between pb-2 border-b border-rule"> <div className="flex items-center justify-between pb-2 border-b border-rule">
<span className="text-xs font-semibold text-ink font-body"> <span className="text-xs font-semibold text-ink font-body">
Inpainting & Object Masking Studio Inpainting & Object Masking Studio
@@ -420,6 +457,8 @@ export function DynamicToolWorkspace({
imageUrl={primaryPreview} imageUrl={primaryPreview}
config={tool.maskingConfig} config={tool.maskingConfig}
locale={locale} locale={locale}
isProcessing={status === 'processing'}
toolName={toolName}
onMaskChange={setHasMaskDrawn} onMaskChange={setHasMaskDrawn}
onExportReady={(fn) => { onExportReady={(fn) => {
getMaskBlobRef.current = fn; getMaskBlobRef.current = fn;
@@ -430,7 +469,7 @@ export function DynamicToolWorkspace({
{/* 2. IMAGE + THUMBNAIL STUDIO */} {/* 2. IMAGE + THUMBNAIL STUDIO */}
{pageType === 'image-thumbnail' && primaryPreview && ( {pageType === 'image-thumbnail' && primaryPreview && (
<div className="space-y-6"> <div className="space-y-4">
<div className="aspect-[4/3] sm:aspect-[16/10] max-h-[520px] w-full rounded-2xl overflow-hidden bg-paper-2 border border-rule relative"> <div className="aspect-[4/3] sm:aspect-[16/10] max-h-[520px] w-full rounded-2xl overflow-hidden bg-paper-2 border border-rule relative">
{/* eslint-disable-next-line @next/next/no-img-element */} {/* eslint-disable-next-line @next/next/no-img-element */}
<img <img
@@ -438,13 +477,16 @@ export function DynamicToolWorkspace({
alt="Uploaded preview" alt="Uploaded preview"
className="w-full h-full object-contain" className="w-full h-full object-contain"
/> />
{status === 'processing' && (
<ProcessingOverlay toolName={toolName} />
)}
</div> </div>
</div> </div>
)} )}
{/* 3. IMAGE-ONLY STUDIO */} {/* 3. IMAGE-ONLY STUDIO */}
{pageType === 'image-only' && primaryPreview && ( {pageType === 'image-only' && primaryPreview && (
<div className="space-y-6"> <div className="space-y-4">
<div className="aspect-[4/3] sm:aspect-[16/10] max-h-[520px] w-full rounded-2xl overflow-hidden bg-paper-2 border border-rule relative"> <div className="aspect-[4/3] sm:aspect-[16/10] max-h-[520px] w-full rounded-2xl overflow-hidden bg-paper-2 border border-rule relative">
{/* eslint-disable-next-line @next/next/no-img-element */} {/* eslint-disable-next-line @next/next/no-img-element */}
<img <img
@@ -452,6 +494,9 @@ export function DynamicToolWorkspace({
alt="Uploaded preview" alt="Uploaded preview"
className="w-full h-full object-contain" className="w-full h-full object-contain"
/> />
{status === 'processing' && (
<ProcessingOverlay toolName={toolName} />
)}
</div> </div>
</div> </div>
)} )}
@@ -462,16 +507,23 @@ export function DynamicToolWorkspace({
<label className="block text-xs font-semibold text-ink font-body"> <label className="block text-xs font-semibold text-ink font-body">
Prompt Description Prompt Description
</label> </label>
<textarea <div className="relative">
rows={4} <textarea
value={promptText} rows={4}
onChange={(e) => setPromptText(e.target.value)} value={promptText}
placeholder={ onChange={(e) => setPromptText(e.target.value)}
resolveLocalised(tool.textToImageConfig?.placeholder, locale) || placeholder={
'Describe what you want to create in vivid detail (e.g. A futuristic cybernetic portrait with neon rim lighting in 4K resolution)...' resolveLocalised(tool.textToImageConfig?.placeholder, locale) ||
} 'Describe what you want to create in vivid detail (e.g. A futuristic cybernetic portrait with neon rim lighting in 4K resolution)...'
className="w-full p-4 rounded-2xl border border-rule bg-paper text-ink text-sm font-body placeholder:text-muted focus:outline-none focus:border-accent focus:ring-2 focus:ring-accent/20" }
/> className="w-full p-4 rounded-2xl border border-rule bg-paper text-ink text-sm font-body placeholder:text-muted focus:outline-none focus:border-accent focus:ring-2 focus:ring-accent/20"
/>
{status === 'processing' && (
<div className="absolute inset-0 rounded-2xl overflow-hidden">
<ProcessingOverlay toolName={toolName} />
</div>
)}
</div>
{/* Aspect Ratios Selector */} {/* Aspect Ratios Selector */}
<div className="space-y-2"> <div className="space-y-2">
@@ -498,66 +550,146 @@ export function DynamicToolWorkspace({
{/* 5. TWO-IMAGES STUDIO */} {/* 5. TWO-IMAGES STUDIO */}
{pageType === 'two-images' && ( {pageType === 'two-images' && (
<div className="grid grid-cols-1 md:grid-cols-2 gap-6"> <div className="relative">
{/* Primary Image Slot */} <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div className="space-y-2"> {/* Primary Image Slot */}
<span className="text-xs font-semibold text-ink font-body"> <div className="space-y-2">
{resolveLocalised(tool.twoImagesConfig?.firstImageLabel, locale) || 'Primary Photo'} <span className="text-xs font-semibold text-ink font-body">
</span> {resolveLocalised(tool.twoImagesConfig?.firstImageLabel, locale) || 'Primary Photo'}
<div className="aspect-[4/3] rounded-2xl overflow-hidden bg-paper-2 border border-rule relative"> </span>
{primaryPreview ? ( <div className="aspect-[4/3] rounded-2xl overflow-hidden bg-paper-2 border border-rule relative">
// eslint-disable-next-line @next/next/no-img-element {primaryPreview ? (
<img src={primaryPreview} alt="Primary" className="w-full h-full object-contain" /> // eslint-disable-next-line @next/next/no-img-element
) : ( <img src={primaryPreview} alt="Primary" className="w-full h-full object-contain" />
<div className="w-full h-full flex flex-col items-center justify-center p-4 text-muted text-xs"> ) : (
<UploadCloud className="w-6 h-6 mb-2 text-accent" /> <div className="w-full h-full flex flex-col items-center justify-center p-4 text-muted text-xs">
<span>Upload primary photo</span> <UploadCloud className="w-6 h-6 mb-2 text-accent" />
</div> <span>Upload primary photo</span>
)} </div>
)}
</div>
</div>
{/* Secondary Image Slot */}
<div className="space-y-2">
<span className="text-xs font-semibold text-ink font-body">
{resolveLocalised(tool.twoImagesConfig?.secondImageLabel, locale) || 'Reference / Style Photo'}
</span>
<div className="aspect-[4/3] rounded-2xl overflow-hidden bg-paper-2 border border-rule relative">
{secondaryPreview ? (
// eslint-disable-next-line @next/next/no-img-element
<img src={secondaryPreview} alt="Secondary" className="w-full h-full object-contain" />
) : (
<label className="w-full h-full flex flex-col items-center justify-center p-4 text-muted text-xs cursor-pointer hover:bg-paper transition-colors">
<UploadCloud className="w-6 h-6 mb-2 text-accent" />
<span>Click to upload reference photo</span>
<input
ref={secondaryFileInputRef}
type="file"
accept="image/*"
className="hidden"
onChange={(e) => {
if (e.target.files?.[0]) handleSecondaryFileSelect(e.target.files[0]);
}}
/>
</label>
)}
</div>
</div> </div>
</div> </div>
{/* Secondary Image Slot */} {status === 'processing' && (
<div className="space-y-2"> <ProcessingOverlay toolName={toolName} />
<span className="text-xs font-semibold text-ink font-body"> )}
{resolveLocalised(tool.twoImagesConfig?.secondImageLabel, locale) || 'Reference / Style Photo'}
</span>
<div className="aspect-[4/3] rounded-2xl overflow-hidden bg-paper-2 border border-rule relative">
{secondaryPreview ? (
// eslint-disable-next-line @next/next/no-img-element
<img src={secondaryPreview} alt="Secondary" className="w-full h-full object-contain" />
) : (
<label className="w-full h-full flex flex-col items-center justify-center p-4 text-muted text-xs cursor-pointer hover:bg-paper transition-colors">
<UploadCloud className="w-6 h-6 mb-2 text-accent" />
<span>Click to upload reference photo</span>
<input
ref={secondaryFileInputRef}
type="file"
accept="image/*"
className="hidden"
onChange={(e) => {
if (e.target.files?.[0]) handleSecondaryFileSelect(e.target.files[0]);
}}
/>
</label>
)}
</div>
</div>
</div> </div>
)} )}
</div>
)}
{/* In-Studio Style Preset Thumbnails (for image-thumbnail or masking with thumbnails) */} {/* In-Studio Style Preset Thumbnails (for image-thumbnail or masking with thumbnails) */}
{tool.thumbnails && tool.thumbnails.length > 0 && ( {tool.thumbnails && tool.thumbnails.length > 0 && (
<div className="pt-4 border-t border-rule"> <div className="pt-4 border-t border-rule">
<ThumbnailsSection <ThumbnailsSection
thumbnails={tool.thumbnails} thumbnails={tool.thumbnails}
selectedId={selectedThumbnail?.id} selectedId={selectedThumbnail?.id}
onSelect={(item) => setSelectedThumbnail(item)} onSelect={(item) => setSelectedThumbnail(item)}
locale={locale} locale={locale}
variant="compact-bar" variant="compact-bar"
/> />
</div>
)}
{/* ================================================================= */}
{/* STUDIO MAIN ACTION BAR: CLEARLY VISIBLE PRIMARY & SECONDARY BUTTONS */}
{/* DIRECTLY BELOW THE PHOTO UPLOAD CANVAS (USER MANDATE) */}
{/* ================================================================= */}
<div className="pt-6 border-t border-rule space-y-4">
<div className="flex flex-col sm:flex-row items-center justify-between gap-4">
{/* Left: Secondary actions (Change Photo, Reset, etc.) */}
<div className="flex items-center gap-2.5 w-full sm:w-auto order-2 sm:order-1">
{pageType !== 'text-to-image' && (
<button
type="button"
onClick={() => fileInputRef.current?.click()}
className="flex-1 sm:flex-none inline-flex items-center justify-center gap-2 px-5 py-3.5 rounded-2xl bg-paper-2 hover:bg-paper text-ink font-body text-xs sm:text-sm font-semibold border border-rule transition-colors cursor-pointer shadow-2xs"
>
<FolderOpen className="w-4 h-4 text-accent" />
<span>Change Photo</span>
</button>
)}
<button
type="button"
onClick={handleResetStudio}
className="inline-flex items-center justify-center gap-1.5 px-4 py-3.5 rounded-2xl bg-paper-2 hover:bg-red-50 hover:text-red-600 hover:border-red-200 text-ink-2 font-body text-xs sm:text-sm font-medium border border-rule transition-colors cursor-pointer shadow-2xs"
>
<RotateCcw className="w-3.5 h-3.5" />
<span>Reset</span>
</button>
</div>
{/* Right: Massive High-Visibility Main Process Button */}
<div className="w-full sm:w-auto order-1 sm:order-2">
<button
type="button"
onClick={handleExecute}
disabled={status === 'processing'}
className="w-full sm:w-auto inline-flex items-center justify-center gap-3 px-8 sm:px-12 py-4 rounded-2xl sm:rounded-full bg-accent hover:bg-accent-hi text-white font-display font-extrabold text-sm sm:text-base shadow-xl shadow-accent/25 hover:shadow-accent/40 hover:scale-[1.02] active:scale-98 transition-all cursor-pointer disabled:opacity-50 disabled:hover:scale-100"
>
{status === 'processing' ? (
<>
<Loader2 className="w-5 h-5 animate-spin" />
<span>Processing Neural Model...</span>
</>
) : (
<>
<Sparkles className="w-5 h-5 text-amber-300 animate-pulse" />
<span>
{pageType === 'masking'
? 'Inpaint & Remove Objects'
: pageType === 'text-to-image'
? 'Generate AI Artwork'
: pageType === 'two-images'
? 'Fuse Facial Identities'
: pageType === 'image-thumbnail' && selectedThumbnail
? `Apply ${resolveLocalised(selectedThumbnail.label, locale)} Look`
: 'Process & Enhance Photo'}
</span>
<ArrowRight className="w-4 h-4" />
</>
)}
</button>
</div>
</div>
<div className="flex flex-wrap items-center justify-between text-[11px] text-muted font-body px-1 gap-2">
<span className="flex items-center gap-1 text-emerald-600 font-medium">
<CheckCircle2 className="w-3 h-3" />
<span>Volatile GPU memory execution · Zero server storage</span>
</span>
<span className="font-mono">{remainingTries} free daily operations remaining</span>
</div>
</div>
</div> </div>
)} )}
@@ -670,41 +802,61 @@ export function DynamicToolWorkspace({
</div> </div>
)} )}
{/* Type 1, 2, 3: Single Drag & Drop Dropzone */} {/* Type 1, 2, 3: Single Drag & Drop Dropzone with Prominent Buttons Below */}
{pageType !== 'text-to-image' && pageType !== 'two-images' && ( {pageType !== 'text-to-image' && pageType !== 'two-images' && (
<div <div className="space-y-4">
onDragOver={(e) => e.preventDefault()} <div
onDrop={(e) => { onDragOver={(e) => e.preventDefault()}
e.preventDefault(); onDrop={(e) => {
if (e.dataTransfer.files?.[0]) handlePrimaryFileSelect(e.dataTransfer.files[0]); e.preventDefault();
}} 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-8 sm:p-10 text-center bg-paper/60 hover:bg-accent/5 transition-all cursor-pointer group"
>
<input
ref={fileInputRef}
type="file"
accept="image/jpeg,image/png,image/webp"
className="hidden"
onChange={(e) => {
if (e.target.files?.[0]) handlePrimaryFileSelect(e.target.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"
>
<input
ref={fileInputRef}
type="file"
accept="image/jpeg,image/png,image/webp"
className="hidden"
onChange={(e) => {
if (e.target.files?.[0]) handlePrimaryFileSelect(e.target.files[0]);
}}
/>
<div className="w-14 h-14 rounded-2xl bg-paper-hi border border-rule flex items-center justify-center text-accent mx-auto mb-4 group-hover:scale-110 group-hover:border-accent transition-transform shadow-xs"> <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-7 h-7" /> <UploadCloud className="w-8 h-8" />
</div>
<h4 className="text-base sm:text-lg 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">
Supports JPG, PNG, WebP up to 12MB. Zero server retention.
</p>
</div> </div>
<h4 className="text-sm sm:text-base font-display font-bold text-ink"> {/* PROMINENT ACTION BUTTONS DIRECTLY BELOW PHOTO UPLOAD */}
Upload your image to edit <div className="grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1">
</h4> <button
<p className="text-xs text-muted font-body mt-1 max-w-xs mx-auto"> type="button"
Drag & drop your photo here, or click to browse. Supports JPG, PNG, WebP up to 12MB. onClick={() => fileInputRef.current?.click()}
</p> 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"
>
<FolderOpen className="w-4 h-4 text-white group-hover:scale-110 transition-transform" />
<span>Select Photo to Upload</span>
</button>
<div className="mt-4 inline-flex items-center gap-1.5 px-4 py-2 rounded-full bg-ink text-paper-hi text-xs font-semibold shadow-xs"> {samplePresets.length > 0 && (
<span>Select Photo</span> <button
<ArrowRight className="w-3.5 h-3.5" /> 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"
>
<Sparkles className="w-4 h-4 text-accent group-hover:rotate-12 transition-transform" />
<span>Try Demo Portrait</span>
</button>
)}
</div> </div>
</div> </div>
)} )}
@@ -789,19 +941,41 @@ export function DynamicToolWorkspace({
onChange={(e) => setPromptText(e.target.value)} onChange={(e) => setPromptText(e.target.value)}
placeholder={ placeholder={
resolveLocalised(tool.textToImageConfig?.placeholder, locale) || resolveLocalised(tool.textToImageConfig?.placeholder, locale) ||
'Describe what you want to create...' 'Describe what you want to create (e.g. A solitary astronaut standing on crystal sands under a violet nebula, cinematic rim lighting, 8k resolution)...'
} }
className="w-full p-4 rounded-2xl border border-rule bg-paper text-ink text-sm font-body placeholder:text-muted focus:outline-none focus:border-accent focus:ring-2 focus:ring-accent/20" className="w-full p-4 rounded-2xl border border-rule bg-paper text-ink text-sm font-body placeholder:text-muted focus:outline-none focus:border-accent focus:ring-2 focus:ring-accent/20"
/> />
<div className="flex items-center gap-2"> {/* Quick Prompt Ideas */}
<div className="space-y-1.5">
<span className="text-[11px] font-semibold text-muted font-body">Quick prompt inspiration:</span>
<div className="flex flex-wrap items-center gap-1.5">
{[
'Cinematic 35mm portrait with golden hour rim light',
'Makoto Shinkai anime cityscape under starry skies',
'3D Disney character with luminous amber eyes',
'Hyperrealistic wildlife in lush emerald rain forest'
].map((samplePrompt) => (
<button
key={samplePrompt}
type="button"
onClick={() => setPromptText(samplePrompt)}
className="px-2.5 py-1 rounded-xl bg-paper-2 hover:bg-paper text-ink-2 hover:text-ink text-[11px] font-body border border-rule transition-colors cursor-pointer text-left truncate max-w-full"
>
+ {samplePrompt}
</button>
))}
</div>
</div>
<div className="flex items-center gap-2 pt-1">
<span className="text-xs text-muted font-body">Aspect:</span> <span className="text-xs text-muted font-body">Aspect:</span>
{['1:1', '16:9', '9:16', '4:3'].map((ratio) => ( {['1:1', '16:9', '9:16', '4:3'].map((ratio) => (
<button <button
key={ratio} key={ratio}
type="button" type="button"
onClick={() => setAspectRatio(ratio)} onClick={() => setAspectRatio(ratio)}
className={`px-2.5 py-1 rounded-lg text-xs font-body font-semibold transition-colors cursor-pointer ${ className={`px-3 py-1.5 rounded-xl text-xs font-body font-semibold transition-colors cursor-pointer ${
aspectRatio === ratio aspectRatio === ratio
? 'bg-ink text-paper-hi shadow-xs' ? 'bg-ink text-paper-hi shadow-xs'
: 'bg-paper-2 text-ink-2 hover:bg-paper' : 'bg-paper-2 text-ink-2 hover:bg-paper'
@@ -822,10 +996,11 @@ export function DynamicToolWorkspace({
} }
} }
}} }}
className="w-full py-3 rounded-full bg-ink text-paper-hi text-xs sm:text-sm font-semibold shadow-xs hover:bg-slate-900 transition-colors cursor-pointer flex items-center justify-center gap-2" className="w-full py-4 rounded-2xl bg-accent hover:bg-accent-hi text-white text-sm font-display font-bold shadow-md hover:shadow-lg transition-all cursor-pointer flex items-center justify-center gap-2 group"
> >
<Sparkles className="w-4 h-4 text-accent" /> <Sparkles className="w-4 h-4 text-amber-300 group-hover:rotate-12 transition-transform" />
<span>Open in AI Generation Studio</span> <span>Open in AI Generation Studio</span>
<ArrowRight className="w-4 h-4 text-white" />
</button> </button>
</div> </div>
)} )}
@@ -14,11 +14,14 @@ import {
Maximize2 Maximize2
} from 'lucide-react'; } from 'lucide-react';
import { MaskingConfig, resolveLocalised } from '@/types'; import { MaskingConfig, resolveLocalised } from '@/types';
import { ProcessingOverlay } from './ProcessingOverlay';
interface MaskCanvasEditorProps { interface MaskCanvasEditorProps {
imageUrl: string; imageUrl: string;
config?: MaskingConfig; config?: MaskingConfig;
locale?: string; locale?: string;
isProcessing?: boolean;
toolName?: string;
onMaskChange?: (hasMask: boolean) => void; onMaskChange?: (hasMask: boolean) => void;
onExportReady?: (getMaskBlob: () => Promise<Blob | null>) => void; onExportReady?: (getMaskBlob: () => Promise<Blob | null>) => void;
} }
@@ -27,6 +30,8 @@ export function MaskCanvasEditor({
imageUrl, imageUrl,
config, config,
locale = 'en', locale = 'en',
isProcessing = false,
toolName,
onMaskChange, onMaskChange,
onExportReady, onExportReady,
}: MaskCanvasEditorProps) { }: MaskCanvasEditorProps) {
@@ -520,6 +525,9 @@ export function MaskCanvasEditor({
}} }}
/> />
)} )}
{/* Laser Scanning Processing Animation Overlay */}
{isProcessing && <ProcessingOverlay toolName={toolName || 'Inpainting Model'} />}
</div> </div>
{/* Canvas Helper Hint */} {/* Canvas Helper Hint */}
+140
View File
@@ -0,0 +1,140 @@
'use client';
import React, { useState, useEffect } from 'react';
import { Sparkles, Cpu, Layers, Zap, ShieldCheck } from 'lucide-react';
interface ProcessingOverlayProps {
toolName?: string;
stageMessages?: string[];
aspectRatio?: string;
}
export function ProcessingOverlay({
toolName = 'Neural Vision Model',
stageMessages,
aspectRatio = 'aspect-[4/3] sm:aspect-[16/10]',
}: ProcessingOverlayProps) {
const defaultStages = [
'Initializing volatile GPU tensor core...',
'Analyzing photographic topology & lighting coordinates...',
'Synthesizing generative neural model...',
'Reconstructing sub-pixel micro-details & HD polish...',
'Finalizing crystal-clear preview...',
];
const stages = stageMessages && stageMessages.length > 0 ? stageMessages : defaultStages;
const [currentStageIdx, setCurrentStageIdx] = useState(0);
const [progress, setProgress] = useState(12);
const [elapsedSec, setElapsedSec] = useState(0);
// Smooth elapsed timer
useEffect(() => {
const timer = setInterval(() => {
setElapsedSec((prev) => +(prev + 0.1).toFixed(1));
}, 100);
return () => clearInterval(timer);
}, []);
// Cycle through inference stages & smooth progress curve
useEffect(() => {
const stageInterval = setInterval(() => {
setCurrentStageIdx((prev) => (prev < stages.length - 1 ? prev + 1 : prev));
}, 900);
const progressInterval = setInterval(() => {
setProgress((prev) => {
if (prev >= 94) return 94; // Wait for server resolution
const delta = Math.max(1, Math.floor((95 - prev) * 0.15));
return Math.min(94, prev + delta);
});
}, 150);
return () => {
clearInterval(stageInterval);
clearInterval(progressInterval);
};
}, [stages.length]);
return (
<div className="absolute inset-0 z-30 flex items-center justify-center overflow-hidden rounded-2xl bg-black/60 backdrop-blur-md transition-all duration-300">
{/* 1. Moving Laser Scanning Beam */}
<div className="laser-scanner">
<div className="laser-scanner-line" />
</div>
{/* 2. Cybernetic Vision Grid Overlay */}
<div
className="absolute inset-0 pointer-events-none opacity-20 bg-[linear-gradient(to_right,#38bdf8_1px,transparent_1px),linear-gradient(to_bottom,#38bdf8_1px,transparent_1px)] bg-[size:32px_32px]"
aria-hidden="true"
/>
{/* 3. Corner Targeting Reticles */}
<div className="absolute top-4 left-4 w-7 h-7 border-t-2 border-l-2 border-cyan-400/80 rounded-tl-sm pointer-events-none animate-pulse" />
<div className="absolute top-4 right-4 w-7 h-7 border-t-2 border-r-2 border-cyan-400/80 rounded-tr-sm pointer-events-none animate-pulse" />
<div className="absolute bottom-4 left-4 w-7 h-7 border-b-2 border-l-2 border-cyan-400/80 rounded-bl-sm pointer-events-none animate-pulse" />
<div className="absolute bottom-4 right-4 w-7 h-7 border-b-2 border-r-2 border-cyan-400/80 rounded-br-sm pointer-events-none animate-pulse" />
{/* 4. Central Holographic HUD Card */}
<div className="relative z-30 max-w-sm sm:max-w-md w-11/12 p-6 sm:p-7 rounded-3xl bg-slate-950/85 border border-cyan-500/30 shadow-[0_0_50px_rgba(56,189,248,0.25)] text-center text-white space-y-5 backdrop-blur-xl">
{/* Top Badges */}
<div className="flex items-center justify-between text-[11px] font-mono font-semibold text-cyan-300 border-b border-cyan-500/20 pb-3">
<span className="flex items-center gap-1.5 uppercase tracking-wider">
<Cpu className="w-3.5 h-3.5 text-cyan-400 animate-spin" style={{ animationDuration: '6s' }} />
<span>GPU Tensor Model</span>
</span>
<span className="px-2 py-0.5 rounded-full bg-cyan-950/80 border border-cyan-400/30 text-cyan-300 font-mono">
{elapsedSec.toFixed(1)}s
</span>
</div>
{/* Radar Spinner & Icon */}
<div className="relative w-16 h-16 sm:w-20 sm:h-20 mx-auto flex items-center justify-center">
{/* Outer glowing pulsed ring */}
<div className="absolute inset-0 rounded-full border-2 border-cyan-400/20 animate-ping opacity-30" />
{/* Rotating gradient track */}
<div
className="absolute inset-0 rounded-full border-2 border-t-cyan-400 border-r-indigo-500 border-b-purple-500 border-l-transparent animate-spin"
style={{ animationDuration: '1.2s' }}
/>
{/* Inner pulsating core */}
<div className="w-10 h-10 sm:w-12 sm:h-12 rounded-full bg-gradient-to-tr from-cyan-500 to-indigo-600 flex items-center justify-center shadow-lg shadow-cyan-500/50">
<Sparkles className="w-5 h-5 sm:w-6 sm:h-6 text-white animate-pulse" />
</div>
</div>
{/* Dynamic Stage Title & Progress */}
<div className="space-y-2">
<div className="flex items-center justify-between text-xs font-body font-medium">
<span className="text-white font-semibold flex items-center gap-1.5">
<Zap className="w-3.5 h-3.5 text-amber-400 animate-pulse" />
<span>Processing {toolName}</span>
</span>
<span className="font-mono text-cyan-400 font-bold">{progress}%</span>
</div>
{/* Glowing Animated Progress Bar */}
<div className="w-full h-2 rounded-full bg-slate-900 border border-cyan-500/30 overflow-hidden p-0.5">
<div
className="h-full rounded-full bg-gradient-to-r from-cyan-400 via-indigo-400 to-purple-400 transition-all duration-200 shadow-[0_0_12px_#38bdf8]"
style={{ width: `${progress}%` }}
/>
</div>
{/* Current Step Description */}
<p className="text-xs text-slate-300 font-body min-h-[36px] flex items-center justify-center leading-relaxed animate-fade-in">
{stages[currentStageIdx]}
</p>
</div>
{/* Reassurance Footer */}
<div className="pt-2 border-t border-cyan-500/20 flex items-center justify-center gap-1.5 text-[10px] text-slate-400 font-body">
<ShieldCheck className="w-3.5 h-3.5 text-emerald-400" />
<span>Volatile GPU RAM Execution · Zero Server Storage</span>
</div>
</div>
</div>
);
}
+2 -2
View File
@@ -7,8 +7,8 @@ export async function generateMockNeuralResult(
toolId: string, toolId: string,
variantId?: string variantId?: string
): Promise<{ buffer: Buffer; contentType: string }> { ): Promise<{ buffer: Buffer; contentType: string }> {
// Simulate 350ms neural inference latency // Simulate realistic 1600ms neural inference latency to showcase laser scanning HUD
await new Promise((resolve) => setTimeout(resolve, 350)); await new Promise((resolve) => setTimeout(resolve, 1600));
// If buffer is a small text seed (e.g. text-to-image), create a valid synthetic image buffer // If buffer is a small text seed (e.g. text-to-image), create a valid synthetic image buffer
if (imageBuffer.length < 500) { if (imageBuffer.length < 500) {