2026-09-01 20:50:42 +03:00
|
|
|
<script>
|
2026-09-18 03:07:25 +03:00
|
|
|
import { onMount } from 'svelte';
|
|
|
|
|
|
2026-09-01 20:50:42 +03:00
|
|
|
/** @type {Array<{ id: 'print' | 'scan' | 'photo' | 'access', label: string, grad: string, glow: string, icon: string }>} */
|
|
|
|
|
const actions = [
|
|
|
|
|
{
|
|
|
|
|
id: 'print',
|
|
|
|
|
label: 'Печать',
|
|
|
|
|
grad: 'linear-gradient(135deg, #5b8cff 0%, #38c6ff 100%)',
|
|
|
|
|
glow: 'rgba(72, 150, 255, 0.45)',
|
|
|
|
|
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 6 2 18 2 18 9"></polyline><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"></path><rect x="6" y="14" width="12" height="8"></rect></svg>'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'scan',
|
|
|
|
|
label: 'Скан',
|
|
|
|
|
grad: 'linear-gradient(135deg, #34d399 0%, #2dd4bf 100%)',
|
|
|
|
|
glow: 'rgba(52, 211, 153, 0.45)',
|
|
|
|
|
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7V5a2 2 0 0 1 2-2h2"></path><path d="M17 3h2a2 2 0 0 1 2 2v2"></path><path d="M21 17v2a2 2 0 0 1-2 2h-2"></path><path d="M7 21H5a2 2 0 0 1-2-2v-2"></path><line x1="7" y1="12" x2="17" y2="12"></line></svg>'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'photo',
|
|
|
|
|
label: 'Фото на документ',
|
|
|
|
|
grad: 'linear-gradient(135deg, #ffb457 0%, #ff8a5c 100%)',
|
|
|
|
|
glow: 'rgba(255, 150, 90, 0.45)',
|
|
|
|
|
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="4" width="20" height="16" rx="2"></rect><circle cx="8" cy="11" r="3"></circle><path d="M14 10h4"></path><path d="M14 14h4"></path><path d="M4 19c0-2 2-3 4-3s4 1 4 3"></path></svg>'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'access',
|
|
|
|
|
label: 'Дополнительно',
|
|
|
|
|
grad: 'linear-gradient(135deg, #a78bfa 0%, #f472b6 100%)',
|
|
|
|
|
glow: 'rgba(167, 139, 250, 0.45)',
|
|
|
|
|
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="4" r="2"></circle><path d="M12 6v6"></path><path d="M12 12l-4 8"></path><path d="M12 12l4 8"></path><path d="M6 10h12"></path></svg>'
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
2026-09-18 03:07:25 +03:00
|
|
|
/**
|
|
|
|
|
* @type {{ onAction?: (id: 'print' | 'scan' | 'photo' | 'access') => void }}
|
|
|
|
|
*/
|
|
|
|
|
let { onAction = (id) => {
|
2026-09-01 20:50:42 +03:00
|
|
|
console.log('Выбрано действие:', id);
|
2026-09-18 03:07:25 +03:00
|
|
|
} } = $props();
|
|
|
|
|
|
|
|
|
|
let backendVersion = $state('—');
|
|
|
|
|
|
|
|
|
|
onMount(async () => {
|
|
|
|
|
try {
|
|
|
|
|
const res = await fetch('/api/version');
|
|
|
|
|
if (!res.ok) throw new Error('HTTP ' + res.status);
|
|
|
|
|
const text = await res.text();
|
|
|
|
|
try {
|
|
|
|
|
const json = JSON.parse(text);
|
|
|
|
|
backendVersion = json.version ?? json.data ?? text;
|
|
|
|
|
} catch {
|
|
|
|
|
backendVersion = text;
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
backendVersion = 'offline';
|
|
|
|
|
}
|
|
|
|
|
});
|
2026-09-01 20:50:42 +03:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<div class="menu-container">
|
|
|
|
|
<div class="content">
|
|
|
|
|
<header class="header">
|
|
|
|
|
<h1>Сервисы</h1>
|
|
|
|
|
<p>Выберите действие</p>
|
|
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
<main class="grid">
|
|
|
|
|
{#each actions as a}
|
|
|
|
|
<button
|
|
|
|
|
class="card"
|
|
|
|
|
style="--grad: {a.grad}; --glow: {a.glow}"
|
|
|
|
|
onclick={() => onAction(a.id)}
|
|
|
|
|
>
|
|
|
|
|
<span class="icon" aria-hidden="true">{@html a.icon}</span>
|
|
|
|
|
<span class="label">{a.label}</span>
|
|
|
|
|
</button>
|
|
|
|
|
{/each}
|
|
|
|
|
</main>
|
|
|
|
|
|
|
|
|
|
<footer class="footer">
|
|
|
|
|
<div class="home-bar"></div>
|
|
|
|
|
</footer>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
.menu-container {
|
|
|
|
|
width: 100%;
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
min-height: 100dvh;
|
|
|
|
|
padding: 28px 20px 10px;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
background: radial-gradient(120% 60% at 50% -10%, rgba(99, 102, 241, 0.18) 0%, transparent 60%);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.header {
|
|
|
|
|
margin: 4px 4px 26px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.header h1 {
|
|
|
|
|
margin: 0 0 6px;
|
|
|
|
|
font-size: 30px;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
letter-spacing: -0.02em;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.header p {
|
|
|
|
|
margin: 0;
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
color: #8b93a1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.grid {
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
|
gap: 14px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.card {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 14px;
|
|
|
|
|
padding: 26px 12px 22px;
|
|
|
|
|
border-radius: 22px;
|
|
|
|
|
background: rgba(255, 255, 255, 0.05);
|
|
|
|
|
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
|
|
|
backdrop-filter: blur(12px);
|
|
|
|
|
-webkit-backdrop-filter: blur(12px);
|
|
|
|
|
color: #f5f7fa;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
|
|
|
|
|
-webkit-tap-highlight-color: transparent;
|
|
|
|
|
touch-action: manipulation;
|
|
|
|
|
user-select: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media (hover: hover) {
|
|
|
|
|
.card:hover {
|
|
|
|
|
transform: translateY(-3px);
|
|
|
|
|
border-color: rgba(255, 255, 255, 0.18);
|
|
|
|
|
background: rgba(255, 255, 255, 0.08);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.card:active {
|
|
|
|
|
transform: scale(0.96);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
|
width: 58px;
|
|
|
|
|
height: 58px;
|
|
|
|
|
border-radius: 18px;
|
|
|
|
|
display: grid;
|
|
|
|
|
place-items: center;
|
|
|
|
|
background: var(--grad);
|
|
|
|
|
color: #fff;
|
|
|
|
|
box-shadow: 0 10px 22px -8px var(--glow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.label {
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
line-height: 1.35;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.footer {
|
|
|
|
|
margin-top: auto;
|
|
|
|
|
padding: 32px 0 8px;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.home-bar {
|
|
|
|
|
width: 120px;
|
|
|
|
|
height: 5px;
|
|
|
|
|
border-radius: 999px;
|
|
|
|
|
background: rgba(255, 255, 255, 0.22);
|
|
|
|
|
}
|
2026-09-18 03:07:25 +03:00
|
|
|
|
|
|
|
|
.version {
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 8px;
|
|
|
|
|
left: 8px;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 2px;
|
|
|
|
|
font-size: 8px;
|
|
|
|
|
line-height: 1.1;
|
|
|
|
|
color: rgba(245, 247, 250, 0.35);
|
|
|
|
|
user-select: none;
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
z-index: 10;
|
|
|
|
|
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.version span:first-child {
|
|
|
|
|
color: rgba(245, 247, 250, 0.25);
|
|
|
|
|
}
|
2026-09-01 20:50:42 +03:00
|
|
|
</style>
|
2026-09-18 03:07:25 +03:00
|
|
|
|
|
|
|
|
<div class="version">
|
|
|
|
|
<span>v{backendVersion}</span>
|
2026-09-19 15:54:26 +03:00
|
|
|
<span>v1.0.9</span>
|
2026-09-18 03:07:25 +03:00
|
|
|
</div>
|