fix(studio): replace geeky processing animation with porcelain studio theme and fix zoomed-in result comparison
This commit is contained in:
@@ -89,6 +89,7 @@ export function DynamicToolWorkspace({
|
||||
// Inference Execution State
|
||||
const [status, setStatus] = useState<'idle' | 'processing' | 'success' | 'error' | 'limit'>('idle');
|
||||
const [resultUrl, setResultUrl] = useState<string | null>(null);
|
||||
const [comparisonBeforeUrl, setComparisonBeforeUrl] = useState<string | null>(null);
|
||||
const [errorMessage, setErrorMessage] = useState<string>('');
|
||||
const [remainingTries, setRemainingTries] = useState<number>(tool.tryIt?.limits?.perDay || 5);
|
||||
|
||||
@@ -210,8 +211,11 @@ export function DynamicToolWorkspace({
|
||||
}
|
||||
|
||||
if (fileToSend) {
|
||||
const compUrl = URL.createObjectURL(fileToSend);
|
||||
setComparisonBeforeUrl(compUrl);
|
||||
formData.append(imageParamName, fileToSend, 'photo.jpg');
|
||||
} else if (primaryPreview) {
|
||||
setComparisonBeforeUrl(primaryPreview);
|
||||
const res = await fetch(primaryPreview);
|
||||
const blob = await res.blob();
|
||||
formData.append(imageParamName, blob, 'sample.jpg');
|
||||
@@ -309,6 +313,7 @@ export function DynamicToolWorkspace({
|
||||
setSecondaryFile(null);
|
||||
setSecondaryPreview(null);
|
||||
setResultUrl(null);
|
||||
setComparisonBeforeUrl(null);
|
||||
setStatus('idle');
|
||||
setErrorMessage('');
|
||||
if (fileInputRef.current) fileInputRef.current.value = '';
|
||||
@@ -407,12 +412,13 @@ export function DynamicToolWorkspace({
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="aspect-[4/3] sm:aspect-[16/10] max-h-[580px] w-full rounded-2xl overflow-hidden bg-paper-2 border border-rule">
|
||||
<div className="w-full flex items-center justify-center p-3 sm:p-5 rounded-2xl bg-paper-2/60 border border-rule overflow-hidden">
|
||||
<CardBeforeAfterSlider
|
||||
beforeUrl={primaryPreview || primaryExample.before}
|
||||
beforeUrl={comparisonBeforeUrl || primaryPreview || primaryExample.before}
|
||||
afterUrl={resultUrl}
|
||||
title={toolName}
|
||||
aspectRatio="aspect-auto h-full"
|
||||
aspectRatio="aspect-auto"
|
||||
objectFit="contain"
|
||||
beforeLabel="ORIGINAL"
|
||||
afterLabel="RESULT"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user