import { useRef } from "react"; import { useParams, useLocation } from "wouter"; import { trpc } from "@/lib/trpc"; import { Button } from "@/components/ui/button"; import { ChevronLeft, Printer, Loader2, QrCode } from "lucide-react"; export default function QrPoster() { const params = useParams<{ clinicId: string }>(); const [, navigate] = useLocation(); const clinicId = parseInt(params.clinicId || "0"); const printRef = useRef(null); const clinicQuery = trpc.clinic.get.useQuery({ id: clinicId }, { enabled: !!clinicId }); const qrQuery = trpc.clinic.getQrCode.useQuery({ id: clinicId }, { enabled: !!clinicId }); const clinic = clinicQuery.data; const qrDataUrl = qrQuery.data?.qrDataUrl; const handlePrint = () => { window.print(); }; if (clinicQuery.isLoading || qrQuery.isLoading) { return (
); } return (
{/* Controls — hidden on print */}
Conseils d'impression : Utilisez du papier A4, imprimez en couleur si possible. Plastifiez l'affiche pour la durabilité. Placez-la à hauteur des yeux à l'entrée du cabinet.
{/* Printable poster */}
{/* Header band */}
QueueMed

Salle d'attente virtuelle

{/* Main content */}

{clinic?.name ?? "Cabinet médical"}

{clinic?.address && (

📍 {clinic.address}

)}

Rejoignez la file d'attente sans attendre ici

Scannez le QR code avec votre téléphone et suivez votre position en temps réel

{/* QR Code */}
{qrDataUrl ? ( QR Code file d'attente ) : (
QR Code non disponible
)}
{/* Steps */}
{[ { num: "1", icon: "📱", title: "Scannez", desc: "Ouvrez l'appareil photo et pointez vers le QR code" }, { num: "2", icon: "👆", title: "Rejoignez", desc: "Appuyez sur le lien et entrez dans la file" }, { num: "3", icon: "🔔", title: "Revenez", desc: "Vous serez alerté quand votre tour approche" }, ].map(step => (
{step.icon}
{step.title}
{step.desc}
))}
{/* Info box */}
Aucune application à installer

Fonctionne directement dans votre navigateur. Gratuit pour les patients.

{/* No smartphone note */}

Pas de smartphone ? Demandez un ticket imprimé à l'accueil.

{/* Footer */}
Propulsé par QueueMed queuemed.fr
{/* Print styles */}
); }