File tree Expand file tree Collapse file tree 4 files changed +63
-46
lines changed
src/components/admin/scanner Expand file tree Collapse file tree 4 files changed +63
-46
lines changed Original file line number Diff line number Diff line change 4242 "@vercel/blob" : " ^0.10.0" ,
4343 "@vercel/kv" : " ^2.0.0" ,
4444 "@vercel/postgres" : " ^0.9.0" ,
45- "@yudiel/react-qr-scanner" : " ^1 .1.9 " ,
45+ "@yudiel/react-qr-scanner" : " ^2 .1.0 " ,
4646 "autoprefixer" : " 10.4.19" ,
4747 "axios" : " ^1.7.2" ,
4848 "class-variance-authority" : " ^0.7.0" ,
Original file line number Diff line number Diff line change 11"use client" ;
22
33import { useState , useEffect } from "react" ;
4- import { QrScanner } from "@yudiel/react-qr-scanner" ;
4+ import { Scanner } from "@yudiel/react-qr-scanner" ;
55import superjson from "superjson" ;
66import { checkInUserToHackathon } from "@/actions/admin/scanner-admin-actions" ;
77import { type QRDataInterface } from "@/lib/utils/shared/qr" ;
@@ -130,16 +130,16 @@ export default function CheckinScanner({
130130 < div className = "flex h-dvh flex-col items-center justify-center pt-32" >
131131 < div className = "flex w-screen flex-col items-center justify-center gap-5" >
132132 < div className = "mx-auto aspect-square w-screen max-w-[500px] overflow-hidden" >
133- < QrScanner
134- onDecode = { ( result ) => {
133+ < Scanner
134+ onScan = { ( result ) => {
135135 const params = new URLSearchParams (
136136 searchParams . toString ( ) ,
137137 ) ;
138138 if ( ! params . has ( "user" ) ) {
139139 setScanLoading ( true ) ;
140140 const qrParsedData =
141141 superjson . parse < QRDataInterface > (
142- result ,
142+ result [ 0 ] . rawValue ,
143143 ) ;
144144 params . set ( "user" , qrParsedData . userID ) ;
145145 params . set (
@@ -153,11 +153,13 @@ export default function CheckinScanner({
153153 ) ;
154154 }
155155 } }
156- onError = { ( error ) => console . log ( error ?. message ) }
157- containerStyle = { {
158- width : "100vw" ,
159- maxWidth : "500px" ,
160- margin : "0" ,
156+ onError = { ( error ) => console . log ( error ) }
157+ styles = { {
158+ container : {
159+ width : "100vw" ,
160+ maxWidth : "500px" ,
161+ margin : "0" ,
162+ } ,
161163 } }
162164 />
163165 </ div >
Original file line number Diff line number Diff line change 11"use client" ;
22
33import { useState , useEffect } from "react" ;
4- import { QrScanner } from "@yudiel/react-qr-scanner" ;
4+ import { Scanner } from "@yudiel/react-qr-scanner" ;
55import superjson from "superjson" ;
66import { createScan } from "@/actions/admin/scanner-admin-actions" ;
77import { useAction } from "next-safe-action/hooks" ;
@@ -99,16 +99,16 @@ export default function PassScanner({
9999 < div className = "flex h-dvh flex-col items-center justify-center pt-32" >
100100 < div className = "flex w-screen flex-col items-center justify-center gap-5" >
101101 < div className = "mx-auto aspect-square w-screen max-w-[500px] overflow-hidden" >
102- < QrScanner
103- onDecode = { ( result ) => {
102+ < Scanner
103+ onScan = { ( result ) => {
104104 const params = new URLSearchParams (
105105 searchParams . toString ( ) ,
106106 ) ;
107107 if ( ! params . has ( "user" ) ) {
108108 setScanLoading ( true ) ;
109109 const qrParsedData =
110110 superjson . parse < QRDataInterface > (
111- result ,
111+ result [ 0 ] . rawValue ,
112112 ) ;
113113 params . set ( "user" , qrParsedData . userID ) ;
114114 params . set (
@@ -122,11 +122,13 @@ export default function PassScanner({
122122 ) ;
123123 }
124124 } }
125- onError = { ( error ) => console . log ( error ?. message ) }
126- containerStyle = { {
127- width : "100vw" ,
128- maxWidth : "500px" ,
129- margin : "0" ,
125+ onError = { ( error ) => console . log ( error ) }
126+ styles = { {
127+ container : {
128+ width : "100vw" ,
129+ maxWidth : "500px" ,
130+ margin : "0" ,
131+ } ,
130132 } }
131133 />
132134 </ div >
You can’t perform that action at this time.
0 commit comments