From cb81772b66811af9e799fa737f18623fee4775e8 Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Fri, 27 Sep 2024 13:13:24 +0545 Subject: [PATCH 1/2] fix(QrcodeComponent): reduce qrcode skeleton size --- src/frontend/src/components/QrcodeComponent.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/components/QrcodeComponent.tsx b/src/frontend/src/components/QrcodeComponent.tsx index ec3288073f..a0f0b92555 100755 --- a/src/frontend/src/components/QrcodeComponent.tsx +++ b/src/frontend/src/components/QrcodeComponent.tsx @@ -26,7 +26,7 @@ const QrcodeComponent = ({ projectId, taskIndex }: tasksComponentType) => {
{qrcode == '' ? ( - + ) : ( qrcode )} From 5a1d546801c774f9fabf560939244da0cf3b29cd Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Fri, 27 Sep 2024 13:14:01 +0545 Subject: [PATCH 2/2] fix(files): cleanup function remove --- src/frontend/src/api/Files.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/frontend/src/api/Files.ts b/src/frontend/src/api/Files.ts index 79e69b4686..f130f68186 100755 --- a/src/frontend/src/api/Files.ts +++ b/src/frontend/src/api/Files.ts @@ -16,13 +16,14 @@ export const GetProjectQrCode = ( osmUser: string, ): { qrcode: string } => { const [qrcode, setQrcode] = useState(''); + useEffect(() => { const fetchProjectFileById = async ( odkToken: string | undefined, projectName: string | undefined, osmUser: string, ) => { - if (odkToken === '') { + if (!odkToken || !projectName) { setQrcode(''); return; } @@ -46,18 +47,11 @@ export const GetProjectQrCode = ( // Note: pako.deflate zlib encodes to content code.addData(base64zlibencode(odkCollectJson)); code.make(); - // Note: cell size = 3, margin = 5 setQrcode(code.createDataURL(3, 5)); }; fetchProjectFileById(odkToken, projectName, osmUser); - - const cleanUp = () => { - setQrcode(''); - }; - - return cleanUp; }, [projectName, odkToken, osmUser]); return { qrcode }; };