File tree Expand file tree Collapse file tree 3 files changed +9
-0
lines changed
Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ import { z } from "zod";
4444import { useForm } from "react-hook-form" ;
4545import { zodResolver } from "@hookform/resolvers/zod" ;
4646import { toast } from "sonner" ;
47+ import QRCode from "qrcode" ;
4748
4849const generatePeerFormSchema = z . object ( {
4950 allowedIP : z . string ( ) . ip ( { version : "v4" } ) ,
@@ -126,6 +127,12 @@ export function GeneratePeer() {
126127 [ hub . data , generatedPeer ] ,
127128 ) ;
128129
130+ useEffect ( ( ) => {
131+ if ( showQR && canvasRef . current ) {
132+ QRCode . toCanvas ( canvasRef . current , peerConfig , { } ) . catch ( console . error ) ;
133+ }
134+ } , [ showQR , peerConfig ] ) ;
135+
129136 return (
130137 < Dialog open = { open } onOpenChange = { setOpen } >
131138 < DialogTrigger asChild >
Original file line number Diff line number Diff line change 2727 "next-themes" : " ^0.2.1" ,
2828 "p-memoize" : " ^7.1.1" ,
2929 "pretty-bytes" : " ^6.1.1" ,
30+ "qrcode" : " ^1.5.3" ,
3031 "react" : " ^18" ,
3132 "react-dom" : " ^18" ,
3233 "react-hook-form" : " ^7.50.0" ,
4041 },
4142 "devDependencies" : {
4243 "@types/node" : " ^20" ,
44+ "@types/qrcode" : " ^1.5.5" ,
4345 "@types/react" : " ^18" ,
4446 "@types/react-dom" : " ^18" ,
4547 "autoprefixer" : " ^10.0.1" ,
You can’t perform that action at this time.
0 commit comments