Colota - Android GPS Location tracker
chore(docs): replace qrcode with uqr (#655)
Max Dietriche85c53c5d2b2
diff --git a/apps/docs/package.json b/apps/docs/package.jsonindex 0b4a408b..175cd0fc 100644--- a/apps/docs/package.json+++ b/apps/docs/package.json@@ -24,15 +24,14 @@"@docusaurus/preset-classic": "3.10.2","clsx": "^2.1.1","prism-react-renderer": "^2.4.1",- "qrcode": "^1.5.4","react": "19.2.8",- "react-dom": "19.2.8"+ "react-dom": "19.2.8",+ "uqr": "^0.1.3"},"devDependencies": {"@docusaurus/module-type-aliases": "3.10.2","@docusaurus/tsconfig": "3.10.2",- "@docusaurus/types": "3.10.2",- "@types/qrcode": "1.5.6"+ "@docusaurus/types": "3.10.2"},"browserslist": {"production": [diff --git a/apps/docs/src/components/DeepLinkGenerator.module.css b/apps/docs/src/components/DeepLinkGenerator.module.cssindex 0afe9da1..01e17115 100644--- a/apps/docs/src/components/DeepLinkGenerator.module.css+++ b/apps/docs/src/components/DeepLinkGenerator.module.css@@ -247,11 +247,11 @@margin-top: 0.75rem;}-.qrContainer canvas {+.qrContainer svg {width: 100%;max-width: 400px;height: auto;- image-rendering: pixelated;+ aspect-ratio: 1;}.qrWarning {diff --git a/apps/docs/src/components/DeepLinkGenerator.tsx b/apps/docs/src/components/DeepLinkGenerator.tsxindex 33952942..9f194d19 100644--- a/apps/docs/src/components/DeepLinkGenerator.tsx+++ b/apps/docs/src/components/DeepLinkGenerator.tsx@@ -1,4 +1,5 @@-import { useState, useMemo, useCallback, useRef, useEffect } from "react"+import { useState, useMemo, useCallback } from "react"+import { encode } from "uqr"import styles from "./DeepLinkGenerator.module.css"interface KeyValue {@@ -101,14 +102,6 @@ export default function DeepLinkGenerator() {// Tracking Profilesconst [profiles, setProfiles] = useState<ProfileRow[]>([])- // QR- const qrRef = useRef<HTMLDivElement>(null)- const [qrLib, setQrLib] = useState<any>(null)-- useEffect(() => {- import("qrcode").then((mod) => setQrLib(mod.default || mod)).catch(() => {})- }, [])-const config = useMemo(() => {const obj: Record<string, unknown> = {}@@ -251,20 +244,17 @@ export default function DeepLinkGenerator() {const isQrTooLarge = deepLink.length > QR_MAX_SCANNABLE_LENGTH- useEffect(() => {- if (!qrRef.current || !qrLib || !deepLink) {- if (qrRef.current) qrRef.current.innerHTML = ""- return- }-- const canvas = document.createElement("canvas")- qrLib.toCanvas(canvas, deepLink, { width: 400, margin: 2, errorCorrectionLevel: "L" }, (err: Error | null) => {- if (!err && qrRef.current) {- qrRef.current.innerHTML = ""- qrRef.current.appendChild(canvas)+ const qr = useMemo(() => {+ if (!deepLink) return null+ const { size, data } = encode(deepLink, { ecc: "L", border: 2 })+ let d = ""+ for (let row = 0; row < size; row++) {+ for (let col = 0; col < size; col++) {+ if (data[row][col]) d += `M${col},${row}h1v1h-1z`}- })- }, [deepLink, qrLib])+ }+ return { size, d }+ }, [deepLink])const [copyFeedback, setCopyFeedback] = useState(false)const [downloadFeedback, setDownloadFeedback] = useState(false)@@ -956,12 +946,17 @@ export default function DeepLinkGenerator() {</button></div>- {qrLib && (+ {qr && (<><div className={styles.sectionTitle} style={{ marginTop: "1rem" }}>QR Code</div>- <div className={styles.qrContainer} ref={qrRef} />+ <div className={styles.qrContainer}>+ <svg xmlns="http://www.w3.org/2000/svg" viewBox={`0 0 ${qr.size} ${qr.size}`}>+ <rect fill="white" width={qr.size} height={qr.size} />+ <path fill="black" d={qr.d} />+ </svg>+ </div>{isQrTooLarge && (<div className={styles.qrWarning}><strong>This QR code may not be readable on all phones.</strong>diff --git a/package-lock.json b/package-lock.jsonindex 6785af6f..21f83e1d 100644--- a/package-lock.json+++ b/package-lock.json@@ -28,15 +28,14 @@"@docusaurus/preset-classic": "3.10.2","clsx": "^2.1.1","prism-react-renderer": "^2.4.1",- "qrcode": "^1.5.4","react": "19.2.8",- "react-dom": "19.2.8"+ "react-dom": "19.2.8",+ "uqr": "^0.1.3"},"devDependencies": {"@docusaurus/module-type-aliases": "3.10.2","@docusaurus/tsconfig": "3.10.2",- "@docusaurus/types": "3.10.2",- "@types/qrcode": "1.5.6"+ "@docusaurus/types": "3.10.2"},"engines": {"node": ">=20.0"@@ -10251,16 +10250,6 @@"integrity": "sha512-vqlvI7qlMvcCBbVe0AKAb4f97//Hy0EBTaiW8AalRnG/xAN5zOiWWyrNqNXeq8+KAuvRewjCVY1+IPxk4RdNYw==","license": "MIT"},- "node_modules/@types/qrcode": {- "version": "1.5.6",- "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.6.tgz",- "integrity": "sha512-te7NQcV2BOvdj2b1hCAHzAoMNuj65kNBMz0KBaxM6c3VGBOhU0dURQKOtH8CFNI/dsKkwlv32p26qYQTWoB5bw==",- "dev": true,- "license": "MIT",- "dependencies": {- "@types/node": "*"- }- },"node_modules/@types/qs": {"version": "6.15.1","resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.15.1.tgz",@@ -13938,6 +13927,7 @@"version": "1.2.0","resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz","integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",+ "devOptional": true,"license": "MIT","engines": {"node": ">=0.10.0"@@ -14207,12 +14197,6 @@"url": "https://github.com/sponsors/wooorm"}},- "node_modules/dijkstrajs": {- "version": "1.0.3",- "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz",- "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==",- "license": "MIT"- },"node_modules/dir-glob": {"version": "3.0.1","resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",@@ -25814,6 +25798,7 @@"version": "2.2.0","resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz","integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",+ "devOptional": true,"license": "MIT","engines": {"node": ">=6"@@ -25987,6 +25972,7 @@"version": "4.0.0","resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz","integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",+ "devOptional": true,"license": "MIT","engines": {"node": ">=8"@@ -26223,15 +26209,6 @@"node": ">=16.0.0"}},- "node_modules/pngjs": {- "version": "5.0.0",- "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",- "integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==",- "license": "MIT",- "engines": {- "node": ">=10.13.0"- }- },"node_modules/possible-typed-array-names": {"version": "1.1.0","resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz",@@ -27984,179 +27961,6 @@"node": ">=16.0.0"}},- "node_modules/qrcode": {- "version": "1.5.4",- "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz",- "integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==",- "license": "MIT",- "dependencies": {- "dijkstrajs": "^1.0.1",- "pngjs": "^5.0.0",- "yargs": "^15.3.1"- },- "bin": {- "qrcode": "bin/qrcode"- },- "engines": {- "node": ">=10.13.0"- }- },- "node_modules/qrcode/node_modules/camelcase": {- "version": "5.3.1",- "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",- "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",- "license": "MIT",- "engines": {- "node": ">=6"- }- },- "node_modules/qrcode/node_modules/cliui": {- "version": "6.0.0",- "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",- "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",- "license": "ISC",- "dependencies": {- "string-width": "^4.2.0",- "strip-ansi": "^6.0.0",- "wrap-ansi": "^6.2.0"- }- },- "node_modules/qrcode/node_modules/emoji-regex": {- "version": "8.0.0",- "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",- "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",- "license": "MIT"- },- "node_modules/qrcode/node_modules/find-up": {- "version": "4.1.0",- "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",- "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",- "license": "MIT",- "dependencies": {- "locate-path": "^5.0.0",- "path-exists": "^4.0.0"- },- "engines": {- "node": ">=8"- }- },- "node_modules/qrcode/node_modules/is-fullwidth-code-point": {- "version": "3.0.0",- "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",- "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",- "license": "MIT",- "engines": {- "node": ">=8"- }- },- "node_modules/qrcode/node_modules/locate-path": {- "version": "5.0.0",- "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",- "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",- "license": "MIT",- "dependencies": {- "p-locate": "^4.1.0"- },- "engines": {- "node": ">=8"- }- },- "node_modules/qrcode/node_modules/p-limit": {- "version": "2.3.0",- "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",- "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",- "license": "MIT",- "dependencies": {- "p-try": "^2.0.0"- },- "engines": {- "node": ">=6"- },- "funding": {- "url": "https://github.com/sponsors/sindresorhus"- }- },- "node_modules/qrcode/node_modules/p-locate": {- "version": "4.1.0",- "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",- "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",- "license": "MIT",- "dependencies": {- "p-limit": "^2.2.0"- },- "engines": {- "node": ">=8"- }- },- "node_modules/qrcode/node_modules/string-width": {- "version": "4.2.3",- "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",- "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",- "license": "MIT",- "dependencies": {- "emoji-regex": "^8.0.0",- "is-fullwidth-code-point": "^3.0.0",- "strip-ansi": "^6.0.1"- },- "engines": {- "node": ">=8"- }- },- "node_modules/qrcode/node_modules/wrap-ansi": {- "version": "6.2.0",- "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",- "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",- "license": "MIT",- "dependencies": {- "ansi-styles": "^4.0.0",- "string-width": "^4.1.0",- "strip-ansi": "^6.0.0"- },- "engines": {- "node": ">=8"- }- },- "node_modules/qrcode/node_modules/y18n": {- "version": "4.0.3",- "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",- "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",- "license": "ISC"- },- "node_modules/qrcode/node_modules/yargs": {- "version": "15.4.1",- "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",- "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",- "license": "MIT",- "dependencies": {- "cliui": "^6.0.0",- "decamelize": "^1.2.0",- "find-up": "^4.1.0",- "get-caller-file": "^2.0.1",- "require-directory": "^2.1.1",- "require-main-filename": "^2.0.0",- "set-blocking": "^2.0.0",- "string-width": "^4.2.0",- "which-module": "^2.0.0",- "y18n": "^4.0.0",- "yargs-parser": "^18.1.2"- },- "engines": {- "node": ">=8"- }- },- "node_modules/qrcode/node_modules/yargs-parser": {- "version": "18.1.3",- "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",- "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",- "license": "ISC",- "dependencies": {- "camelcase": "^5.0.0",- "decamelize": "^1.2.0"- },- "engines": {- "node": ">=6"- }- },"node_modules/qs": {"version": "6.15.3","resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz",@@ -29190,6 +28994,7 @@"version": "2.0.0","resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz","integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",+ "devOptional": true,"license": "ISC"},"node_modules/requires-port": {@@ -29877,6 +29682,7 @@"version": "2.0.0","resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz","integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",+ "devOptional": true,"license": "ISC"},"node_modules/set-function-length": {@@ -31898,6 +31704,12 @@"node": ">=10"}},+ "node_modules/uqr": {+ "version": "0.1.3",+ "resolved": "https://registry.npmjs.org/uqr/-/uqr-0.1.3.tgz",+ "integrity": "sha512-0rjE8iEJe4YmT9TOhwsZtqCMRLc5DXZUI2UEYUUg63ikBkqqE5EYWaI0etFe/5KUcmcYwLih2RND1kq+hrUJXA==",+ "license": "MIT"+ },"node_modules/uri-js": {"version": "4.4.1","resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",@@ -32592,6 +32404,7 @@"version": "2.0.1","resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz","integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==",+ "devOptional": true,"license": "ISC"},"node_modules/which-typed-array": {