refactor: remove unnecessary console log from ContattiProprietarioModal
This commit is contained in:
parent
511423a6b6
commit
66a70b92cc
2 changed files with 14 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import { CircleCheck, ExternalLink, Trash2 } from "lucide-react";
|
import { CircleCheck, ExternalLink, Trash2 } from "lucide-react";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { useState } from "react";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { getStorageUrl } from "~/lib/storage_utils";
|
import { getStorageUrl } from "~/lib/storage_utils";
|
||||||
import { useSession } from "~/providers/SessionProvider";
|
import { useSession } from "~/providers/SessionProvider";
|
||||||
|
|
@ -132,6 +133,7 @@ export const DocumentiUploadSection = ({
|
||||||
isPending: boolean;
|
isPending: boolean;
|
||||||
caricatoNote?: boolean;
|
caricatoNote?: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
|
const [imageError, setImageError] = useState(false);
|
||||||
if (document?.storageId) {
|
if (document?.storageId) {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
|
|
@ -145,16 +147,27 @@ export const DocumentiUploadSection = ({
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
{isPending ? (
|
{isPending ? (
|
||||||
<LoadingSpinner className="size-24 stroke-neutral-300" />
|
<LoadingSpinner className="size-24 stroke-neutral-300" />
|
||||||
) : (
|
) : !imageError ? (
|
||||||
<Image
|
<Image
|
||||||
alt={title}
|
alt={title}
|
||||||
className="size-24 rounded-md border object-cover"
|
className="size-24 rounded-md border object-cover"
|
||||||
height={96}
|
height={96}
|
||||||
|
onError={() => setImageError(true)}
|
||||||
src={getStorageUrl({
|
src={getStorageUrl({
|
||||||
storageId: document.storageId,
|
storageId: document.storageId,
|
||||||
})}
|
})}
|
||||||
width={96}
|
width={96}
|
||||||
/>
|
/>
|
||||||
|
) : (
|
||||||
|
<div className="flex size-24 items-center justify-center overflow-clip rounded-md border bg-muted">
|
||||||
|
<iframe
|
||||||
|
className="size-full"
|
||||||
|
src={getStorageUrl({ storageId: document.storageId })}
|
||||||
|
title="doc"
|
||||||
|
>
|
||||||
|
<p>Il tuo browser non supporta gli iframe.</p>
|
||||||
|
</iframe>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="flex flex-col justify-center gap-2">
|
<div className="flex flex-col justify-center gap-2">
|
||||||
<Link
|
<Link
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,6 @@ export const ContattiProprietarioModal = () => {
|
||||||
!servizio.skipControlloDoc &&
|
!servizio.skipControlloDoc &&
|
||||||
(!servizio.doc_personale_fronte || !servizio.doc_personale_retro);
|
(!servizio.doc_personale_fronte || !servizio.doc_personale_retro);
|
||||||
|
|
||||||
console.log("needsDocuments", needsDocuments, servizio);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Credenza
|
<Credenza
|
||||||
onOpenChange={(o) => {
|
onOpenChange={(o) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue