refactor(profissional): Fixes ref usage in SignatureCanvas and removes react-quill- Adjusts ref usage with dynamic SignatureCanvas to avoid typing errors. - Removes dependency and usage of react-quill library from code.

This commit is contained in:
M-Gabrielly 2025-09-25 21:20:27 -03:00
parent 47fb573f56
commit 524548cce8

View File

@ -1,11 +1,9 @@
import type SignatureCanvasType from "react-signature-canvas"; import type SignatureCanvasType from "react-signature-canvas";
import React, { useState, useRef } from "react"; import React, { useState, useRef, forwardRef } from "react";
import dynamic from "next/dynamic"; import dynamic from "next/dynamic";
import Link from "next/link"; import Link from "next/link";
const SignatureCanvas = dynamic(() => import("react-signature-canvas"), { ssr: false });
import ProtectedRoute from "@/components/ProtectedRoute"; import ProtectedRoute from "@/components/ProtectedRoute";
import { useAuth } from "@/hooks/useAuth"; import { useAuth } from "@/hooks/useAuth";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
@ -58,6 +56,13 @@ const medico = {
fotoUrl: "", fotoUrl: "",
} }
const SignatureCanvas = dynamic(
() =>
import("react-signature-canvas").then((mod) =>
forwardRef<any, any>((props, ref) => <mod.default {...props} ref={ref} />)
),
{ ssr: false }
);
const colorsByType = { const colorsByType = {
Rotina: "#4dabf7", Rotina: "#4dabf7",
@ -632,7 +637,7 @@ function LaudoEditor() {
<label className="block mb-1 font-medium text-primary">Assinatura Digital</label> <label className="block mb-1 font-medium text-primary">Assinatura Digital</label>
<div className="bg-muted rounded-md border p-2 flex flex-col items-center"> <div className="bg-muted rounded-md border p-2 flex flex-col items-center">
<SignatureCanvas <SignatureCanvas
ref={(node) => { sigCanvasRef.current = node; }} ref={sigCanvasRef}
penColor="#0f172a" penColor="#0f172a"
backgroundColor="#fff" backgroundColor="#fff"
canvasProps={{ width: 300, height: 100, className: "rounded border bg-white" }} canvasProps={{ width: 300, height: 100, className: "rounded border bg-white" }}