Backend modules from tastefully 8bd93d15: core-libs, core-session, api-gateway, mobile-api, services-auth, services-system, services-counter, services-member, services-log, services-email. solvway-admin-portal from babyboo f64d096ea, solvway-customer-portal from tastefully 8bd93d15. Copied as tracked files only. Literal secrets replaced with environment placeholders: - services-email: SMTP_PASSWORD, MAILGUN_API_KEY, SENDGRID_API_KEY, MAILJET_API_KEY, MAILJET_SECRET_KEY (optional, empty default) - services-system: JUMIO_TOKEN, JUMIO_SECRET (optional) - services-auth: USER_AUTH_API_SECRET (required); commented JWT secret removed - core-libs: JWT_TOKEN default removed (required), XXL_JOB_TOKEN default removed, ipgeolocation key read from IPGEOLOCATION_API_KEY - services-system EkycAppConfig: commented Jumio credentials removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
49 lines
2.3 KiB
TypeScript
49 lines
2.3 KiB
TypeScript
"use client";
|
||
|
||
import { useState } from "react";
|
||
import { RotateCw, ZoomIn, ZoomOut } from "lucide-react";
|
||
import { Button } from "@/app/components/ui/button";
|
||
import { Dialog, DialogContent, DialogTitle } from "@/app/components/ui/dialog";
|
||
import { useT } from "@/app/lib/i18n/MessagesProvider";
|
||
|
||
const MIN_ZOOM = 1;
|
||
const MAX_ZOOM = 4;
|
||
|
||
/** Full-screen document viewer with zoom (1×–4×) and 90° rotation; Esc or the close button dismisses. */
|
||
export function KycDocViewer({ src, label, onClose }: { src: string; label: string; onClose: () => void }) {
|
||
const t = useT();
|
||
const [zoom, setZoom] = useState(1);
|
||
const [rotation, setRotation] = useState(0);
|
||
return (
|
||
<Dialog open onOpenChange={open => !open && onClose()}>
|
||
<DialogContent className="flex h-[90vh] w-[95vw] max-w-[95vw] flex-col gap-3 p-4 sm:max-w-[95vw]">
|
||
<div className="flex items-center gap-2 pr-10">
|
||
<DialogTitle className="flex-1 text-base">{label}</DialogTitle>
|
||
<Button variant="outline" size="icon" aria-label={t("KycZoomOut")} disabled={zoom <= MIN_ZOOM}
|
||
onClick={() => setZoom(z => Math.max(MIN_ZOOM, z - 0.5))}>
|
||
<ZoomOut aria-hidden="true" className="size-4" />
|
||
</Button>
|
||
<span className="w-12 text-center text-sm tabular-nums">{zoom}×</span>
|
||
<Button variant="outline" size="icon" aria-label={t("KycZoomIn")} disabled={zoom >= MAX_ZOOM}
|
||
onClick={() => setZoom(z => Math.min(MAX_ZOOM, z + 0.5))}>
|
||
<ZoomIn aria-hidden="true" className="size-4" />
|
||
</Button>
|
||
<Button variant="outline" size="icon" aria-label={t("KycRotate")} onClick={() => setRotation(r => (r + 90) % 360)}>
|
||
<RotateCw aria-hidden="true" className="size-4" />
|
||
</Button>
|
||
</div>
|
||
<div className="flex flex-1 items-center justify-center overflow-auto rounded-md bg-muted">
|
||
{/* eslint-disable-next-line @next/next/no-img-element -- auth-proxied private image, not an optimisable asset */}
|
||
<img
|
||
src={src}
|
||
alt={label}
|
||
data-testid="kyc-doc-full"
|
||
className="max-h-full max-w-full object-contain transition-transform"
|
||
style={{ transform: `scale(${zoom}) rotate(${rotation}deg)` }}
|
||
/>
|
||
</div>
|
||
</DialogContent>
|
||
</Dialog>
|
||
);
|
||
}
|