ScanPage UI improvment
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
<script>
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { onDestroy } from 'svelte';
|
||||
import { processImage, createBlobUrl, downloadBlob } from '$lib/common/services/scan.service.js';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
let { onBack = () => {} } = $props();
|
||||
|
||||
/** @type {'upload' | 'unwrapping' | 'unwrapped' | 'deblurring' | 'deblurred' | 'correcting' | 'corrected'} */
|
||||
let stage = $state('upload');
|
||||
@ -16,7 +16,7 @@
|
||||
if (currentBlobUrl) {
|
||||
URL.revokeObjectURL(currentBlobUrl);
|
||||
}
|
||||
dispatch('back');
|
||||
onBack();
|
||||
}
|
||||
|
||||
async function handleFileSelect(event) {
|
||||
@ -109,8 +109,6 @@
|
||||
fileName = '';
|
||||
}
|
||||
|
||||
// Cleanup on unmount
|
||||
import { onDestroy } from 'svelte';
|
||||
onDestroy(() => {
|
||||
if (currentBlobUrl) {
|
||||
URL.revokeObjectURL(currentBlobUrl);
|
||||
@ -119,13 +117,8 @@
|
||||
</script>
|
||||
|
||||
<div class="scan-page">
|
||||
<header class="scan-header">
|
||||
<button class="back-button" onclick={handleBack}>
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M19 12H5M12 19l-7-7 7-7"/>
|
||||
</svg>
|
||||
Назад
|
||||
</button>
|
||||
<header class="header">
|
||||
<button class="back-btn" onclick={handleBack}>←</button>
|
||||
<h1>Сканирование документов</h1>
|
||||
</header>
|
||||
|
||||
@ -171,9 +164,7 @@
|
||||
</div>
|
||||
{:else}
|
||||
<div class="preview-area">
|
||||
<div class="preview-container">
|
||||
<img src={currentBlobUrl} alt="Обработанный документ" />
|
||||
</div>
|
||||
<img src={currentBlobUrl} alt="Обработанный документ" class="preview-img" />
|
||||
|
||||
<div class="preview-actions">
|
||||
{#if stage === 'unwrapped'}
|
||||
@ -254,49 +245,46 @@
|
||||
<style>
|
||||
.scan-page {
|
||||
width: 100%;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.scan-header {
|
||||
min-height: 100dvh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
margin-bottom: 40px;
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.back-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 16px;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: 8px;
|
||||
flex-direction: column;
|
||||
background: radial-gradient(120% 60% at 50% -10%, rgba(99, 102, 241, 0.18) 0%, transparent 60%);
|
||||
font-family: system-ui, -apple-system, sans-serif;
|
||||
color: #f5f7fa;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.back-button:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-color: rgba(255, 255, 255, 0.2);
|
||||
.header {
|
||||
padding: 24px 20px 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.scan-header h1 {
|
||||
margin: 0;
|
||||
font-size: 32px;
|
||||
.back-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
color: #6366f1;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: #f5f7fa;
|
||||
cursor: pointer;
|
||||
padding: 8px 4px;
|
||||
margin-right: auto;
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
margin: 0;
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.scan-content {
|
||||
flex: 1;
|
||||
padding: 24px 20px 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24px;
|
||||
@ -394,31 +382,23 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 32px;
|
||||
}
|
||||
|
||||
.preview-container {
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: 16px;
|
||||
padding: 24px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
.preview-container img {
|
||||
.preview-img {
|
||||
max-width: 100%;
|
||||
max-height: 600px;
|
||||
border-radius: 8px;
|
||||
display: block;
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.preview-actions {
|
||||
width: 100%;
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: 16px;
|
||||
padding: 32px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.action-group {
|
||||
@ -514,18 +494,12 @@
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.scan-page {
|
||||
padding: 12px;
|
||||
.scan-content {
|
||||
padding: 16px 12px;
|
||||
}
|
||||
|
||||
.scan-header {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.scan-header h1 {
|
||||
font-size: 24px;
|
||||
.header h1 {
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.upload-area,
|
||||
|
||||
Reference in New Issue
Block a user