import { useState } from 'react'; import { motion } from 'framer-motion'; import { Camera, X, FlipHorizontal, Image as ImageIcon, Send } from 'lucide-react'; import { useLocation } from 'wouter'; import { useDeviceCamera } from '@/hooks/use-device-camera'; import { useNativeFeatures } from '@/hooks/use-native-features'; import { haptics } from '@/lib/haptics'; import { isMobile } from '@/lib/platform'; export default function MobileCamera() { const [, navigate] = useLocation(); const { photo, isLoading, error, takePhoto, pickPhoto } = useDeviceCamera(); const native = useNativeFeatures(); const [capturedImage, setCapturedImage] = useState(null); if (!isMobile()) { navigate('/home'); return null; } const handleTakePhoto = async () => { haptics.medium(); const result = await takePhoto(); if (result) { setCapturedImage(result.webPath || result.path || ''); native.showToast('Photo captured!'); haptics.success(); } }; const handlePickFromGallery = async () => { haptics.light(); const result = await pickPhoto(); if (result) { setCapturedImage(result.webPath || result.path || ''); native.showToast('Photo selected!'); } }; const handleShare = async () => { if (capturedImage) { haptics.medium(); await native.shareText('Check out my photo!', 'Photo from AeThex OS'); haptics.success(); } }; const handleClose = () => { haptics.light(); navigate('/mobile'); }; return (
{/* Header */}

Camera

{capturedImage ? ( ) : (
)}
{/* Main content */}
{capturedImage ? ( Captured
) : (
{/* Camera placeholder */}

Tap button below to capture

{error && (

{error}

)} {/* Camera controls */}
{/* Info */}

📸 Camera Access: This feature uses your device camera. Grant permission when prompted to capture photos.

)}
); }