import { LinearGradient } from 'expo-linear-gradient'; import { useRouter } from 'expo-router'; import { useState } from 'react'; import { Pressable, StyleSheet, Text, View } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { FlashIcon, GalleryIcon } from '../src/components/Icons'; import { colors, font, radius } from '../src/theme'; const TOTAL_PAGES = 2; /** * Camera / scan, design option 3a. The viewfinder is mocked — a paper stand-in * under the detection frame — so the flow is navigable without camera * permissions. Swapping in expo-camera means replacing only. */ export default function Scan() { const router = useRouter(); const insets = useSafeAreaInsets(); const [page, setPage] = useState(1); const capture = () => { if (page < TOTAL_PAGES) setPage(page + 1); else router.back(); }; return ( router.back()} accessibilityRole="button" accessibilityLabel="Scannen abbrechen" > Brief scannen Brief erkannt – halt still Tipp: Leg den Brief auf einen dunklen Tisch [styles.shutter, pressed && styles.shutterPressed]} onPress={capture} accessibilityRole="button" accessibilityLabel={`Seite ${page} von ${TOTAL_PAGES} aufnehmen`} > {page}/{TOTAL_PAGES} ); } const styles = StyleSheet.create({ screen: { flex: 1, backgroundColor: colors.night }, header: { flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 24, paddingTop: 16, }, headerButton: { width: 36, height: 36, borderRadius: 18, backgroundColor: 'rgba(255,255,255,0.12)', alignItems: 'center', justifyContent: 'center', }, close: { fontSize: 15, color: colors.onBlue }, headerTitle: { flex: 1, textAlign: 'center', fontFamily: font.display, fontSize: 16, color: colors.onBlue, }, viewfinder: { flex: 1, marginHorizontal: 20, marginVertical: 18, borderRadius: radius['3xl'], overflow: 'hidden', alignItems: 'center', justifyContent: 'center', }, paper: { width: 240, height: 330, backgroundColor: colors.paper, borderRadius: radius.sm, paddingVertical: 24, paddingHorizontal: 20, transform: [{ rotate: '-1.5deg' }], shadowColor: '#000', shadowOpacity: 0.4, shadowRadius: 32, shadowOffset: { width: 0, height: 12 }, elevation: 12, }, paperBody: { marginTop: 28, gap: 7 }, paperLine: { height: 6, borderRadius: 3, backgroundColor: colors.paperInk }, paperLineStrong: { height: 8, borderRadius: 4, backgroundColor: colors.paperInkStrong }, frame: { position: 'absolute', width: 272, height: 362 }, corner: { position: 'absolute', width: 34, height: 34, borderColor: colors.blueBright }, cornerTL: { top: 0, left: 0, borderTopWidth: 4, borderLeftWidth: 4, borderTopLeftRadius: 10 }, cornerTR: { top: 0, right: 0, borderTopWidth: 4, borderRightWidth: 4, borderTopRightRadius: 10 }, cornerBL: { bottom: 0, left: 0, borderBottomWidth: 4, borderLeftWidth: 4, borderBottomLeftRadius: 10, }, cornerBR: { bottom: 0, right: 0, borderBottomWidth: 4, borderRightWidth: 4, borderBottomRightRadius: 10, }, status: { position: 'absolute', top: 16, flexDirection: 'row', alignItems: 'center', gap: 8, backgroundColor: 'rgba(20,27,46,0.75)', borderRadius: radius.pill, paddingVertical: 8, paddingHorizontal: 16, }, statusDot: { width: 8, height: 8, borderRadius: 4, backgroundColor: colors.green }, statusText: { fontFamily: font.extrabold, fontSize: 12.5, color: colors.onBlue }, tip: { position: 'absolute', bottom: 16, fontFamily: font.semibold, fontSize: 12.5, color: 'rgba(242,246,254,0.75)', }, controls: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 44, }, controlButton: { width: 48, height: 48, borderRadius: radius.md, backgroundColor: 'rgba(255,255,255,0.12)', alignItems: 'center', justifyContent: 'center', }, pageCount: { fontFamily: font.extrabold, fontSize: 11, color: colors.onBlue }, shutter: { width: 76, height: 76, borderRadius: 38, backgroundColor: colors.blue, borderWidth: 5, borderColor: 'rgba(255,255,255,0.25)', alignItems: 'center', justifyContent: 'center', shadowColor: colors.blue, shadowOpacity: 0.5, shadowRadius: 20, shadowOffset: { width: 0, height: 6 }, elevation: 10, }, shutterPressed: { transform: [{ scale: 0.94 }] }, shutterInner: { width: 56, height: 56, borderRadius: 28, borderWidth: 3, borderColor: colors.onBlue, }, });