feat: scan page redesign — fixed 2x zoom, torch, camera flip, tabs, recents, AI number OCR
- Always-on 2x hardware zoom (CSS scale fallback) - Torch button with toggle + visual feedback - Camera flip (front/back) with settings persistence - 3-tab input panel: Barcode / Name / AI - Recent products chips (last 6 scanned, from localStorage) - Live barcode code overlay during partial detection - Confirm overlay (checkmark + name) on successful scan - AI number OCR (Gemini reads barcode digits from image, shown after 4s) - Guide corners frame in viewport - PHP: gemini_number_ocr action + rate-limited - Translations: new scan.* keys in it/en/de
This commit is contained in:
+242
-100
@@ -1596,39 +1596,35 @@ body.server-offline .bottom-nav {
|
||||
.scan-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
/* — Spesa chip nel page-header — */
|
||||
.scan-spesa-chip {
|
||||
margin-left: auto;
|
||||
padding: 5px 12px;
|
||||
border-radius: 20px;
|
||||
border: 1.5px solid var(--accent);
|
||||
background: rgba(124,58,237,0.08);
|
||||
color: var(--accent);
|
||||
font-size: 0.82rem;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
.scan-spesa-chip:active { background: rgba(124,58,237,0.18); }
|
||||
|
||||
/* — Viewport 16/9 — */
|
||||
.scanner-viewport {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
aspect-ratio: 4/3;
|
||||
aspect-ratio: 16/9;
|
||||
background: #000;
|
||||
border-radius: var(--radius);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.scan-zoom-btn {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
z-index: 20;
|
||||
background: rgba(0,0,0,0.55);
|
||||
color: #fff;
|
||||
border: 1.5px solid rgba(255,255,255,0.5);
|
||||
border-radius: 20px;
|
||||
padding: 5px 13px;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
backdrop-filter: blur(4px);
|
||||
-webkit-backdrop-filter: blur(4px);
|
||||
transition: background 0.15s;
|
||||
}
|
||||
.scan-zoom-btn:active {
|
||||
background: rgba(255,255,255,0.25);
|
||||
}
|
||||
|
||||
.scanner-viewport video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@@ -1637,6 +1633,26 @@ body.server-offline .bottom-nav {
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
/* — Guide frame corners — */
|
||||
.scan-guide-frame {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 11;
|
||||
pointer-events: none;
|
||||
}
|
||||
.sgf-corner {
|
||||
position: absolute;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-color: rgba(255,255,255,0.85);
|
||||
border-style: solid;
|
||||
}
|
||||
.sgf-tl { top: 12px; left: 12px; border-width: 3px 0 0 3px; border-radius: 3px 0 0 0; }
|
||||
.sgf-tr { top: 12px; right: 12px; border-width: 3px 3px 0 0; border-radius: 0 3px 0 0; }
|
||||
.sgf-bl { bottom: 36px; left: 12px; border-width: 0 0 3px 3px; border-radius: 0 0 0 3px; }
|
||||
.sgf-br { bottom: 36px; right: 12px; border-width: 0 3px 3px 0; border-radius: 0 0 3px 0; }
|
||||
|
||||
/* — Scan line — */
|
||||
.scanner-overlay {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
@@ -1647,7 +1663,6 @@ body.server-offline .bottom-nav {
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.scanner-line {
|
||||
width: 100%;
|
||||
height: 3px;
|
||||
@@ -1656,37 +1671,127 @@ body.server-offline .bottom-nav {
|
||||
animation: scanLine 2s ease-in-out infinite;
|
||||
transition: background 0.2s, box-shadow 0.2s, height 0.2s;
|
||||
}
|
||||
|
||||
/* While Quagga is actively scanning frames */
|
||||
.scanner-line.scanning {
|
||||
background: #00c853;
|
||||
box-shadow: 0 0 12px #00c853;
|
||||
animation: scanLineActive 0.8s ease-in-out infinite;
|
||||
}
|
||||
|
||||
/* Barcode partially detected — strong pulse */
|
||||
.scanner-line.detecting {
|
||||
background: #ffd600;
|
||||
box-shadow: 0 0 20px #ffd600, 0 0 40px rgba(255,214,0,0.4);
|
||||
height: 5px;
|
||||
animation: scanLineDetect 0.3s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes scanLine {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.3; }
|
||||
}
|
||||
|
||||
@keyframes scanLineActive {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.5; }
|
||||
}
|
||||
|
||||
@keyframes scanLineDetect {
|
||||
0%, 100% { opacity: 1; transform: scaleY(1); }
|
||||
50% { opacity: 0.7; transform: scaleY(2); }
|
||||
}
|
||||
|
||||
/* — Live partial code — */
|
||||
.scan-live-code {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, calc(-50% - 14px));
|
||||
z-index: 12;
|
||||
background: rgba(0,0,0,0.65);
|
||||
color: #ffd600;
|
||||
font-family: monospace;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 2px;
|
||||
padding: 4px 12px;
|
||||
border-radius: 8px;
|
||||
pointer-events: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* — Success confirm overlay — */
|
||||
.scan-confirm-overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 20;
|
||||
background: rgba(0,180,80,0.82);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
border-radius: var(--radius);
|
||||
animation: scanConfirmFade 0.12s ease-in;
|
||||
}
|
||||
@keyframes scanConfirmFade {
|
||||
from { opacity: 0; transform: scale(0.94); }
|
||||
to { opacity: 1; transform: scale(1); }
|
||||
}
|
||||
.scan-confirm-check {
|
||||
font-size: 2.8rem;
|
||||
color: #fff;
|
||||
line-height: 1;
|
||||
}
|
||||
.scan-confirm-name {
|
||||
font-size: 0.92rem;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
padding: 0 16px;
|
||||
max-width: 100%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* — Viewport overlay controls (torch / zoom / flip) — */
|
||||
.scan-viewport-controls {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 15;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 6px 10px;
|
||||
background: linear-gradient(transparent, rgba(0,0,0,0.55));
|
||||
}
|
||||
.scan-ctrl-btn {
|
||||
background: rgba(255,255,255,0.15);
|
||||
border: 1.5px solid rgba(255,255,255,0.45);
|
||||
border-radius: 50%;
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
font-size: 1.1rem;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background 0.15s;
|
||||
backdrop-filter: blur(4px);
|
||||
-webkit-backdrop-filter: blur(4px);
|
||||
}
|
||||
.scan-ctrl-btn:active { background: rgba(255,255,255,0.35); }
|
||||
.scan-ctrl-btn.torch-on { background: rgba(255,220,0,0.35); border-color: #ffd600; }
|
||||
.scan-zoom-badge {
|
||||
background: rgba(0,0,0,0.55);
|
||||
color: #fff;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 800;
|
||||
padding: 4px 10px;
|
||||
border-radius: 14px;
|
||||
border: 1.5px solid rgba(255,255,255,0.4);
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
/* — Scan result errors — */
|
||||
.scan-result {
|
||||
background: var(--bg-card);
|
||||
border-radius: var(--radius);
|
||||
@@ -1694,64 +1799,126 @@ body.server-offline .bottom-nav {
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.scan-actions {
|
||||
/* — Recent scans — */
|
||||
.scan-recents {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.barcode-manual-entry {
|
||||
margin-bottom: 12px;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.scan-recents-label {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
color: var(--text-muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.scan-recents-chips {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
flex: 1;
|
||||
}
|
||||
.scan-recents-chips::-webkit-scrollbar { display: none; }
|
||||
.scan-recent-chip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 5px 10px;
|
||||
background: var(--bg-card);
|
||||
border-radius: 20px;
|
||||
border: 1px solid var(--border);
|
||||
font-size: 0.78rem;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
box-shadow: var(--shadow);
|
||||
transition: background 0.12s, transform 0.1s;
|
||||
}
|
||||
.scan-recent-chip:active { background: var(--bg-main); transform: scale(0.96); }
|
||||
.scan-recent-chip-icon { font-size: 1rem; }
|
||||
|
||||
/* — Input panel (bottom card) — */
|
||||
.scan-input-panel {
|
||||
background: var(--bg-card);
|
||||
border-radius: var(--radius);
|
||||
box-shadow: var(--shadow);
|
||||
overflow: hidden;
|
||||
}
|
||||
.scan-input-tabs {
|
||||
display: flex;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.scan-input-tab {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 5px;
|
||||
padding: 10px 6px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
font-size: 0.82rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
transition: color 0.15s, background 0.15s;
|
||||
border-bottom: 2px solid transparent;
|
||||
margin-bottom: -1px;
|
||||
}
|
||||
.scan-input-tab.active {
|
||||
color: var(--accent);
|
||||
border-bottom-color: var(--accent);
|
||||
background: rgba(124,58,237,0.05);
|
||||
}
|
||||
.scan-tab-content {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
/* — Barcode input row — */
|
||||
.barcode-input-row {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.barcode-input-row .form-input {
|
||||
flex: 1;
|
||||
margin: 0;
|
||||
font-size: 1.1rem;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.barcode-input-row .btn {
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.quick-name-entry {
|
||||
margin-bottom: 12px;
|
||||
/* — AI tab buttons — */
|
||||
.scan-ai-tab-btns {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.scan-ai-tab-btns .btn { width: 100%; }
|
||||
|
||||
.quick-name-divider {
|
||||
text-align: center;
|
||||
margin: 10px 0 8px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.quick-name-divider::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 1px;
|
||||
background: var(--border);
|
||||
}
|
||||
|
||||
.quick-name-divider span {
|
||||
background: var(--bg-main);
|
||||
padding: 0 12px;
|
||||
position: relative;
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
/* — AI number OCR fallback button — */
|
||||
.scan-num-ocr-btn {
|
||||
width: 100%;
|
||||
margin-top: 8px;
|
||||
background: rgba(124,58,237,0.08);
|
||||
border: 1.5px dashed var(--accent);
|
||||
color: var(--accent);
|
||||
font-size: 0.88rem;
|
||||
padding: 9px;
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
.scan-num-ocr-btn:active { background: rgba(124,58,237,0.18); }
|
||||
|
||||
/* — Quick name results (dropdown inside name tab) — */
|
||||
.quick-name-results {
|
||||
margin-top: 8px;
|
||||
display: flex;
|
||||
@@ -1760,56 +1927,31 @@ body.server-offline .bottom-nav {
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.quick-name-result-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 10px 12px;
|
||||
background: var(--bg-card);
|
||||
border-radius: var(--radius);
|
||||
box-shadow: var(--shadow);
|
||||
background: var(--bg-main);
|
||||
border-radius: calc(var(--radius) - 2px);
|
||||
border: 1px solid var(--border);
|
||||
cursor: pointer;
|
||||
transition: transform 0.1s;
|
||||
}
|
||||
|
||||
.quick-name-result-item:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.quick-name-result-item .qnr-icon {
|
||||
font-size: 1.5rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.quick-name-result-item .qnr-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.quick-name-result-item:active { transform: scale(0.98); }
|
||||
.quick-name-result-item .qnr-icon { font-size: 1.4rem; flex-shrink: 0; }
|
||||
.quick-name-result-item .qnr-info { flex: 1; min-width: 0; }
|
||||
.quick-name-result-item .qnr-name {
|
||||
font-weight: 600;
|
||||
font-size: 0.95rem;
|
||||
font-size: 0.92rem;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.quick-name-result-item .qnr-detail {
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.quick-name-result-item .qnr-detail { font-size: 0.78rem; color: var(--text-muted); }
|
||||
.quick-name-result-item.qnr-new {
|
||||
border: 1px dashed var(--accent);
|
||||
background: rgba(124, 58, 237, 0.06);
|
||||
}
|
||||
|
||||
.scan-hint {
|
||||
text-align: center;
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-muted);
|
||||
margin-top: 4px;
|
||||
background: rgba(124,58,237,0.05);
|
||||
}
|
||||
|
||||
/* ===== SHOPPING LIST (BRING!) ===== */
|
||||
|
||||
Reference in New Issue
Block a user