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