Spaces:
Runtime error
Runtime error
Khunndev Sisyphus commited on
Commit ·
13ef64d
1
Parent(s): bb3304c
Polish the crop and preview screens with type presets and mono dimension readouts.
Browse filesUltraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
frontend/src/components/StepCrop.tsx
CHANGED
|
@@ -152,19 +152,35 @@ export function StepCrop({
|
|
| 152 |
return (
|
| 153 |
<div className="flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--bg)]">
|
| 154 |
<div className="flex items-center justify-between px-4 py-2.5">
|
| 155 |
-
<button
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
<ChevronLeft size={16} strokeWidth={2.5} />
|
| 157 |
{t(lang, 'previewBack')}
|
| 158 |
</button>
|
| 159 |
-
<p
|
| 160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
</div>
|
| 162 |
|
| 163 |
-
<p
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
|
| 165 |
<div
|
| 166 |
ref={containerRef}
|
| 167 |
-
className="relative mx-4 min-h-0 flex-1 overflow-hidden rounded-2xl border border-[var(--hairline)] bg-black shadow-[var(--shadow-
|
|
|
|
| 168 |
>
|
| 169 |
<img src={imageSrc} alt="" className="absolute inset-0 h-full w-full object-contain" draggable={false} />
|
| 170 |
|
|
@@ -234,7 +250,7 @@ export function StepCrop({
|
|
| 234 |
return (
|
| 235 |
<div
|
| 236 |
key={corner}
|
| 237 |
-
className={`absolute h-5 w-5 rounded-full border-2 border-white bg-[var(--brand)] shadow ${pos}`}
|
| 238 |
onPointerDown={handleCorner(corner)}
|
| 239 |
/>
|
| 240 |
)
|
|
@@ -244,13 +260,16 @@ export function StepCrop({
|
|
| 244 |
)}
|
| 245 |
</div>
|
| 246 |
|
| 247 |
-
<p
|
|
|
|
|
|
|
|
|
|
| 248 |
{Math.round(crop.width)} × {Math.round(crop.height)}
|
| 249 |
</p>
|
| 250 |
|
| 251 |
<div
|
| 252 |
-
className="mt-3 shrink-0 space-y-2 border-t border-[var(--hairline)] bg-[var(--header-bg)] px-4 pt-3"
|
| 253 |
-
style={{ paddingBottom: 'max(1rem, env(safe-area-inset-bottom))' }}
|
| 254 |
>
|
| 255 |
<button
|
| 256 |
type="button"
|
|
|
|
| 152 |
return (
|
| 153 |
<div className="flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--bg)]">
|
| 154 |
<div className="flex items-center justify-between px-4 py-2.5">
|
| 155 |
+
<button
|
| 156 |
+
type="button"
|
| 157 |
+
className="ct-btn-ghost rise-enter flex h-9 items-center gap-1 px-3 text-sm"
|
| 158 |
+
style={{ animationDelay: '0.04s' }}
|
| 159 |
+
onClick={onBack}
|
| 160 |
+
>
|
| 161 |
<ChevronLeft size={16} strokeWidth={2.5} />
|
| 162 |
{t(lang, 'previewBack')}
|
| 163 |
</button>
|
| 164 |
+
<p
|
| 165 |
+
className="rise-enter text-[var(--text)]"
|
| 166 |
+
style={{ font: 'var(--type-h3)', animationDelay: '0.08s' }}
|
| 167 |
+
>
|
| 168 |
+
{t(lang, 'cropTitle')}
|
| 169 |
+
</p>
|
| 170 |
+
<div className="rise-enter w-16" style={{ animationDelay: '0.08s' }} />
|
| 171 |
</div>
|
| 172 |
|
| 173 |
+
<p
|
| 174 |
+
className="rise-enter px-4 pb-2 text-center text-xs text-[var(--text-dim)]"
|
| 175 |
+
style={{ animationDelay: '0.12s' }}
|
| 176 |
+
>
|
| 177 |
+
{t(lang, 'cropHint')}
|
| 178 |
+
</p>
|
| 179 |
|
| 180 |
<div
|
| 181 |
ref={containerRef}
|
| 182 |
+
className="rise-enter relative mx-4 min-h-0 flex-1 overflow-hidden rounded-2xl border border-[var(--hairline)] bg-black shadow-[var(--shadow-lg)]"
|
| 183 |
+
style={{ animationDelay: '0.16s' }}
|
| 184 |
>
|
| 185 |
<img src={imageSrc} alt="" className="absolute inset-0 h-full w-full object-contain" draggable={false} />
|
| 186 |
|
|
|
|
| 250 |
return (
|
| 251 |
<div
|
| 252 |
key={corner}
|
| 253 |
+
className={`absolute h-5 w-5 rounded-full border-2 border-white bg-[var(--brand)] shadow-[var(--shadow-md)] transition-transform duration-150 will-change-transform hover:scale-110 active:scale-95 ${pos}`}
|
| 254 |
onPointerDown={handleCorner(corner)}
|
| 255 |
/>
|
| 256 |
)
|
|
|
|
| 260 |
)}
|
| 261 |
</div>
|
| 262 |
|
| 263 |
+
<p
|
| 264 |
+
className="rise-enter mt-2 text-center text-[11px] tabular-nums text-[var(--text-faint)]"
|
| 265 |
+
style={{ fontFamily: 'var(--font-mono)', animationDelay: '0.2s' }}
|
| 266 |
+
>
|
| 267 |
{Math.round(crop.width)} × {Math.round(crop.height)}
|
| 268 |
</p>
|
| 269 |
|
| 270 |
<div
|
| 271 |
+
className="rise-enter mt-3 shrink-0 space-y-2 border-t border-[var(--hairline)] bg-[var(--header-bg)] px-4 pt-3 shadow-[0_-4px_24px_rgba(15,23,42,0.06)]"
|
| 272 |
+
style={{ paddingBottom: 'max(1rem, env(safe-area-inset-bottom))', animationDelay: '0.24s' }}
|
| 273 |
>
|
| 274 |
<button
|
| 275 |
type="button"
|
frontend/src/components/StepPreview.tsx
CHANGED
|
@@ -31,12 +31,17 @@ export function StepPreview({
|
|
| 31 |
return (
|
| 32 |
<div className="flex flex-1 flex-col overflow-hidden bg-[var(--bg)]">
|
| 33 |
<div className="flex items-center justify-between px-4 py-2.5">
|
| 34 |
-
<button
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
<ChevronLeft size={16} strokeWidth={2.5} />
|
| 36 |
{t(lang, 'previewBack')}
|
| 37 |
</button>
|
| 38 |
|
| 39 |
-
<div className="flex gap-2">
|
| 40 |
<button type="button" className="ct-btn-ghost h-9 w-9" onClick={onRetake} aria-label={t(lang, 'retake')}>
|
| 41 |
<Camera size={17} />
|
| 42 |
</button>
|
|
@@ -48,20 +53,23 @@ export function StepPreview({
|
|
| 48 |
|
| 49 |
<div className="flex flex-1 flex-col px-4">
|
| 50 |
<div
|
| 51 |
-
className="overflow-hidden rounded-2xl border border-[var(--hairline)] bg-black shadow-[var(--shadow-
|
| 52 |
-
style={{ flex: '1 1 auto', minHeight: '40vh', maxHeight: `${maxPreviewH}vh` }}
|
| 53 |
>
|
| 54 |
<img src={imageSrc} alt="Preview" className="h-full w-full object-contain" />
|
| 55 |
</div>
|
| 56 |
|
| 57 |
-
<p
|
|
|
|
|
|
|
|
|
|
| 58 |
{imageDims.w} × {imageDims.h}
|
| 59 |
</p>
|
| 60 |
</div>
|
| 61 |
|
| 62 |
<div
|
| 63 |
-
className="shrink-0 border-t border-[var(--hairline)] bg-[var(--header-bg)] px-4 pt-3"
|
| 64 |
-
style={{ paddingBottom: 'max(1rem, env(safe-area-inset-bottom))' }}
|
| 65 |
>
|
| 66 |
<div className="mx-auto w-full max-w-sm">
|
| 67 |
<button
|
|
|
|
| 31 |
return (
|
| 32 |
<div className="flex flex-1 flex-col overflow-hidden bg-[var(--bg)]">
|
| 33 |
<div className="flex items-center justify-between px-4 py-2.5">
|
| 34 |
+
<button
|
| 35 |
+
type="button"
|
| 36 |
+
className="ct-btn-ghost rise-enter flex h-9 items-center gap-1 px-3 text-sm"
|
| 37 |
+
style={{ animationDelay: '0.04s' }}
|
| 38 |
+
onClick={onBack}
|
| 39 |
+
>
|
| 40 |
<ChevronLeft size={16} strokeWidth={2.5} />
|
| 41 |
{t(lang, 'previewBack')}
|
| 42 |
</button>
|
| 43 |
|
| 44 |
+
<div className="rise-enter flex gap-2" style={{ animationDelay: '0.1s' }}>
|
| 45 |
<button type="button" className="ct-btn-ghost h-9 w-9" onClick={onRetake} aria-label={t(lang, 'retake')}>
|
| 46 |
<Camera size={17} />
|
| 47 |
</button>
|
|
|
|
| 53 |
|
| 54 |
<div className="flex flex-1 flex-col px-4">
|
| 55 |
<div
|
| 56 |
+
className="rise-enter overflow-hidden rounded-2xl border border-[var(--hairline)] bg-black shadow-[var(--shadow-lg)] ring-1 ring-black/5"
|
| 57 |
+
style={{ flex: '1 1 auto', minHeight: '40vh', maxHeight: `${maxPreviewH}vh`, animationDelay: '0.16s' }}
|
| 58 |
>
|
| 59 |
<img src={imageSrc} alt="Preview" className="h-full w-full object-contain" />
|
| 60 |
</div>
|
| 61 |
|
| 62 |
+
<p
|
| 63 |
+
className="rise-enter mt-2 text-center text-[11px] tabular-nums text-[var(--text-faint)]"
|
| 64 |
+
style={{ fontFamily: 'var(--font-mono)', animationDelay: '0.22s' }}
|
| 65 |
+
>
|
| 66 |
{imageDims.w} × {imageDims.h}
|
| 67 |
</p>
|
| 68 |
</div>
|
| 69 |
|
| 70 |
<div
|
| 71 |
+
className="rise-enter shrink-0 border-t border-[var(--hairline)] bg-[var(--header-bg)] px-4 pt-3 shadow-[0_-4px_24px_rgba(15,23,42,0.06)]"
|
| 72 |
+
style={{ paddingBottom: 'max(1rem, env(safe-area-inset-bottom))', animationDelay: '0.28s' }}
|
| 73 |
>
|
| 74 |
<div className="mx-auto w-full max-w-sm">
|
| 75 |
<button
|