Merge branch 'main' into feat/workout-list-view
This commit is contained in:
commit
98ed4ddcb1
51 files changed
+2652
-348
No files matched your search
@@ -21,6 +21,12 @@ android {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
debug {
|
||||
// Test build installs side-by-side with the real app: its own applicationId, so both
|
||||
// can live on one device. The name/icon label is overridden by the debug resource
|
||||
// overlay in src/debug/res. The release build (the "real" app) is untouched.
|
||||
applicationIdSuffix ".test"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ android {
|
||||
|
||||
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
|
||||
dependencies {
|
||||
implementation project(':aparajita-capacitor-secure-storage')
|
||||
implementation project(':capacitor-mlkit-barcode-scanning')
|
||||
implementation project(':capacitor-app')
|
||||
implementation project(':capacitor-filesystem')
|
||||
implementation project(':capacitor-local-notifications')
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<!-- Debug-only overrides so the test build shows a distinct name next to the real app.
|
||||
Merged over src/main/res for the debug variant only; the release build keeps openGym. -->
|
||||
<string name="app_name">OpenGymTest</string>
|
||||
<string name="title_activity_main">OpenGymTest</string>
|
||||
</resources>
|
||||
@@ -27,6 +27,10 @@
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
|
||||
<!-- Gym check-in scanner (@capacitor-mlkit/barcode-scanning): pre-fetch the ML Kit
|
||||
barcode model at install time so the first scan doesn't wait on a download. -->
|
||||
<meta-data android:name="com.google.mlkit.vision.DEPENDENCIES" android:value="barcode_ui" />
|
||||
</application>
|
||||
|
||||
<!-- Permissions -->
|
||||
@@ -36,4 +40,6 @@
|
||||
on Android 12+. Where it isn't granted, scheduling silently falls back to inexact
|
||||
alarms — the reminder still arrives, just not to the minute. -->
|
||||
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
|
||||
<!-- Gym check-in: scanning a membership QR/barcode with the camera. -->
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
</manifest>
|
||||
@@ -2,6 +2,12 @@
|
||||
include ':capacitor-android'
|
||||
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
|
||||
|
||||
include ':aparajita-capacitor-secure-storage'
|
||||
project(':aparajita-capacitor-secure-storage').projectDir = new File('../node_modules/@aparajita/capacitor-secure-storage/android')
|
||||
|
||||
include ':capacitor-mlkit-barcode-scanning'
|
||||
project(':capacitor-mlkit-barcode-scanning').projectDir = new File('../node_modules/@capacitor-mlkit/barcode-scanning/android')
|
||||
|
||||
include ':capacitor-app'
|
||||
project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android')
|
||||
|
||||
|
||||
@@ -45,5 +45,7 @@
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<true/>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>Used to scan your gym membership QR code so you can check in from the app.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -11,6 +11,8 @@ install! 'cocoapods', :disable_input_output_paths => true
|
||||
def capacitor_pods
|
||||
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
|
||||
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
|
||||
pod 'AparajitaCapacitorSecureStorage', :path => '../../node_modules/@aparajita/capacitor-secure-storage'
|
||||
pod 'CapacitorMlkitBarcodeScanning', :path => '../../node_modules/@capacitor-mlkit/barcode-scanning'
|
||||
pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
|
||||
pod 'CapacitorFilesystem', :path => '../../node_modules/@capacitor/filesystem'
|
||||
pod 'CapacitorLocalNotifications', :path => '../../node_modules/@capacitor/local-notifications'
|
||||
|
||||
Generated
+311
-50
@@ -10,11 +10,14 @@
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@aparajita/capacitor-secure-storage": "^7.1.6",
|
||||
"@capacitor-mlkit/barcode-scanning": "^7.5.0",
|
||||
"@capacitor/app": "^7.1.2",
|
||||
"@capacitor/core": "^7.6.8",
|
||||
"@capacitor/filesystem": "^7.1.8",
|
||||
"@capacitor/local-notifications": "^7.0.7",
|
||||
"@capacitor/share": "^7.0.4",
|
||||
"jsqr": "^1.4.0",
|
||||
"lean-qr": "^2.7.3",
|
||||
"react": "^19.2.7",
|
||||
"react-dom": "^19.2.7",
|
||||
"react-router-dom": "^7.18.2",
|
||||
@@ -26,6 +29,7 @@
|
||||
"@capacitor/cli": "^7.6.8",
|
||||
"@capacitor/ios": "^7.6.8",
|
||||
"@vitejs/plugin-react": "^6.0.3",
|
||||
"@vitest/coverage-v8": "^4.1.11",
|
||||
"happy-dom": "^20.11.2",
|
||||
"linkedom": "^0.18.13",
|
||||
"vite": "^8.1.5",
|
||||
@@ -60,6 +64,16 @@
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-string-parser": {
|
||||
"version": "7.29.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz",
|
||||
"integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-validator-identifier": {
|
||||
"version": "7.29.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz",
|
||||
@@ -69,6 +83,64 @@
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/parser": {
|
||||
"version": "7.29.8",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.8.tgz",
|
||||
"integrity": "sha512-E8lTAYNB1KW+FH+VGJuZM1ioAx2E6oVlvQFRrf5P8ZZmsiJXYAD9vTFV7yyEURNzgh1dFqMZuO6tUwcARbqFCA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.29.8"
|
||||
},
|
||||
"bin": {
|
||||
"parser": "bin/babel-parser.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/types": {
|
||||
"version": "7.29.8",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz",
|
||||
"integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-string-parser": "^7.29.7",
|
||||
"@babel/helper-validator-identifier": "^7.29.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@bcoe/v8-coverage": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz",
|
||||
"integrity": "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@capacitor-mlkit/barcode-scanning": {
|
||||
"version": "7.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@capacitor-mlkit/barcode-scanning/-/barcode-scanning-7.5.0.tgz",
|
||||
"integrity": "sha512-DBWRykYYLW0YMj/UzlQ0sVGn83mwGAJsbZVxFsd44pppEEy88OO04lxy9Esv5QpnNBIKPjSIqLWmSLuhoFGPaQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/capawesome-team/"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/capawesome"
|
||||
}
|
||||
],
|
||||
"peerDependencies": {
|
||||
"@capacitor/core": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@capacitor/android": {
|
||||
"version": "7.6.8",
|
||||
"resolved": "https://registry.npmjs.org/@capacitor/android/-/android-7.6.8.tgz",
|
||||
@@ -1066,7 +1138,8 @@
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",
|
||||
"integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@trapezedev/gradle-parse": {
|
||||
"version": "7.1.3",
|
||||
@@ -1235,6 +1308,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",
|
||||
"integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/deep-eql": "*",
|
||||
"assertion-error": "^2.0.1"
|
||||
@@ -1244,13 +1318,15 @@
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz",
|
||||
"integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/estree": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",
|
||||
"integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/fs-extra": {
|
||||
"version": "8.1.5",
|
||||
@@ -1670,16 +1746,48 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@vitest/expect": {
|
||||
"version": "4.1.10",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.10.tgz",
|
||||
"integrity": "sha512-YsCn+qAk1GWjQOWFEsEcL2gNQ0zmVmQu3T03qP6UyjhtmdtwtbuI+DASn/7iQB3HGTXkdBwGddzxPlmiql5vlA==",
|
||||
"node_modules/@vitest/coverage-v8": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-4.1.11.tgz",
|
||||
"integrity": "sha512-8MVGEFnJIcdGjcbfKmeq8z0pZHH0JlVtoVZH9Q/qwUp6wyFnEJUBMrw9DCaj+ra3vShGmhavjalMIhPNxZAUcw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@bcoe/v8-coverage": "^1.0.2",
|
||||
"@vitest/utils": "4.1.11",
|
||||
"ast-v8-to-istanbul": "^1.0.0",
|
||||
"istanbul-lib-coverage": "^3.2.2",
|
||||
"istanbul-lib-report": "^3.0.1",
|
||||
"istanbul-reports": "^3.2.0",
|
||||
"magicast": "^0.5.2",
|
||||
"obug": "^2.1.1",
|
||||
"std-env": "^4.0.0-rc.1",
|
||||
"tinyrainbow": "^3.1.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/vitest"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@vitest/browser": "4.1.11",
|
||||
"vitest": "4.1.11"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@vitest/browser": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@vitest/expect": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.11.tgz",
|
||||
"integrity": "sha512-VX2x5vNJXET47KAFzwERI+KRMtTTCSWTfSMKsW7JsUsXV4psq++e3DvZpuTDOpHcxytiDs6p2nhVb2tVDiiUYw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@standard-schema/spec": "^1.1.0",
|
||||
"@types/chai": "^5.2.2",
|
||||
"@vitest/spy": "4.1.10",
|
||||
"@vitest/utils": "4.1.10",
|
||||
"@vitest/spy": "4.1.11",
|
||||
"@vitest/utils": "4.1.11",
|
||||
"chai": "^6.2.2",
|
||||
"tinyrainbow": "^3.1.0"
|
||||
},
|
||||
@@ -1688,12 +1796,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vitest/mocker": {
|
||||
"version": "4.1.10",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.10.tgz",
|
||||
"integrity": "sha512-v0xaezt+DKEmKfaxg133ldzADrwLGd7Ze1MfQQTYfvs8OqZIwbxyxaYURivwV7sWy5fqn3rH5uOrSp07bp44Ow==",
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.11.tgz",
|
||||
"integrity": "sha512-2XJVD55d1o5AZous5CCGKS74g/riOj9odEt2bQpCVZeblHyHdnMeFl4jl0XjU21stf4mbjUkew2eXQZt65g5CQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vitest/spy": "4.1.10",
|
||||
"@vitest/spy": "4.1.11",
|
||||
"estree-walker": "^3.0.3",
|
||||
"magic-string": "^0.30.21"
|
||||
},
|
||||
@@ -1714,10 +1823,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vitest/pretty-format": {
|
||||
"version": "4.1.10",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.10.tgz",
|
||||
"integrity": "sha512-W1HsjSH4MXQ9YfmmhLAoIYf1HRfekQCGngeIgcei6MP5QQGWUe0gkopdZQaVCFO+JDJMrAJGwa5pRpNpvy4P8Q==",
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.11.tgz",
|
||||
"integrity": "sha512-yiZzPbGTS9Sr/JpFl8zHrcIkAofNbFV6k21vIgQN/cY/oxZeXhJv5sc/MBJ5jFKWmWs+oJHw0UXLZjmf931+Vw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tinyrainbow": "^3.1.0"
|
||||
},
|
||||
@@ -1726,12 +1836,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vitest/runner": {
|
||||
"version": "4.1.10",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.10.tgz",
|
||||
"integrity": "sha512-IKI6kpIH+LmpROplyLwBBaCfMgOZOMsygVa6BARD6ahA04VRuJSa6OaVG7kRvSEMD870Vd91rSSw0eegtWyLGg==",
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.11.tgz",
|
||||
"integrity": "sha512-LztvUgdwMNJMIkj3hQnnxiC2Xy1zNxq928W/xhjCLaNCzqTZOudjwbQf6v9IntZGPw132i2Lq2rgTRZHD3JHNw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vitest/utils": "4.1.10",
|
||||
"@vitest/utils": "4.1.11",
|
||||
"pathe": "^2.0.3"
|
||||
},
|
||||
"funding": {
|
||||
@@ -1739,13 +1850,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vitest/snapshot": {
|
||||
"version": "4.1.10",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.10.tgz",
|
||||
"integrity": "sha512-xRkfOT1qpTAi/Ti4Y1LtfRc3kEuqxGw59eN2jN9pRWMtS/XDevekhcFSqvQqjUNGksfjMJu3Y+oJ+4Ypn2OaJw==",
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.11.tgz",
|
||||
"integrity": "sha512-pN7ikn1ON7h8ee4gIAp4AzyK+zBtJPzVbqOgu5LCEh4VaJVbPQcgYQYJIMGQPXVeJJq1fnfazis7a5pFNPahog==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vitest/pretty-format": "4.1.10",
|
||||
"@vitest/utils": "4.1.10",
|
||||
"@vitest/pretty-format": "4.1.11",
|
||||
"@vitest/utils": "4.1.11",
|
||||
"magic-string": "^0.30.21",
|
||||
"pathe": "^2.0.3"
|
||||
},
|
||||
@@ -1754,21 +1866,23 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vitest/spy": {
|
||||
"version": "4.1.10",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.10.tgz",
|
||||
"integrity": "sha512-PLf/Ugvoq5wO/b4rwYCR1h2PSIdXz7wnkQFMiUpLdtM7l6pqVFcQIBEHyT1+l+cj7mNwAfZHzqXqDyjvOuwbDw==",
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.11.tgz",
|
||||
"integrity": "sha512-apNa/prQy2qCeywhnixOHPRCgGNhvg7T4Dapfl1GahLp/R+uhBm5cPyFoNVyqsNd2h1nJxL6BqqdIjiABL60YA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/vitest"
|
||||
}
|
||||
},
|
||||
"node_modules/@vitest/utils": {
|
||||
"version": "4.1.10",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.10.tgz",
|
||||
"integrity": "sha512-fy9am/HWxbaGt/Sawrp90vt6Y6jQwf1RX77cz3uwoJwJVMli/e1IEwRPnMNJ7vKfPTwo0diXifkpPvwH9v7nGA==",
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.11.tgz",
|
||||
"integrity": "sha512-zTCVGpyFsGWBhllOyKlTw/vnr6D9qxsfSDyfbyZmTyjHw5N/VuvzHpHoQjm2ZJzn4RJgx5w4r7V0er69CmLgPQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vitest/pretty-format": "4.1.10",
|
||||
"@vitest/pretty-format": "4.1.11",
|
||||
"convert-source-map": "^2.0.0",
|
||||
"tinyrainbow": "^3.1.0"
|
||||
},
|
||||
@@ -1874,10 +1988,41 @@
|
||||
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
|
||||
"integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/ast-v8-to-istanbul": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/ast-v8-to-istanbul/-/ast-v8-to-istanbul-1.0.5.tgz",
|
||||
"integrity": "sha512-UPAgKJFSEGMWSDr3LX4tqnAb4f7KGT8O40Tyx8wbYmmZ/yn58lNCm8h3svs3eXgiGd5AXxz8NDOvXWvicq+rJA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "^0.3.31",
|
||||
"estree-walker": "^3.0.3",
|
||||
"js-tokens": "^10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ast-v8-to-istanbul/node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.31",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
|
||||
"integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.1.0",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/ast-v8-to-istanbul/node_modules/js-tokens": {
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-10.0.0.tgz",
|
||||
"integrity": "sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/astral-regex": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz",
|
||||
@@ -2155,6 +2300,7 @@
|
||||
"resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz",
|
||||
"integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
@@ -2552,7 +2698,8 @@
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
|
||||
"integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
"version": "1.1.1",
|
||||
@@ -2933,6 +3080,7 @@
|
||||
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",
|
||||
"integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/estree": "^1.0.0"
|
||||
}
|
||||
@@ -3676,6 +3824,75 @@
|
||||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/istanbul-lib-coverage": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz",
|
||||
"integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/istanbul-lib-report": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz",
|
||||
"integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"istanbul-lib-coverage": "^3.0.0",
|
||||
"make-dir": "^4.0.0",
|
||||
"supports-color": "^7.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/istanbul-lib-report/node_modules/has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/istanbul-lib-report/node_modules/supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"has-flag": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/istanbul-reports": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.2.0.tgz",
|
||||
"integrity": "sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"html-escaper": "^2.0.0",
|
||||
"istanbul-lib-report": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/istanbul-reports/node_modules/html-escaper": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
|
||||
"integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/js-tokens": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
@@ -3737,6 +3954,11 @@
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/jsqr": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/jsqr/-/jsqr-1.4.0.tgz",
|
||||
"integrity": "sha512-dxLob7q65Xg2DvstYkRpkYtmKm2sPJ9oFhrhmudT1dZvNFFTlroai3AWSpLey/w5vMcLBXRgOJsbXpdN9HzU/A=="
|
||||
},
|
||||
"node_modules/kind-of": {
|
||||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
|
||||
@@ -3755,6 +3977,14 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/lean-qr": {
|
||||
"version": "2.7.3",
|
||||
"resolved": "https://registry.npmjs.org/lean-qr/-/lean-qr-2.7.3.tgz",
|
||||
"integrity": "sha512-/eQryMvYyTL3dSMK/IlvSjUYG0ShQv62owXiFbGkSH+lFZzf4VOsPP+UInAgeUH/rPIyz59uQE9XHRbn9o8SyQ==",
|
||||
"bin": {
|
||||
"lean-qr": "cli.mjs"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz",
|
||||
@@ -4244,10 +4474,39 @@
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
|
||||
"integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/sourcemap-codec": "^1.5.5"
|
||||
}
|
||||
},
|
||||
"node_modules/magicast": {
|
||||
"version": "0.5.4",
|
||||
"resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.4.tgz",
|
||||
"integrity": "sha512-llBEhWm1SacoRwgHUoQJYtwp4PBLF4faQi5TCpIGyGs9n4y5+juI0tDgyKIfpqxckRHaHzouUEph3THklWh03w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.29.7",
|
||||
"@babel/types": "^7.29.7",
|
||||
"source-map-js": "^1.2.1"
|
||||
}
|
||||
},
|
||||
"node_modules/make-dir": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz",
|
||||
"integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"semver": "^7.5.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/make-error": {
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||
@@ -4855,7 +5114,8 @@
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
|
||||
"integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/pend": {
|
||||
"version": "1.2.0",
|
||||
@@ -6390,18 +6650,19 @@
|
||||
}
|
||||
},
|
||||
"node_modules/vitest": {
|
||||
"version": "4.1.10",
|
||||
"resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.10.tgz",
|
||||
"integrity": "sha512-R9jUTe5S4Qb0HCd4TNqpC7oGcrMssMRGXLW80ubjWsW9VH5GF8y1Y0SFLY9AbqSk6nt0PnOx4H4WNJYZ13GUPw==",
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.11.tgz",
|
||||
"integrity": "sha512-fhACrNXUidIbGSBr5FlbuBkO7VWC1ZyLl0DO4CU2DrQoAPxX84Ysxs+HeGQpii5lZWV1Q4gBZTTu49mF+A6Edw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vitest/expect": "4.1.10",
|
||||
"@vitest/mocker": "4.1.10",
|
||||
"@vitest/pretty-format": "4.1.10",
|
||||
"@vitest/runner": "4.1.10",
|
||||
"@vitest/snapshot": "4.1.10",
|
||||
"@vitest/spy": "4.1.10",
|
||||
"@vitest/utils": "4.1.10",
|
||||
"@vitest/expect": "4.1.11",
|
||||
"@vitest/mocker": "4.1.11",
|
||||
"@vitest/pretty-format": "4.1.11",
|
||||
"@vitest/runner": "4.1.11",
|
||||
"@vitest/snapshot": "4.1.11",
|
||||
"@vitest/spy": "4.1.11",
|
||||
"@vitest/utils": "4.1.11",
|
||||
"es-module-lexer": "^2.0.0",
|
||||
"expect-type": "^1.3.0",
|
||||
"magic-string": "^0.30.21",
|
||||
@@ -6429,12 +6690,12 @@
|
||||
"@edge-runtime/vm": "*",
|
||||
"@opentelemetry/api": "^1.9.0",
|
||||
"@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0",
|
||||
"@vitest/browser-playwright": "4.1.10",
|
||||
"@vitest/browser-preview": "4.1.10",
|
||||
"@vitest/browser-webdriverio": "4.1.10",
|
||||
"@vitest/coverage-istanbul": "4.1.10",
|
||||
"@vitest/coverage-v8": "4.1.10",
|
||||
"@vitest/ui": "4.1.10",
|
||||
"@vitest/browser-playwright": "4.1.11",
|
||||
"@vitest/browser-preview": "4.1.11",
|
||||
"@vitest/browser-webdriverio": "4.1.11",
|
||||
"@vitest/coverage-istanbul": "4.1.11",
|
||||
"@vitest/coverage-v8": "4.1.11",
|
||||
"@vitest/ui": "4.1.11",
|
||||
"happy-dom": "*",
|
||||
"jsdom": "*",
|
||||
"vite": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
|
||||
@@ -15,11 +15,14 @@
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@aparajita/capacitor-secure-storage": "^7.1.6",
|
||||
"@capacitor-mlkit/barcode-scanning": "^7.5.0",
|
||||
"@capacitor/app": "^7.1.2",
|
||||
"@capacitor/core": "^7.6.8",
|
||||
"@capacitor/filesystem": "^7.1.8",
|
||||
"@capacitor/local-notifications": "^7.0.7",
|
||||
"@capacitor/share": "^7.0.4",
|
||||
"jsqr": "^1.4.0",
|
||||
"lean-qr": "^2.7.3",
|
||||
"react": "^19.2.7",
|
||||
"react-dom": "^19.2.7",
|
||||
"react-router-dom": "^7.18.2",
|
||||
@@ -31,6 +34,7 @@
|
||||
"@capacitor/cli": "^7.6.8",
|
||||
"@capacitor/ios": "^7.6.8",
|
||||
"@vitejs/plugin-react": "^6.0.3",
|
||||
"@vitest/coverage-v8": "^4.1.11",
|
||||
"happy-dom": "^20.11.2",
|
||||
"linkedom": "^0.18.13",
|
||||
"vite": "^8.1.5",
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env node
|
||||
// Measures the production bundle (raw + gzip, per file and total) and, given a baseline,
|
||||
// prints the difference. CI runs it in every pipeline and keeps the result as an artifact,
|
||||
// so a merge request can fetch main's numbers and show what it adds — the one thing
|
||||
// reviewers otherwise never see until a self-hoster asks why the app got slower.
|
||||
//
|
||||
// node scripts/bundle-size.mjs --out bundle-size.json # measure dist/
|
||||
// node scripts/bundle-size.mjs --compare baseline.json current.json # print the delta
|
||||
//
|
||||
// Report-only: growth is a review question, not a build failure.
|
||||
import { readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs'
|
||||
import { join, relative } from 'node:path'
|
||||
import { gzipSync } from 'node:zlib'
|
||||
|
||||
const args = process.argv.slice(2)
|
||||
const dist = new URL('../dist/', import.meta.url).pathname
|
||||
|
||||
function walk(dir) {
|
||||
return readdirSync(dir, { withFileTypes: true }).flatMap((e) =>
|
||||
e.isDirectory() ? walk(join(dir, e.name)) : [join(dir, e.name)]
|
||||
)
|
||||
}
|
||||
|
||||
function measure() {
|
||||
const files = {}
|
||||
let raw = 0, gzip = 0
|
||||
for (const f of walk(dist)) {
|
||||
if (!/\.(js|css|html)$/.test(f)) continue
|
||||
const buf = readFileSync(f)
|
||||
const g = gzipSync(buf, { level: 9 }).length
|
||||
// Hashed chunk names change on every build; key by the stable part so deltas line up.
|
||||
const key = relative(dist, f).replace(/-[A-Za-z0-9_-]{8}\.(js|css)$/, '.$1')
|
||||
files[key] = { raw: buf.length, gzip: g }
|
||||
raw += buf.length
|
||||
gzip += g
|
||||
}
|
||||
return { total: { raw, gzip }, files }
|
||||
}
|
||||
|
||||
const kb = (n) => (n / 1024).toFixed(1).padStart(8) + ' kB'
|
||||
const delta = (a, b) => {
|
||||
const d = b - a
|
||||
if (!a) return ' (new)'
|
||||
const pct = ((d / a) * 100).toFixed(1)
|
||||
return (d >= 0 ? '+' : '') + (d / 1024).toFixed(1) + ' kB (' + (d >= 0 ? '+' : '') + pct + '%)'
|
||||
}
|
||||
|
||||
if (args[0] === '--out') {
|
||||
const r = measure()
|
||||
writeFileSync(args[1], JSON.stringify(r, null, 2))
|
||||
console.log(`bundle: ${kb(r.total.raw).trim()} raw, ${kb(r.total.gzip).trim()} gzip, ${Object.keys(r.files).length} files`)
|
||||
} else if (args[0] === '--compare') {
|
||||
let base
|
||||
try { base = JSON.parse(readFileSync(args[1], 'utf8')) } catch { base = null }
|
||||
const cur = JSON.parse(readFileSync(args[2], 'utf8'))
|
||||
if (!base) {
|
||||
console.log('no baseline from main available — nothing to compare against')
|
||||
process.exit(0)
|
||||
}
|
||||
console.log('bundle size vs main (gzip):')
|
||||
const names = new Set([...Object.keys(base.files), ...Object.keys(cur.files)])
|
||||
for (const n of [...names].sort()) {
|
||||
const a = base.files[n]?.gzip ?? 0, b = cur.files[n]?.gzip ?? 0
|
||||
if (a === b) continue
|
||||
console.log(` ${n.padEnd(40)} ${kb(a)} -> ${kb(b)} ${b ? delta(a, b) : '(removed)'}`)
|
||||
}
|
||||
console.log(` ${'TOTAL'.padEnd(40)} ${kb(base.total.gzip)} -> ${kb(cur.total.gzip)} ${delta(base.total.gzip, cur.total.gzip)}`)
|
||||
const growth = (cur.total.gzip - base.total.gzip) / base.total.gzip
|
||||
if (growth > 0.1) console.log(`\n⚠ the gzipped bundle grew by ${(growth * 100).toFixed(1)}% — worth a look in review`)
|
||||
} else {
|
||||
console.error('usage: bundle-size.mjs --out FILE | --compare BASE CURRENT')
|
||||
process.exit(2)
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import TimerFlash from './components/TimerFlash.jsx'
|
||||
import Login from './views/Login.jsx'
|
||||
import MobileOnboarding from './views/MobileOnboarding.jsx'
|
||||
import Home from './views/Home.jsx'
|
||||
import CheckIn from './views/CheckIn.jsx'
|
||||
import Plan from './views/Plan.jsx'
|
||||
import RoutineEdit from './views/RoutineEdit.jsx'
|
||||
import Workout from './views/Workout.jsx'
|
||||
@@ -113,6 +114,9 @@ function Shell() {
|
||||
{!authed ? <Login /> : needsMobileOnboarding ? <MobileOnboarding /> : (
|
||||
<Routes>
|
||||
<Route path="/home" element={<Home />} />
|
||||
{/* Gym check-in — switched off in Settings, the route falls through to the
|
||||
catch-all redirect below. */}
|
||||
{S.checkIn !== false && <Route path="/checkin" element={<CheckIn />} />}
|
||||
<Route path="/plan" element={<Plan />} />
|
||||
<Route path="/plan/r/:id" element={<RoutineEdit />} />
|
||||
<Route path="/workout" element={<Workout />} />
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { t } from '../lib/i18n.js'
|
||||
import { decodeSource } from '../lib/scan-web.js'
|
||||
import { Button } from '../components/ui.jsx'
|
||||
|
||||
// Live camera scanner for the browser/PWA (the app build uses ML Kit's own UI instead — see
|
||||
// lib/scan.js). Opens the rear camera into a <video>, decodes a frame every ~150 ms until a QR
|
||||
// shows up, then hands { value, fmt } to onFound. Cancel (or unmount) stops the camera.
|
||||
//
|
||||
// Errors are shown in place rather than thrown: a denied permission or a browser without
|
||||
// getUserMedia leaves the sheet up with a message, and the add-card form underneath still offers
|
||||
// photo import and typing.
|
||||
export default function CameraScan({ onFound, onCancel }) {
|
||||
const videoRef = useRef(null)
|
||||
const [error, setError] = useState(null)
|
||||
|
||||
useEffect(() => {
|
||||
let stream = null, timer = null, done = false
|
||||
const stop = () => {
|
||||
done = true
|
||||
if (timer) clearTimeout(timer)
|
||||
if (stream) stream.getTracks().forEach(tr => tr.stop())
|
||||
}
|
||||
;(async () => {
|
||||
if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) { setError('unavailable'); return }
|
||||
try {
|
||||
stream = await navigator.mediaDevices.getUserMedia({ video: { facingMode: { ideal: 'environment' } }, audio: false })
|
||||
} catch (e) {
|
||||
setError(e && (e.name === 'NotAllowedError' || e.name === 'SecurityError') ? 'denied' : 'unavailable')
|
||||
return
|
||||
}
|
||||
if (done) { stream.getTracks().forEach(tr => tr.stop()); return }
|
||||
const v = videoRef.current
|
||||
if (!v) return
|
||||
v.srcObject = stream
|
||||
try { await v.play() } catch (e) { /* autoplay policies; the loop below waits for frames */ }
|
||||
const tick = async () => {
|
||||
if (done) return
|
||||
if (v.readyState >= 2) {
|
||||
let code = null
|
||||
try { code = await decodeSource(v) } catch (e) { /* keep trying */ }
|
||||
if (code && !done) { stop(); onFound(code); return }
|
||||
}
|
||||
timer = setTimeout(tick, 150)
|
||||
}
|
||||
tick()
|
||||
})()
|
||||
return stop
|
||||
}, [onFound])
|
||||
|
||||
return <>
|
||||
<h3>{t('Scan')}</h3>
|
||||
{error
|
||||
? <div className="muted small" style={{ marginBottom: 16, lineHeight: 1.5 }}>
|
||||
{error === 'denied'
|
||||
? t('Camera access was denied — allow it in your browser and try again.')
|
||||
: t('Camera is not available here — import a photo or type the code instead.')}
|
||||
</div>
|
||||
: <>
|
||||
<div className="cam-wrap">
|
||||
{/* playsInline keeps iOS from going full-screen; muted satisfies autoplay rules. */}
|
||||
<video ref={videoRef} playsInline muted autoPlay />
|
||||
<div className="cam-frame" aria-hidden="true" />
|
||||
</div>
|
||||
<div className="muted small" style={{ textAlign: 'center', margin: '12px 0 16px' }}>{t('Point the camera at the QR code')}</div>
|
||||
</>}
|
||||
<Button variant="tinted" onClick={onCancel}>{t('Cancel')}</Button>
|
||||
</>
|
||||
}
|
||||
@@ -112,6 +112,11 @@ const P = {
|
||||
signOut: <><path d="M14.2 4.6H7a1.9 1.9 0 0 0-1.9 1.9v11a1.9 1.9 0 0 0 1.9 1.9h7.2" /><path d="m16.8 8.4 3.6 3.6-3.6 3.6M20.4 12H10.2" /></>,
|
||||
shuffle: <><path d="M3.6 7.2h2.9c1.6 0 2.8.9 3.8 2.4l3 4.8c1 1.5 2.2 2.4 3.8 2.4h2.9M3.6 16.8h2.9c1.6 0 2.8-.9 3.8-2.4l.7-1.1M15.6 9.9l.7-1.1c1-1.5 2.2-2.4 3.8-2.4h1.9" /><path d="m17.9 4.3 2.8 2.1-2.8 2.1M17.9 14.7l2.8 2.1-2.8 2.1" /></>,
|
||||
info: <><circle cx="12" cy="12" r="8.2" /><path d="M12 11v5.4" /><circle cx="12" cy="7.9" r=".9" fill="currentColor" stroke="none" /></>,
|
||||
// Three position-detection squares plus a scatter of modules — reads as "QR / scan this"
|
||||
// at tab-bar size without trying to draw a real (unscannable) code.
|
||||
qr: <><rect x="3.6" y="3.6" width="6" height="6" rx="1.2" /><rect x="14.4" y="3.6" width="6" height="6" rx="1.2" /><rect x="3.6" y="14.4" width="6" height="6" rx="1.2" /><path d="M14.4 14.4h2.4v2.4M20.4 14.4v.01M14.4 20.4h.01M17.4 17.4h3M17.4 20.4h3" /></>,
|
||||
camera: <><path d="M3.6 8.8a2 2 0 0 1 2-2h1.9l1.3-2.1h6.4l1.3 2.1h1.9a2 2 0 0 1 2 2v8.4a2 2 0 0 1-2 2H5.6a2 2 0 0 1-2-2Z" /><circle cx="12" cy="12.8" r="3.3" /></>,
|
||||
image: <><rect x="3.6" y="4.8" width="16.8" height="14.4" rx="2.6" /><circle cx="8.6" cy="9.6" r="1.7" /><path d="m4.4 17.4 4.8-4.6 3.3 3 3-2.6 4.1 4" /></>,
|
||||
warning: <><path d="M12 3.4 21.2 19.4H2.8Z" /><path d="M12 9.6v4.4" /><circle cx="12" cy="16.6" r=".9" fill="currentColor" stroke="none" /></>,
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { renderQrToCanvas } from '../lib/qr.js'
|
||||
|
||||
// Renders a gym check-in code as a QR image on a <canvas>. lean-qr draws one module per pixel;
|
||||
// CSS (.qr-canvas) scales it up with image-rendering: pixelated so it stays razor-sharp at any
|
||||
// display size without re-generating. Regenerated from `value` on every change — we never store
|
||||
// the picture (see lib/qr.js).
|
||||
//
|
||||
// The lib loads via dynamic import, so the first paint is a frame behind; a plain box holds the
|
||||
// space until then. A render failure (empty value, lib load error) shows nothing rather than a
|
||||
// broken canvas — the caller decides what an unusable card looks like.
|
||||
export default function QrCanvas({ value, size = 240, className = '' }) {
|
||||
const ref = useRef(null)
|
||||
const [ok, setOk] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
let alive = true
|
||||
setOk(false)
|
||||
renderQrToCanvas(ref.current, value)
|
||||
.then(mods => { if (alive) setOk(mods > 0) })
|
||||
.catch(() => { if (alive) setOk(false) })
|
||||
return () => { alive = false }
|
||||
}, [value])
|
||||
|
||||
return (
|
||||
<canvas
|
||||
ref={ref}
|
||||
className={'qr-canvas ' + className}
|
||||
style={{ width: size, height: size, opacity: ok ? 1 : 0 }}
|
||||
aria-label="QR code"
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -1069,6 +1069,47 @@ h4.sec{
|
||||
.hm-wrap{display:flex;flex-direction:column;align-items:center}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------- gym check-in -- */
|
||||
/* Mobile-only feature (views/CheckIn.jsx): saved membership codes shown as QR, swiped
|
||||
through horizontally. The rail is a scroll-snap track — one card per viewport, no JS
|
||||
carousel — with a trailing "+" card to add another. */
|
||||
.ci-rail{
|
||||
display:flex;gap:14px;overflow-x:auto;scroll-snap-type:x mandatory;
|
||||
-webkit-overflow-scrolling:touch;scrollbar-width:none;
|
||||
padding:4px 0 8px;margin:0 -16px;padding-left:16px;padding-right:16px;
|
||||
}
|
||||
.ci-rail::-webkit-scrollbar{display:none}
|
||||
.ci-card{
|
||||
scroll-snap-align:center;flex:0 0 100%;box-sizing:border-box;
|
||||
background:var(--surface);border-radius:var(--r-xl);padding:22px 18px;
|
||||
display:flex;flex-direction:column;align-items:center;gap:14px;
|
||||
}
|
||||
.ci-card .ci-label{font-size:19px;font-weight:600;letter-spacing:-.014em;text-align:center}
|
||||
.ci-card .ci-value{font-size:14px;color:var(--label-2);word-break:break-all;text-align:center;font-variant-numeric:tabular-nums}
|
||||
/* The QR itself: lean-qr paints 1 module per pixel, so scale it up with the browser's
|
||||
nearest-neighbour so every module stays a crisp square instead of a blurred blob. White
|
||||
quiet-zone padding is baked in by the renderer; the plate underneath just frames it. */
|
||||
.ci-qr-plate{background:#fff;border-radius:var(--r-lg);padding:16px}
|
||||
.qr-canvas{display:block;image-rendering:pixelated;image-rendering:crisp-edges;transition:opacity var(--fast)}
|
||||
/* the trailing add card — a big + on a dashed outline, same footprint as a real card */
|
||||
.ci-add{
|
||||
scroll-snap-align:center;flex:0 0 100%;box-sizing:border-box;
|
||||
min-height:280px;border-radius:var(--r-xl);
|
||||
border:2px dashed var(--surface-3);background:none;color:var(--label-2);
|
||||
display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;
|
||||
}
|
||||
.ci-add:active{background:var(--surface);transform:scale(.99)}
|
||||
.ci-add .icn{font-size:40px;--icon-stroke:1.8}
|
||||
.ci-add .ci-add-t{font-size:16px;font-weight:500}
|
||||
/* dots under the rail — which card you're on. Purely a hint; the rail itself is the control. */
|
||||
.ci-dots{display:flex;justify-content:center;gap:7px;margin-top:4px}
|
||||
.ci-dot{width:7px;height:7px;border-radius:50%;background:var(--surface-3);transition:background var(--fast),transform var(--fast)}
|
||||
.ci-dot.on{background:var(--acc);transform:scale(1.15)}
|
||||
/* browser camera sheet (components/CameraScan.jsx): the video fills a portrait plate, a dashed
|
||||
square in the middle says "put the code here" — decoding reads the whole frame regardless. */
|
||||
.cam-wrap{position:relative;width:100%;aspect-ratio:3/4;max-height:58vh;border-radius:var(--r-lg);overflow:hidden;background:#000}
|
||||
.cam-wrap video{width:100%;height:100%;object-fit:cover;display:block}
|
||||
.cam-frame{position:absolute;inset:0;margin:auto;width:62%;aspect-ratio:1;border:2px dashed rgba(255,255,255,.75);border-radius:14px;pointer-events:none}
|
||||
/* ------------------------------------------------- the Coach entry on Plan -- */
|
||||
.coach-cta{
|
||||
display:flex;align-items:center;gap:13px;width:100%;text-align:left;
|
||||
|
||||
@@ -27,11 +27,11 @@ describe('Brazilian Portuguese locale', () => {
|
||||
.sort(byCodeUnit)
|
||||
const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex')
|
||||
|
||||
expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(586)
|
||||
expect(inherited).toHaveLength(559)
|
||||
expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(603)
|
||||
expect(inherited).toHaveLength(571)
|
||||
// If this fails, review the changed keys and wording before accepting a new hash. From
|
||||
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
|
||||
expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('ae49ea702bb600947e67170a1ef61c0518a326724c83b8484ce7199f1393700b')
|
||||
expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('1bc5c2825a8e797b2b8e129d1c06b6baca568e95ea9a1e43ae9dacae4bc98801')
|
||||
})
|
||||
|
||||
test('does not leak European Portuguese UI terms', () => {
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
// QR rendering for the gym check-in cards (see views/CheckIn.jsx).
|
||||
//
|
||||
// We never store a photo of a membership card, only its decoded value (+ its symbology in
|
||||
// `fmt`). The picture a turnstile scanner reads is regenerated from that value every time the
|
||||
// card is shown, here.
|
||||
//
|
||||
// lean-qr (MIT, see NOTICE.md) is loaded with a dynamic import so its ~4kB only loads when a
|
||||
// card is actually shown, on every platform — the PWA renders the same code as the app.
|
||||
//
|
||||
// Scope: lean-qr generates QR codes only. A gym card is virtually always a QR code, and the
|
||||
// capture flow (lib/scan.js) refuses any symbology we cannot faithfully reproduce, so a stored
|
||||
// card is guaranteed renderable here — canRenderFmt() is the single source of that truth, shared
|
||||
// by both sides.
|
||||
|
||||
let _leanqr = null
|
||||
|
||||
// Cached loader for lean-qr. Resolves once; every card after the first reuses the same module.
|
||||
async function loadLeanQr() {
|
||||
if (!_leanqr) _leanqr = await import('lean-qr')
|
||||
return _leanqr
|
||||
}
|
||||
|
||||
// The symbologies we can both read (mlkit) AND redraw (lean-qr). Stored `fmt` is a lower-cased
|
||||
// BarcodeFormat. Only QR qualifies: reproducing an EAN/Code128/etc. would need a 1D renderer we
|
||||
// deliberately did not add, and a code we can't redraw faithfully is worse than not storing it —
|
||||
// it would look scannable but carry the wrong bars.
|
||||
export function canRenderFmt(fmt) {
|
||||
return normalizeFmt(fmt) === 'qrcode'
|
||||
}
|
||||
|
||||
// mlkit reports BarcodeFormat as e.g. 'QR_CODE' | 'QrCode'; older callers may pass 'qr'. Fold
|
||||
// them all to a stable lower-case token we store and compare on.
|
||||
export function normalizeFmt(fmt) {
|
||||
const s = String(fmt || '').toLowerCase().replace(/[^a-z0-9]/g, '')
|
||||
if (s === 'qr' || s === 'qrcode') return 'qrcode'
|
||||
return s
|
||||
}
|
||||
|
||||
// Draw `value` as a QR code onto `canvas` at 1 module per pixel; CSS scales it up with
|
||||
// image-rendering: pixelated (see .qr-canvas in index.css) so it stays crisp at any size.
|
||||
// `on`/`off` default to solid black on white — turnstile scanners want maximum contrast, not
|
||||
// the app's theme colours, and a themed (e.g. lime-on-black) code fails to read on many
|
||||
// readers. Returns the module count (QR size) so the caller can react if it wants.
|
||||
export async function renderQrToCanvas(canvas, value, { on = '#000000', off = '#ffffff' } = {}) {
|
||||
if (!canvas || !value) return 0
|
||||
const { generate, correction } = await loadLeanQr()
|
||||
// Medium error correction: a good default that survives a scratched or partly-obscured phone
|
||||
// screen without inflating the code so much it gets dense on small screens.
|
||||
const code = generate(value, { minCorrectionLevel: correction.M })
|
||||
code.toCanvas(canvas, {
|
||||
on: hexToRgba(on),
|
||||
off: hexToRgba(off),
|
||||
padX: 2,
|
||||
padY: 2,
|
||||
})
|
||||
return code.size
|
||||
}
|
||||
|
||||
// lean-qr wants colours as [r,g,b,a]. Accept a #rrggbb (or #rgb) string; anything else is
|
||||
// treated as opaque black/white by the caller's defaults, so this only has to handle hex.
|
||||
function hexToRgba(hex) {
|
||||
let h = String(hex).replace('#', '')
|
||||
if (h.length === 3) h = h.split('').map(c => c + c).join('')
|
||||
const n = parseInt(h, 16)
|
||||
return [(n >> 16) & 255, (n >> 8) & 255, n & 255, 255]
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { normalizeFmt, canRenderFmt } from './qr.js'
|
||||
|
||||
// The QR helpers decide which scanned/typed codes the check-in feature will store: it can read
|
||||
// many symbologies but only redraw QR, so canRenderFmt is the gate, and normalizeFmt is what
|
||||
// folds every spelling mlkit might report into the single token everything else compares on.
|
||||
|
||||
describe('normalizeFmt', () => {
|
||||
it('folds every QR spelling to "qrcode"', () => {
|
||||
// mlkit's BarcodeFormat, the enum-ish casings, and the casual 'qr' all mean the same thing.
|
||||
expect(normalizeFmt('QR_CODE')).toBe('qrcode')
|
||||
expect(normalizeFmt('QrCode')).toBe('qrcode')
|
||||
expect(normalizeFmt('qrcode')).toBe('qrcode')
|
||||
expect(normalizeFmt('qr')).toBe('qrcode')
|
||||
expect(normalizeFmt('QR')).toBe('qrcode')
|
||||
})
|
||||
|
||||
it('lower-cases and strips separators for other formats', () => {
|
||||
expect(normalizeFmt('EAN_13')).toBe('ean13')
|
||||
expect(normalizeFmt('Code128')).toBe('code128')
|
||||
expect(normalizeFmt('CODE_128')).toBe('code128')
|
||||
})
|
||||
|
||||
it('treats empty / nullish as an empty token rather than throwing', () => {
|
||||
expect(normalizeFmt('')).toBe('')
|
||||
expect(normalizeFmt(null)).toBe('')
|
||||
expect(normalizeFmt(undefined)).toBe('')
|
||||
})
|
||||
})
|
||||
|
||||
describe('canRenderFmt', () => {
|
||||
it('accepts only QR, in any spelling', () => {
|
||||
expect(canRenderFmt('QR_CODE')).toBe(true)
|
||||
expect(canRenderFmt('QrCode')).toBe(true)
|
||||
expect(canRenderFmt('qr')).toBe(true)
|
||||
})
|
||||
|
||||
it('rejects 1D and other 2D symbologies we cannot faithfully redraw', () => {
|
||||
// These are readable by the scanner but lean-qr can't reproduce them, so a card in one of
|
||||
// these formats must never be stored — it would display as the wrong bars at the turnstile.
|
||||
for (const fmt of ['EAN_13', 'EAN_8', 'CODE_128', 'CODE_39', 'ITF', 'UPC_A', 'PDF_417', 'AZTEC', 'DATA_MATRIX']) {
|
||||
expect(canRenderFmt(fmt)).toBe(false)
|
||||
}
|
||||
})
|
||||
|
||||
it('rejects empty / unknown formats', () => {
|
||||
expect(canRenderFmt('')).toBe(false)
|
||||
expect(canRenderFmt(null)).toBe(false)
|
||||
expect(canRenderFmt('something-else')).toBe(false)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,83 @@
|
||||
// Browser-side QR decoding for the gym check-in — the PWA half of lib/scan.js. The app build
|
||||
// hands scanning to ML Kit; here in a browser tab (installed PWA on a phone, most often) we do
|
||||
// it ourselves: draw the source — an uploaded photo or a live <video> frame — onto an offscreen
|
||||
// canvas and decode the pixels.
|
||||
//
|
||||
// Two decoders, tried in order:
|
||||
// 1. BarcodeDetector — the browser's own (Chrome/Edge on Android, Samsung Internet). Native
|
||||
// speed and quality when it exists; asked for QR only.
|
||||
// 2. jsQR (Apache-2.0, see NOTICE.md) — pure JS, works everywhere including iOS Safari, which
|
||||
// has no BarcodeDetector. Loaded with a dynamic import so it only ships when someone scans.
|
||||
//
|
||||
// decodeImageData is the pure core (pixels in, string out) and is what the unit test exercises;
|
||||
// decodeSource wraps it with the canvas plumbing the browser paths need.
|
||||
import { normalizeFmt } from './qr.js'
|
||||
|
||||
let _jsqr = null
|
||||
async function loadJsQr() {
|
||||
if (!_jsqr) _jsqr = (await import('jsqr')).default
|
||||
return _jsqr
|
||||
}
|
||||
|
||||
let _detector = null
|
||||
function nativeDetector() {
|
||||
if (_detector !== null) return _detector
|
||||
try {
|
||||
_detector = (typeof BarcodeDetector === 'function') ? new BarcodeDetector({ formats: ['qr_code'] }) : false
|
||||
} catch (e) { _detector = false }
|
||||
return _detector
|
||||
}
|
||||
|
||||
// { data, width, height } (an ImageData or anything shaped like one) → { value, fmt } | null.
|
||||
// jsQR only; the native detector wants a drawable, not raw pixels, so it lives in decodeSource.
|
||||
export async function decodeImageData(img) {
|
||||
if (!img || !img.data || !img.width || !img.height) return null
|
||||
const jsQR = await loadJsQr()
|
||||
const hit = jsQR(img.data, img.width, img.height, { inversionAttempts: 'attemptBoth' })
|
||||
return hit && hit.data ? { value: hit.data, fmt: 'qrcode' } : null
|
||||
}
|
||||
|
||||
// Decode from anything drawImage accepts: <video>, <img>, ImageBitmap, canvas. The source is
|
||||
// scaled down to at most MAX px on its long edge — plenty for a QR, and it keeps jsQR fast enough
|
||||
// to run on every few video frames on a phone. Reuses one canvas across calls.
|
||||
const MAX = 800
|
||||
let _canvas = null
|
||||
export async function decodeSource(source) {
|
||||
const sw = source.videoWidth || source.naturalWidth || source.width || 0
|
||||
const sh = source.videoHeight || source.naturalHeight || source.height || 0
|
||||
if (!sw || !sh) return null
|
||||
const k = Math.min(1, MAX / Math.max(sw, sh))
|
||||
const w = Math.max(1, Math.round(sw * k)), h = Math.max(1, Math.round(sh * k))
|
||||
if (!_canvas) _canvas = document.createElement('canvas')
|
||||
_canvas.width = w; _canvas.height = h
|
||||
const ctx = _canvas.getContext('2d', { willReadFrequently: true })
|
||||
ctx.drawImage(source, 0, 0, w, h)
|
||||
|
||||
const det = nativeDetector()
|
||||
if (det) {
|
||||
try {
|
||||
const found = await det.detect(_canvas)
|
||||
const b = found && found.find(x => x.rawValue)
|
||||
if (b) return { value: b.rawValue, fmt: normalizeFmt(b.format) || 'qrcode' }
|
||||
} catch (e) { /* fall through to jsQR */ }
|
||||
}
|
||||
return decodeImageData(ctx.getImageData(0, 0, w, h))
|
||||
}
|
||||
|
||||
// A picked File → { value, fmt } | null. createImageBitmap honours EXIF orientation where the
|
||||
// browser supports it, which matters for photos of a card taken in portrait.
|
||||
export async function importCodeFromImageWeb(file) {
|
||||
if (!file) return null
|
||||
let bmp
|
||||
if (typeof createImageBitmap === 'function') {
|
||||
bmp = await createImageBitmap(file)
|
||||
} else {
|
||||
bmp = await new Promise((resolve, reject) => {
|
||||
const img = new Image()
|
||||
img.onload = () => resolve(img)
|
||||
img.onerror = () => reject(new Error('bad image'))
|
||||
img.src = URL.createObjectURL(file)
|
||||
})
|
||||
}
|
||||
try { return await decodeSource(bmp) } finally { if (bmp.close) bmp.close() }
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { generate } from 'lean-qr'
|
||||
import { decodeImageData } from './scan-web.js'
|
||||
|
||||
// Round trip through the two libraries the browser path relies on: lean-qr draws a code (the
|
||||
// same renderer the card view uses), jsQR reads it back. Pixels are built by hand from
|
||||
// code.get(x, y) — no canvas in this environment — scaled 4× with a 4-module quiet zone, which
|
||||
// is what a phone camera would roughly see.
|
||||
function rasterize(code, scale = 4, quiet = 4) {
|
||||
const n = code.size + quiet * 2
|
||||
const w = n * scale
|
||||
const data = new Uint8ClampedArray(w * w * 4)
|
||||
for (let y = 0; y < w; y++) {
|
||||
for (let x = 0; x < w; x++) {
|
||||
const mx = Math.floor(x / scale) - quiet, my = Math.floor(y / scale) - quiet
|
||||
const dark = mx >= 0 && my >= 0 && mx < code.size && my < code.size && code.get(mx, my)
|
||||
const v = dark ? 0 : 255
|
||||
const i = (y * w + x) * 4
|
||||
data[i] = v; data[i + 1] = v; data[i + 2] = v; data[i + 3] = 255
|
||||
}
|
||||
}
|
||||
return { data, width: w, height: w }
|
||||
}
|
||||
|
||||
describe('decodeImageData', () => {
|
||||
it('reads back a code lean-qr generated', async () => {
|
||||
const value = 'MEMBER-0042-FITZONE'
|
||||
const hit = await decodeImageData(rasterize(generate(value)))
|
||||
expect(hit).toEqual({ value, fmt: 'qrcode' })
|
||||
})
|
||||
|
||||
it('reads a URL-shaped code, the other common gym format', async () => {
|
||||
const value = 'https://checkin.example.com/m/8f3a1c?v=2'
|
||||
const hit = await decodeImageData(rasterize(generate(value)))
|
||||
expect(hit?.value).toBe(value)
|
||||
})
|
||||
|
||||
it('returns null for blank pixels and for junk input', async () => {
|
||||
const blank = { data: new Uint8ClampedArray(64 * 64 * 4).fill(255), width: 64, height: 64 }
|
||||
expect(await decodeImageData(blank)).toBeNull()
|
||||
expect(await decodeImageData(null)).toBeNull()
|
||||
expect(await decodeImageData({ data: null, width: 1, height: 1 })).toBeNull()
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,112 @@
|
||||
// Capturing a gym check-in code (see views/CheckIn.jsx). Three ways in:
|
||||
// 1. type it — no plugin, handled entirely in the view
|
||||
// 2. import a photo — importCodeFromImage(file): decode a picture the user already has
|
||||
// 3. scan with camera — scanCode(): live camera via ML Kit's own scanner UI (app build);
|
||||
// in a browser the view opens components/CameraScan.jsx instead
|
||||
//
|
||||
// The app build (MOBILE) decodes with @capacitor-mlkit/barcode-scanning (Apache-2.0, see
|
||||
// NOTICE.md), dynamic-imported so it never lands in the web bundle. In a browser — the PWA on a
|
||||
// phone is the common case — photo import goes through lib/scan-web.js (BarcodeDetector where the
|
||||
// browser has one, jsQR otherwise). scanCode() itself is app-only: ML Kit brings its own camera
|
||||
// UI, the browser path is a React sheet and lives with the view.
|
||||
//
|
||||
// What comes back is a normalized { value, fmt } (or null when the user cancels / nothing was
|
||||
// found). `value` is the code's machine-readable content; `fmt` is a lower-cased symbology token
|
||||
// matching lib/qr.js's normalizeFmt. The caller checks canRenderFmt(fmt) before saving — we can
|
||||
// read many barcode kinds but only redraw QR, so a non-QR code is reported and refused there, not
|
||||
// silently stored.
|
||||
import { MOBILE } from './mobile.js'
|
||||
import { normalizeFmt } from './qr.js'
|
||||
|
||||
// A found barcode from either path → our stored shape. mlkit gives rawValue (machine-readable,
|
||||
// what a turnstile actually reads) and a BarcodeFormat; we keep rawValue and fold the format.
|
||||
function toCode(barcode) {
|
||||
if (!barcode) return null
|
||||
const value = barcode.rawValue || barcode.displayValue || ''
|
||||
if (!value) return null
|
||||
return { value, fmt: normalizeFmt(barcode.format) }
|
||||
}
|
||||
|
||||
// Live camera scan. On Android this opens Google's own full-screen scanner UI (no camera view we
|
||||
// have to host); on iOS the plugin's native scanner. Returns the first barcode found, or null if
|
||||
// the user backed out without scanning. Throws if scanning isn't supported or permission is hard-
|
||||
// denied so the caller can explain why.
|
||||
export async function scanCode() {
|
||||
if (!MOBILE) throw new Error('Scanning is only available in the app')
|
||||
const { BarcodeScanner } = await import('@capacitor-mlkit/barcode-scanning')
|
||||
|
||||
const { supported } = await BarcodeScanner.isSupported()
|
||||
if (!supported) throw new Error('unsupported')
|
||||
|
||||
await ensureCameraPermission(BarcodeScanner)
|
||||
await ensureScannerModule(BarcodeScanner)
|
||||
|
||||
const { barcodes } = await BarcodeScanner.scan()
|
||||
return barcodes && barcodes.length ? toCode(barcodes[0]) : null
|
||||
}
|
||||
|
||||
// Decode a barcode out of an image the user picked. mlkit's readBarcodesFromImage wants a local
|
||||
// file PATH, and a browser <input type=file> only hands us a File/blob — so we bounce the bytes
|
||||
// through the app's cache dir (reusing @capacitor/filesystem, already a dependency) to get a real
|
||||
// path, decode, then delete the temp file. Returns the first barcode, or null if none was found.
|
||||
export async function importCodeFromImage(file) {
|
||||
if (!file) return null
|
||||
if (!MOBILE) return (await import('./scan-web.js')).importCodeFromImageWeb(file)
|
||||
const { BarcodeScanner } = await import('@capacitor-mlkit/barcode-scanning')
|
||||
const { Filesystem, Directory } = await import('@capacitor/filesystem')
|
||||
|
||||
const base64 = await fileToBase64(file)
|
||||
const name = `checkin-import-${Date.now()}.${extOf(file.name)}`
|
||||
let uri = null
|
||||
try {
|
||||
const w = await Filesystem.writeFile({ path: name, directory: Directory.Cache, data: base64 })
|
||||
uri = w.uri
|
||||
const { barcodes } = await BarcodeScanner.readBarcodesFromImage({ path: uri })
|
||||
return barcodes && barcodes.length ? toCode(barcodes[0]) : null
|
||||
} finally {
|
||||
// Best effort — a leftover temp image in the cache dir is harmless, but tidy up anyway.
|
||||
try { await Filesystem.deleteFile({ path: name, directory: Directory.Cache }) } catch (e) { /* */ }
|
||||
}
|
||||
}
|
||||
|
||||
// Camera permission for the live scanner. checkPermissions first so an already-granted user never
|
||||
// sees a prompt; request only when needed. A hard denial throws so the caller can point the user
|
||||
// at Settings rather than silently doing nothing.
|
||||
async function ensureCameraPermission(BarcodeScanner) {
|
||||
let { camera } = await BarcodeScanner.checkPermissions()
|
||||
if (camera !== 'granted' && camera !== 'limited') {
|
||||
({ camera } = await BarcodeScanner.requestPermissions())
|
||||
}
|
||||
if (camera !== 'granted' && camera !== 'limited') throw new Error('permission-denied')
|
||||
}
|
||||
|
||||
// On Android the ML Kit scanner ships as an on-demand Google Play module, absent on first use.
|
||||
// Install it (once) before scanning; a no-op / not-applicable on iOS, where the check simply
|
||||
// reports available. Failures here are non-fatal — scan() will surface a clearer error if it
|
||||
// truly can't proceed.
|
||||
async function ensureScannerModule(BarcodeScanner) {
|
||||
try {
|
||||
if (!BarcodeScanner.isGoogleBarcodeScannerModuleAvailable) return
|
||||
const { available } = await BarcodeScanner.isGoogleBarcodeScannerModuleAvailable()
|
||||
if (!available) await BarcodeScanner.installGoogleBarcodeScannerModule()
|
||||
} catch (e) { /* let scan() decide whether it can still run */ }
|
||||
}
|
||||
|
||||
// A File/Blob → bare base64 (no data: prefix), which Filesystem.writeFile expects.
|
||||
function fileToBase64(file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const r = new FileReader()
|
||||
r.onerror = () => reject(r.error || new Error('read failed'))
|
||||
r.onload = () => {
|
||||
const s = String(r.result || '')
|
||||
const comma = s.indexOf(',')
|
||||
resolve(comma === -1 ? s : s.slice(comma + 1))
|
||||
}
|
||||
r.readAsDataURL(file)
|
||||
})
|
||||
}
|
||||
|
||||
function extOf(filename) {
|
||||
const m = /\.([a-z0-9]+)$/i.exec(filename || '')
|
||||
return m ? m[1].toLowerCase() : 'jpg'
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { scanCode, importCodeFromImage } from './scan.js'
|
||||
|
||||
// In the test environment VITE_MOBILE is unset, so MOBILE is false — the same as a web build.
|
||||
// The native ML Kit scanner must refuse to run there rather than reach for a plugin that isn't
|
||||
// present; the view opens the browser camera sheet instead. (On-device decoding is exercised by
|
||||
// hand; the browser decoder has its own round-trip test in scan-web.test.js.)
|
||||
|
||||
describe('scan off mobile', () => {
|
||||
it('scanCode rejects — the native scanner is app-only', async () => {
|
||||
await expect(scanCode()).rejects.toThrow(/only available in the app/)
|
||||
})
|
||||
|
||||
it('importCodeFromImage takes the browser path and is a no-op without a file', async () => {
|
||||
expect(await importCodeFromImage(null)).toBeNull()
|
||||
})
|
||||
})
|
||||
@@ -1105,4 +1105,34 @@ export default {
|
||||
'Set to 0 to go back to the default ({0}).': 'Auf 0 stellen, um zum Standard ({0}) zurückzukehren.',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Gilt überall für diese Übung, nicht nur in diesem Plan.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Eingetragen wird weiterhin das Gesamtgewicht — die Stange zählt nur für die Scheiben-Rechnung pro Seite.',
|
||||
// Gym check-in (mobile-only)
|
||||
'Check in': 'Einchecken',
|
||||
'At the gym': 'Im Studio',
|
||||
'Show this at the gym': 'Im Studio vorzeigen',
|
||||
'Add your gym card': 'Studio-Karte hinzufügen',
|
||||
'Add a card': 'Karte hinzufügen',
|
||||
'Type the number on your membership card, import a photo of it, or scan it with the camera. No extra app needed at the gym — just open this screen.': 'Tippe die Nummer deiner Mitgliedskarte ein, importiere ein Foto oder scanne sie mit der Kamera. Keine zusätzliche App im Studio nötig — öffne einfach diesen Bildschirm.',
|
||||
'Remove this card?': 'Diese Karte entfernen?',
|
||||
'Scan it, import a photo, or type the code by hand.': 'Scanne sie, importiere ein Foto oder tippe den Code von Hand ein.',
|
||||
'Scan': 'Scannen',
|
||||
'Import photo': 'Foto importieren',
|
||||
'Label': 'Bezeichnung',
|
||||
'e.g. FitZone downtown': 'z. B. FitZone Zentrum',
|
||||
'Code': 'Code',
|
||||
'Membership number or code': 'Mitgliedsnummer oder Code',
|
||||
'Save card': 'Karte speichern',
|
||||
'Gym card': 'Studio-Karte',
|
||||
'Card added': 'Karte hinzugefügt',
|
||||
'Nothing to save yet': 'Noch nichts zu speichern',
|
||||
"That's not a QR code — only QR cards can be shown here": 'Das ist kein QR-Code — hier lassen sich nur QR-Karten anzeigen',
|
||||
'No QR code found in that image': 'Kein QR-Code im Bild gefunden',
|
||||
'Could not read that image': 'Bild konnte nicht gelesen werden',
|
||||
'Camera permission is needed to scan. Enable it in Settings.': 'Zum Scannen wird die Kamera-Berechtigung benötigt. Aktiviere sie in den Einstellungen.',
|
||||
'Scanning is not available on this device.': 'Scannen ist auf diesem Gerät nicht verfügbar.',
|
||||
'Could not start the scanner': 'Scanner konnte nicht gestartet werden',
|
||||
'Gym check-in': 'Gym-Check-in',
|
||||
'Show a card on Home with your membership QR codes.': 'Zeigt auf Start eine Karte mit deinen Mitglieds-QR-Codes.',
|
||||
'Point the camera at the QR code': 'Richte die Kamera auf den QR-Code',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'Die Kamera ist hier nicht verfügbar — importiere ein Foto oder tippe den Code ein.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'Kamerazugriff wurde verweigert — erlaube ihn im Browser und versuche es erneut.',
|
||||
}
|
||||
@@ -1086,4 +1086,34 @@ export default {
|
||||
'Set to 0 to go back to the default ({0}).': 'Pon 0 para volver al valor por defecto ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Se aplica a este ejercicio en todas partes, no solo en este plan.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Sigues registrando el peso total — la barra solo se usa para calcular los discos por lado.',
|
||||
// Gym check-in (mobile-only)
|
||||
'Check in': 'Registrarse',
|
||||
'At the gym': 'En el gimnasio',
|
||||
'Show this at the gym': 'Muestra esto en el gimnasio',
|
||||
'Add your gym card': 'Añade tu tarjeta del gimnasio',
|
||||
'Add a card': 'Añadir una tarjeta',
|
||||
'Type the number on your membership card, import a photo of it, or scan it with the camera. No extra app needed at the gym — just open this screen.': 'Escribe el número de tu tarjeta de socio, importa una foto o escanéala con la cámara. No hace falta otra app en el gimnasio — solo abre esta pantalla.',
|
||||
'Remove this card?': '¿Eliminar esta tarjeta?',
|
||||
'Scan it, import a photo, or type the code by hand.': 'Escanéala, importa una foto o escribe el código a mano.',
|
||||
'Scan': 'Escanear',
|
||||
'Import photo': 'Importar foto',
|
||||
'Label': 'Etiqueta',
|
||||
'e.g. FitZone downtown': 'p. ej. FitZone centro',
|
||||
'Code': 'Código',
|
||||
'Membership number or code': 'Número de socio o código',
|
||||
'Save card': 'Guardar tarjeta',
|
||||
'Gym card': 'Tarjeta del gimnasio',
|
||||
'Card added': 'Tarjeta añadida',
|
||||
'Nothing to save yet': 'Nada que guardar todavía',
|
||||
"That's not a QR code — only QR cards can be shown here": 'Eso no es un código QR — aquí solo se pueden mostrar tarjetas QR',
|
||||
'No QR code found in that image': 'No se encontró ningún código QR en esa imagen',
|
||||
'Could not read that image': 'No se pudo leer esa imagen',
|
||||
'Camera permission is needed to scan. Enable it in Settings.': 'Se necesita permiso de cámara para escanear. Actívalo en Ajustes.',
|
||||
'Scanning is not available on this device.': 'El escaneo no está disponible en este dispositivo.',
|
||||
'Could not start the scanner': 'No se pudo iniciar el escáner',
|
||||
'Gym check-in': 'Check-in del gimnasio',
|
||||
'Show a card on Home with your membership QR codes.': 'Muestra en Inicio una tarjeta con tus códigos QR de socio.',
|
||||
'Point the camera at the QR code': 'Apunta la cámara al código QR',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'La cámara no está disponible aquí — importa una foto o escribe el código.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'Se denegó el acceso a la cámara — permítelo en el navegador e inténtalo de nuevo.',
|
||||
}
|
||||
@@ -1086,4 +1086,34 @@ export default {
|
||||
'Set to 0 to go back to the default ({0}).': 'Mets 0 pour revenir à la valeur par défaut ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'S’applique à cet exercice partout, pas seulement dans ce plan.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Tu enregistres toujours le poids total — la barre ne sert qu’au calcul des disques par côté.',
|
||||
// Gym check-in (mobile-only)
|
||||
'Check in': 'Enregistrement',
|
||||
'At the gym': 'À la salle',
|
||||
'Show this at the gym': 'À présenter à la salle',
|
||||
'Add your gym card': 'Ajoute ta carte de salle',
|
||||
'Add a card': 'Ajouter une carte',
|
||||
'Type the number on your membership card, import a photo of it, or scan it with the camera. No extra app needed at the gym — just open this screen.': 'Saisis le numéro de ta carte de membre, importe une photo ou scanne-la avec l’appareil photo. Aucune autre appli nécessaire à la salle — ouvre simplement cet écran.',
|
||||
'Remove this card?': 'Supprimer cette carte ?',
|
||||
'Scan it, import a photo, or type the code by hand.': 'Scanne-la, importe une photo ou saisis le code à la main.',
|
||||
'Scan': 'Scanner',
|
||||
'Import photo': 'Importer une photo',
|
||||
'Label': 'Libellé',
|
||||
'e.g. FitZone downtown': 'p. ex. FitZone centre-ville',
|
||||
'Code': 'Code',
|
||||
'Membership number or code': 'Numéro de membre ou code',
|
||||
'Save card': 'Enregistrer la carte',
|
||||
'Gym card': 'Carte de salle',
|
||||
'Card added': 'Carte ajoutée',
|
||||
'Nothing to save yet': 'Rien à enregistrer pour l’instant',
|
||||
"That's not a QR code — only QR cards can be shown here": 'Ce n’est pas un code QR — seules les cartes QR peuvent être affichées ici',
|
||||
'No QR code found in that image': 'Aucun code QR trouvé dans cette image',
|
||||
'Could not read that image': 'Impossible de lire cette image',
|
||||
'Camera permission is needed to scan. Enable it in Settings.': 'L’autorisation caméra est nécessaire pour scanner. Active-la dans les Réglages.',
|
||||
'Scanning is not available on this device.': 'Le scan n’est pas disponible sur cet appareil.',
|
||||
'Could not start the scanner': 'Impossible de démarrer le scanner',
|
||||
'Gym check-in': 'Enregistrement à la salle',
|
||||
'Show a card on Home with your membership QR codes.': 'Affiche sur l’Accueil une carte avec vos codes QR d’abonné.',
|
||||
'Point the camera at the QR code': 'Pointez la caméra vers le code QR',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'La caméra n’est pas disponible ici — importez une photo ou saisissez le code.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'L’accès à la caméra a été refusé — autorisez-le dans le navigateur et réessayez.',
|
||||
}
|
||||
@@ -1086,4 +1086,34 @@ export default {
|
||||
'Set to 0 to go back to the default ({0}).': 'डिफ़ॉल्ट ({0}) पर लौटने के लिए 0 सेट करें।',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'यह इस एक्सरसाइज़ पर हर जगह लागू होता है, सिर्फ़ इसी प्लान पर नहीं।',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'आप अब भी कुल वज़न ही दर्ज करते हैं — बार सिर्फ़ हर तरफ़ की प्लेट गिनती में काम आता है।',
|
||||
// Gym check-in (mobile-only)
|
||||
'Check in': 'चेक इन',
|
||||
'At the gym': 'जिम में',
|
||||
'Show this at the gym': 'इसे जिम में दिखाएँ',
|
||||
'Add your gym card': 'अपना जिम कार्ड जोड़ें',
|
||||
'Add a card': 'कार्ड जोड़ें',
|
||||
'Type the number on your membership card, import a photo of it, or scan it with the camera. No extra app needed at the gym — just open this screen.': 'अपने मेंबरशिप कार्ड का नंबर लिखें, उसकी फ़ोटो इम्पोर्ट करें, या कैमरे से स्कैन करें। जिम में किसी और ऐप की ज़रूरत नहीं — बस यह स्क्रीन खोलें।',
|
||||
'Remove this card?': 'यह कार्ड हटाएँ?',
|
||||
'Scan it, import a photo, or type the code by hand.': 'इसे स्कैन करें, फ़ोटो इम्पोर्ट करें, या कोड हाथ से लिखें।',
|
||||
'Scan': 'स्कैन करें',
|
||||
'Import photo': 'फ़ोटो इम्पोर्ट करें',
|
||||
'Label': 'लेबल',
|
||||
'e.g. FitZone downtown': 'जैसे FitZone डाउनटाउन',
|
||||
'Code': 'कोड',
|
||||
'Membership number or code': 'मेंबरशिप नंबर या कोड',
|
||||
'Save card': 'कार्ड सहेजें',
|
||||
'Gym card': 'जिम कार्ड',
|
||||
'Card added': 'कार्ड जोड़ा गया',
|
||||
'Nothing to save yet': 'अभी सहेजने के लिए कुछ नहीं',
|
||||
"That's not a QR code — only QR cards can be shown here": 'यह QR कोड नहीं है — यहाँ केवल QR कार्ड दिखाए जा सकते हैं',
|
||||
'No QR code found in that image': 'उस छवि में कोई QR कोड नहीं मिला',
|
||||
'Could not read that image': 'वह छवि पढ़ी नहीं जा सकी',
|
||||
'Camera permission is needed to scan. Enable it in Settings.': 'स्कैन करने के लिए कैमरा अनुमति चाहिए। इसे सेटिंग्स में चालू करें।',
|
||||
'Scanning is not available on this device.': 'इस डिवाइस पर स्कैनिंग उपलब्ध नहीं है।',
|
||||
'Could not start the scanner': 'स्कैनर शुरू नहीं हो सका',
|
||||
'Gym check-in': 'जिम चेक-इन',
|
||||
'Show a card on Home with your membership QR codes.': 'होम पर आपके सदस्यता QR कोड वाला कार्ड दिखाता है।',
|
||||
'Point the camera at the QR code': 'कैमरे को QR कोड पर रखें',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'कैमरा यहाँ उपलब्ध नहीं है — फ़ोटो इंपोर्ट करें या कोड टाइप करें।',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'कैमरे की अनुमति नहीं मिली — ब्राउज़र में अनुमति दें और फिर कोशिश करें।',
|
||||
}
|
||||
@@ -754,6 +754,31 @@ export default {
|
||||
'Set to 0 to go back to the default ({0}).': 'Állítsd 0-ra az alapérték ({0}) visszaállításához.',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Mindenhol érvényes erre a gyakorlatra, nem csak ebben a tervben.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Továbbra is a teljes súlyt rögzíted — a rúd csak az oldalankénti tárcsaszámításhoz kell.',
|
||||
// Gym check-in (mobile-only)
|
||||
'Check in': 'Bejelentkezés',
|
||||
'At the gym': 'A teremben',
|
||||
'Show this at the gym': 'Mutasd fel a teremben',
|
||||
'Add your gym card': 'Add hozzá a terembérleted',
|
||||
'Add a card': 'Kártya hozzáadása',
|
||||
'Type the number on your membership card, import a photo of it, or scan it with the camera. No extra app needed at the gym — just open this screen.': 'Írd be a tagsági kártyád számát, importálj róla egy fotót, vagy olvasd be a kamerával. Nincs szükség külön alkalmazásra a teremben — csak nyisd meg ezt a képernyőt.',
|
||||
'Remove this card?': 'Törlöd ezt a kártyát?',
|
||||
'Scan it, import a photo, or type the code by hand.': 'Olvasd be, importálj egy fotót, vagy írd be a kódot kézzel.',
|
||||
'Scan': 'Beolvasás',
|
||||
'Import photo': 'Fotó importálása',
|
||||
'Label': 'Címke',
|
||||
'e.g. FitZone downtown': 'pl. FitZone belváros',
|
||||
'Code': 'Kód',
|
||||
'Membership number or code': 'Tagsági szám vagy kód',
|
||||
'Save card': 'Kártya mentése',
|
||||
'Gym card': 'Terembérlet',
|
||||
'Card added': 'Kártya hozzáadva',
|
||||
'Nothing to save yet': 'Még nincs mit menteni',
|
||||
"That's not a QR code — only QR cards can be shown here": 'Ez nem QR-kód — itt csak QR-kártyák jeleníthetők meg',
|
||||
'No QR code found in that image': 'Nem található QR-kód a képen',
|
||||
'Could not read that image': 'A kép nem olvasható be',
|
||||
'Camera permission is needed to scan. Enable it in Settings.': 'A beolvasáshoz kameraengedély szükséges. Engedélyezd a Beállításokban.',
|
||||
'Scanning is not available on this device.': 'A beolvasás nem érhető el ezen az eszközön.',
|
||||
'Could not start the scanner': 'A szkenner nem indítható el',
|
||||
// --- AI Coach ---
|
||||
'The Coach is reading your training…': 'Az Edző az edzéseidet olvassa…',
|
||||
'Could not ask the Coach': 'Nem sikerült megkérdezni az Edzőt',
|
||||
@@ -1089,4 +1114,9 @@ export default {
|
||||
'What should change?': 'Mi változzon?',
|
||||
'Coach is thinking…': 'Az Edző gondolkodik…',
|
||||
'Message the Coach…': 'Üzenet az Edzőnek…',
|
||||
'Gym check-in': 'Bejelentkezés a teremben',
|
||||
'Show a card on Home with your membership QR codes.': 'A Kezdőlapon egy kártyát mutat a tagsági QR-kódjaiddal.',
|
||||
'Point the camera at the QR code': 'Irányítsd a kamerát a QR-kódra',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'A kamera itt nem elérhető — importálj egy fotót vagy írd be a kódot.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'A kamera-hozzáférés elutasítva — engedélyezd a böngészőben, és próbáld újra.',
|
||||
}
|
||||
@@ -1086,4 +1086,34 @@ export default {
|
||||
'Set to 0 to go back to the default ({0}).': 'Imposta 0 per tornare al valore predefinito ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Vale per questo esercizio ovunque, non solo in questo piano.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Registri comunque il peso totale — il bilanciere serve solo al calcolo dei dischi per lato.',
|
||||
// Gym check-in (mobile-only)
|
||||
'Check in': 'Check-in',
|
||||
'At the gym': 'In palestra',
|
||||
'Show this at the gym': 'Mostralo in palestra',
|
||||
'Add your gym card': 'Aggiungi la tua tessera',
|
||||
'Add a card': 'Aggiungi una tessera',
|
||||
'Type the number on your membership card, import a photo of it, or scan it with the camera. No extra app needed at the gym — just open this screen.': 'Digita il numero della tua tessera, importa una foto o scansionala con la fotocamera. Nessuna app extra in palestra — apri semplicemente questa schermata.',
|
||||
'Remove this card?': 'Rimuovere questa tessera?',
|
||||
'Scan it, import a photo, or type the code by hand.': 'Scansionala, importa una foto o digita il codice a mano.',
|
||||
'Scan': 'Scansiona',
|
||||
'Import photo': 'Importa foto',
|
||||
'Label': 'Etichetta',
|
||||
'e.g. FitZone downtown': 'es. FitZone centro',
|
||||
'Code': 'Codice',
|
||||
'Membership number or code': 'Numero tessera o codice',
|
||||
'Save card': 'Salva tessera',
|
||||
'Gym card': 'Tessera palestra',
|
||||
'Card added': 'Tessera aggiunta',
|
||||
'Nothing to save yet': 'Ancora niente da salvare',
|
||||
"That's not a QR code — only QR cards can be shown here": 'Non è un codice QR — qui si possono mostrare solo tessere QR',
|
||||
'No QR code found in that image': 'Nessun codice QR trovato nell’immagine',
|
||||
'Could not read that image': 'Impossibile leggere l’immagine',
|
||||
'Camera permission is needed to scan. Enable it in Settings.': 'Per scansionare serve l’autorizzazione alla fotocamera. Attivala nelle Impostazioni.',
|
||||
'Scanning is not available on this device.': 'La scansione non è disponibile su questo dispositivo.',
|
||||
'Could not start the scanner': 'Impossibile avviare lo scanner',
|
||||
'Gym check-in': 'Check-in in palestra',
|
||||
'Show a card on Home with your membership QR codes.': 'Mostra nella Home una scheda con i tuoi codici QR di iscrizione.',
|
||||
'Point the camera at the QR code': 'Inquadra il codice QR con la fotocamera',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'La fotocamera non è disponibile qui — importa una foto o digita il codice.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'Accesso alla fotocamera negato — consentilo nel browser e riprova.',
|
||||
}
|
||||
@@ -1086,4 +1086,34 @@ export default {
|
||||
'Set to 0 to go back to the default ({0}).': '0으로 두면 기본값({0})으로 돌아갑니다.',
|
||||
'Applies to this exercise everywhere, not just this plan.': '이 플랜만이 아니라 어디서든 이 운동에 적용됩니다.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': '기록은 여전히 총 무게입니다 — 바 무게는 한쪽에 끼울 원판 계산에만 쓰입니다.',
|
||||
// Gym check-in (mobile-only)
|
||||
'Check in': '체크인',
|
||||
'At the gym': '헬스장에서',
|
||||
'Show this at the gym': '헬스장에서 이것을 보여주세요',
|
||||
'Add your gym card': '헬스장 카드 추가',
|
||||
'Add a card': '카드 추가',
|
||||
'Type the number on your membership card, import a photo of it, or scan it with the camera. No extra app needed at the gym — just open this screen.': '멤버십 카드 번호를 입력하거나, 사진을 가져오거나, 카메라로 스캔하세요. 헬스장에서 별도 앱이 필요 없이 이 화면만 열면 됩니다.',
|
||||
'Remove this card?': '이 카드를 삭제할까요?',
|
||||
'Scan it, import a photo, or type the code by hand.': '스캔하거나 사진을 가져오거나 코드를 직접 입력하세요.',
|
||||
'Scan': '스캔',
|
||||
'Import photo': '사진 가져오기',
|
||||
'Label': '이름',
|
||||
'e.g. FitZone downtown': '예: FitZone 시내점',
|
||||
'Code': '코드',
|
||||
'Membership number or code': '회원 번호 또는 코드',
|
||||
'Save card': '카드 저장',
|
||||
'Gym card': '헬스장 카드',
|
||||
'Card added': '카드가 추가되었습니다',
|
||||
'Nothing to save yet': '아직 저장할 내용이 없습니다',
|
||||
"That's not a QR code — only QR cards can be shown here": 'QR 코드가 아닙니다 — 여기서는 QR 카드만 표시할 수 있습니다',
|
||||
'No QR code found in that image': '이미지에서 QR 코드를 찾을 수 없습니다',
|
||||
'Could not read that image': '이미지를 읽을 수 없습니다',
|
||||
'Camera permission is needed to scan. Enable it in Settings.': '스캔하려면 카메라 권한이 필요합니다. 설정에서 켜세요.',
|
||||
'Scanning is not available on this device.': '이 기기에서는 스캔을 사용할 수 없습니다.',
|
||||
'Could not start the scanner': '스캐너를 시작할 수 없습니다',
|
||||
'Gym check-in': '헬스장 체크인',
|
||||
'Show a card on Home with your membership QR codes.': '홈 화면에 회원 QR 코드 카드를 표시합니다.',
|
||||
'Point the camera at the QR code': '카메라를 QR 코드에 맞추세요',
|
||||
'Camera is not available here — import a photo or type the code instead.': '여기서는 카메라를 사용할 수 없습니다 — 사진을 가져오거나 코드를 입력하세요.',
|
||||
'Camera access was denied — allow it in your browser and try again.': '카메라 접근이 거부되었습니다 — 브라우저에서 허용한 뒤 다시 시도하세요.',
|
||||
}
|
||||
@@ -1086,4 +1086,34 @@ export default {
|
||||
'Set to 0 to go back to the default ({0}).': 'Ustaw 0, aby wrócić do wartości domyślnej ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Dotyczy tego ćwiczenia wszędzie, nie tylko w tym planie.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Nadal zapisujesz ciężar całkowity — gryf służy tylko do wyliczenia talerzy na stronę.',
|
||||
// Gym check-in (mobile-only)
|
||||
'Check in': 'Zamelduj się',
|
||||
'At the gym': 'Na siłowni',
|
||||
'Show this at the gym': 'Pokaż to na siłowni',
|
||||
'Add your gym card': 'Dodaj kartę siłowni',
|
||||
'Add a card': 'Dodaj kartę',
|
||||
'Type the number on your membership card, import a photo of it, or scan it with the camera. No extra app needed at the gym — just open this screen.': 'Wpisz numer karty członkowskiej, zaimportuj jej zdjęcie lub zeskanuj aparatem. Na siłowni nie potrzebujesz osobnej aplikacji — po prostu otwórz ten ekran.',
|
||||
'Remove this card?': 'Usunąć tę kartę?',
|
||||
'Scan it, import a photo, or type the code by hand.': 'Zeskanuj ją, zaimportuj zdjęcie lub wpisz kod ręcznie.',
|
||||
'Scan': 'Skanuj',
|
||||
'Import photo': 'Importuj zdjęcie',
|
||||
'Label': 'Etykieta',
|
||||
'e.g. FitZone downtown': 'np. FitZone centrum',
|
||||
'Code': 'Kod',
|
||||
'Membership number or code': 'Numer członkowski lub kod',
|
||||
'Save card': 'Zapisz kartę',
|
||||
'Gym card': 'Karta siłowni',
|
||||
'Card added': 'Dodano kartę',
|
||||
'Nothing to save yet': 'Nie ma jeszcze nic do zapisania',
|
||||
"That's not a QR code — only QR cards can be shown here": 'To nie jest kod QR — tutaj można pokazać tylko karty QR',
|
||||
'No QR code found in that image': 'Nie znaleziono kodu QR na tym obrazie',
|
||||
'Could not read that image': 'Nie udało się odczytać tego obrazu',
|
||||
'Camera permission is needed to scan. Enable it in Settings.': 'Do skanowania potrzebne jest pozwolenie na aparat. Włącz je w Ustawieniach.',
|
||||
'Scanning is not available on this device.': 'Skanowanie nie jest dostępne na tym urządzeniu.',
|
||||
'Could not start the scanner': 'Nie udało się uruchomić skanera',
|
||||
'Gym check-in': 'Zameldowanie na siłowni',
|
||||
'Show a card on Home with your membership QR codes.': 'Pokazuje na Starcie kartę z Twoimi kodami QR członkowskimi.',
|
||||
'Point the camera at the QR code': 'Skieruj aparat na kod QR',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'Aparat nie jest tu dostępny — zaimportuj zdjęcie lub wpisz kod.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'Odmówiono dostępu do aparatu — zezwól w przeglądarce i spróbuj ponownie.',
|
||||
}
|
||||
@@ -608,7 +608,25 @@ export const PT_BR_OVERRIDES = {
|
||||
'Default for this bar type.': 'Padrão para este tipo de barra.',
|
||||
'Set to 0 to go back to the default ({0}).': 'Defina 0 para voltar ao padrão ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Vale para este exercício em todos os lugares, não só neste plano.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Você continua registrando o peso total — a barra só entra no cálculo das anilhas por lado.'
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Você continua registrando o peso total — a barra só entra no cálculo das anilhas por lado.',
|
||||
// Gym check-in (mobile-only) — only where pt-BR differs from pt (inherited via ...pt)
|
||||
'At the gym': 'Na academia',
|
||||
'Show this at the gym': 'Mostre isto na academia',
|
||||
'Add your gym card': 'Adicione seu cartão da academia',
|
||||
'Type the number on your membership card, import a photo of it, or scan it with the camera. No extra app needed at the gym — just open this screen.': 'Digite o número do seu cartão de sócio, importe uma foto ou escaneie com a câmera. Não é preciso outro app na academia — é só abrir esta tela.',
|
||||
'Scan it, import a photo, or type the code by hand.': 'Escaneie, importe uma foto ou digite o código à mão.',
|
||||
'Scan': 'Escanear',
|
||||
'e.g. FitZone downtown': 'ex. FitZone centro',
|
||||
'Gym card': 'Cartão da academia',
|
||||
'Could not read that image': 'Não foi possível ler essa imagem',
|
||||
'Camera permission is needed to scan. Enable it in Settings.': 'É necessária a permissão da câmera para escanear. Ative-a nos Ajustes.',
|
||||
'Scanning is not available on this device.': 'O escaneamento não está disponível neste dispositivo.',
|
||||
'Could not start the scanner': 'Não foi possível iniciar o scanner',
|
||||
'Gym check-in': 'Check-in na academia',
|
||||
'Show a card on Home with your membership QR codes.': 'Mostra no Início um cartão com seus códigos QR de sócio.',
|
||||
'Point the camera at the QR code': 'Aponte a câmera para o código QR',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'A câmera não está disponível aqui — importe uma foto ou digite o código.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'O acesso à câmera foi negado — permita-o no navegador e tente de novo.',
|
||||
}
|
||||
|
||||
export default { ...pt, ...PT_BR_OVERRIDES }
|
||||
@@ -1086,4 +1086,34 @@ export default {
|
||||
'Set to 0 to go back to the default ({0}).': 'Coloca 0 para voltar à predefinição ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Aplica-se a este exercício em todo o lado, não só neste plano.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Continuas a registar o peso total — a barra só conta para o cálculo dos discos por lado.',
|
||||
// Gym check-in (mobile-only)
|
||||
'Check in': 'Check-in',
|
||||
'At the gym': 'No ginásio',
|
||||
'Show this at the gym': 'Mostra isto no ginásio',
|
||||
'Add your gym card': 'Adiciona o teu cartão de sócio',
|
||||
'Add a card': 'Adicionar um cartão',
|
||||
'Type the number on your membership card, import a photo of it, or scan it with the camera. No extra app needed at the gym — just open this screen.': 'Escreve o número do teu cartão de sócio, importa uma foto ou digitaliza-o com a câmara. Não é preciso outra app no ginásio — basta abrir este ecrã.',
|
||||
'Remove this card?': 'Remover este cartão?',
|
||||
'Scan it, import a photo, or type the code by hand.': 'Digitaliza-o, importa uma foto ou escreve o código à mão.',
|
||||
'Scan': 'Digitalizar',
|
||||
'Import photo': 'Importar foto',
|
||||
'Label': 'Etiqueta',
|
||||
'e.g. FitZone downtown': 'p. ex. FitZone centro',
|
||||
'Code': 'Código',
|
||||
'Membership number or code': 'Número de sócio ou código',
|
||||
'Save card': 'Guardar cartão',
|
||||
'Gym card': 'Cartão do ginásio',
|
||||
'Card added': 'Cartão adicionado',
|
||||
'Nothing to save yet': 'Ainda não há nada para guardar',
|
||||
"That's not a QR code — only QR cards can be shown here": 'Isto não é um código QR — aqui só podem ser mostrados cartões QR',
|
||||
'No QR code found in that image': 'Nenhum código QR encontrado nessa imagem',
|
||||
'Could not read that image': 'Não foi possível ler essa imagem',
|
||||
'Camera permission is needed to scan. Enable it in Settings.': 'É necessária a permissão da câmara para digitalizar. Ativa-a nas Definições.',
|
||||
'Scanning is not available on this device.': 'A digitalização não está disponível neste dispositivo.',
|
||||
'Could not start the scanner': 'Não foi possível iniciar o scanner',
|
||||
'Gym check-in': 'Check-in no ginásio',
|
||||
'Show a card on Home with your membership QR codes.': 'Mostra no Início um cartão com os teus códigos QR de sócio.',
|
||||
'Point the camera at the QR code': 'Aponta a câmara para o código QR',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'A câmara não está disponível aqui — importa uma foto ou escreve o código.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'O acesso à câmara foi recusado — permite-o no navegador e tenta de novo.',
|
||||
}
|
||||
@@ -1086,4 +1086,34 @@ export default {
|
||||
'Set to 0 to go back to the default ({0}).': 'Поставь 0, чтобы вернуться к значению по умолчанию ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Действует для этого упражнения везде, а не только в этом плане.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Записывается по-прежнему общий вес — гриф нужен только для расчёта блинов на сторону.',
|
||||
// Gym check-in (mobile-only)
|
||||
'Check in': 'Отметиться',
|
||||
'At the gym': 'В зале',
|
||||
'Show this at the gym': 'Покажите это в зале',
|
||||
'Add your gym card': 'Добавьте карту зала',
|
||||
'Add a card': 'Добавить карту',
|
||||
'Type the number on your membership card, import a photo of it, or scan it with the camera. No extra app needed at the gym — just open this screen.': 'Введите номер клубной карты, импортируйте её фото или отсканируйте камерой. В зале не нужно отдельное приложение — просто откройте этот экран.',
|
||||
'Remove this card?': 'Удалить эту карту?',
|
||||
'Scan it, import a photo, or type the code by hand.': 'Отсканируйте её, импортируйте фото или введите код вручную.',
|
||||
'Scan': 'Сканировать',
|
||||
'Import photo': 'Импортировать фото',
|
||||
'Label': 'Название',
|
||||
'e.g. FitZone downtown': 'напр. FitZone в центре',
|
||||
'Code': 'Код',
|
||||
'Membership number or code': 'Номер участника или код',
|
||||
'Save card': 'Сохранить карту',
|
||||
'Gym card': 'Карта зала',
|
||||
'Card added': 'Карта добавлена',
|
||||
'Nothing to save yet': 'Пока нечего сохранять',
|
||||
"That's not a QR code — only QR cards can be shown here": 'Это не QR-код — здесь можно показывать только QR-карты',
|
||||
'No QR code found in that image': 'На изображении не найден QR-код',
|
||||
'Could not read that image': 'Не удалось прочитать изображение',
|
||||
'Camera permission is needed to scan. Enable it in Settings.': 'Для сканирования нужен доступ к камере. Включите его в настройках.',
|
||||
'Scanning is not available on this device.': 'Сканирование недоступно на этом устройстве.',
|
||||
'Could not start the scanner': 'Не удалось запустить сканер',
|
||||
'Gym check-in': 'Отметка в зале',
|
||||
'Show a card on Home with your membership QR codes.': 'Показывает на Главной карточку с вашими QR-кодами абонемента.',
|
||||
'Point the camera at the QR code': 'Наведите камеру на QR-код',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'Камера здесь недоступна — импортируйте фото или введите код.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'Доступ к камере запрещён — разрешите его в браузере и попробуйте снова.',
|
||||
}
|
||||
@@ -762,6 +762,31 @@ export default {
|
||||
'Set to 0 to go back to the default ({0}).': 'ตั้งเป็น 0 เพื่อกลับไปใช้ค่าเริ่มต้น ({0})',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'มีผลกับท่านี้ทุกที่ ไม่ใช่เฉพาะในแผนนี้',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'คุณยังบันทึกน้ำหนักรวมเหมือนเดิม — บาร์ใช้สำหรับคำนวณแผ่นน้ำหนักต่อข้างเท่านั้น',
|
||||
// Gym check-in (mobile-only)
|
||||
'Check in': 'เช็คอิน',
|
||||
'At the gym': 'ที่ยิม',
|
||||
'Show this at the gym': 'แสดงสิ่งนี้ที่ยิม',
|
||||
'Add your gym card': 'เพิ่มบัตรสมาชิกยิมของคุณ',
|
||||
'Add a card': 'เพิ่มบัตร',
|
||||
'Type the number on your membership card, import a photo of it, or scan it with the camera. No extra app needed at the gym — just open this screen.': 'พิมพ์หมายเลขบนบัตรสมาชิก นำเข้ารูปถ่าย หรือสแกนด้วยกล้อง ไม่ต้องใช้แอปอื่นที่ยิม — แค่เปิดหน้าจอนี้',
|
||||
'Remove this card?': 'ลบบัตรนี้หรือไม่?',
|
||||
'Scan it, import a photo, or type the code by hand.': 'สแกน นำเข้ารูปถ่าย หรือพิมพ์รหัสด้วยตนเอง',
|
||||
'Scan': 'สแกน',
|
||||
'Import photo': 'นำเข้ารูปถ่าย',
|
||||
'Label': 'ป้ายชื่อ',
|
||||
'e.g. FitZone downtown': 'เช่น FitZone ใจกลางเมือง',
|
||||
'Code': 'รหัส',
|
||||
'Membership number or code': 'หมายเลขสมาชิกหรือรหัส',
|
||||
'Save card': 'บันทึกบัตร',
|
||||
'Gym card': 'บัตรยิม',
|
||||
'Card added': 'เพิ่มบัตรแล้ว',
|
||||
'Nothing to save yet': 'ยังไม่มีอะไรให้บันทึก',
|
||||
"That's not a QR code — only QR cards can be shown here": 'นี่ไม่ใช่คิวอาร์โค้ด — ที่นี่แสดงได้เฉพาะบัตรคิวอาร์โค้ดเท่านั้น',
|
||||
'No QR code found in that image': 'ไม่พบคิวอาร์โค้ดในรูปภาพนั้น',
|
||||
'Could not read that image': 'ไม่สามารถอ่านรูปภาพนั้นได้',
|
||||
'Camera permission is needed to scan. Enable it in Settings.': 'ต้องมีสิทธิ์กล้องเพื่อสแกน เปิดใช้งานในการตั้งค่า',
|
||||
'Scanning is not available on this device.': 'อุปกรณ์นี้ไม่รองรับการสแกน',
|
||||
'Could not start the scanner': 'ไม่สามารถเริ่มเครื่องสแกนได้',
|
||||
// --- AI Coach ---
|
||||
'The Coach is reading your training…': 'โค้ชกำลังอ่านการฝึกของคุณ…',
|
||||
'Could not ask the Coach': 'ไม่สามารถถามโค้ชได้',
|
||||
@@ -1097,4 +1122,9 @@ export default {
|
||||
'What should change?': 'ควรเปลี่ยนอะไร',
|
||||
'Coach is thinking…': 'โค้ชกำลังคิด…',
|
||||
'Message the Coach…': 'ส่งข้อความถึงโค้ช…',
|
||||
'Gym check-in': 'เช็คอินที่ยิม',
|
||||
'Show a card on Home with your membership QR codes.': 'แสดงการ์ดพร้อม QR โค้ดสมาชิกของคุณบนหน้าหลัก',
|
||||
'Point the camera at the QR code': 'เล็งกล้องไปที่ QR โค้ด',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'ใช้กล้องที่นี่ไม่ได้ — นำเข้ารูปภาพหรือพิมพ์รหัสแทน',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'การเข้าถึงกล้องถูกปฏิเสธ — อนุญาตในเบราว์เซอร์แล้วลองอีกครั้ง',
|
||||
}
|
||||
@@ -1086,4 +1086,34 @@ export default {
|
||||
'Set to 0 to go back to the default ({0}).': 'Varsayılana ({0}) dönmek için 0 yap.',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Yalnızca bu planda değil, bu egzersiz için her yerde geçerli.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Yine de toplam ağırlığı kaydedersin — bar yalnızca taraf başına plaka hesabına girer.',
|
||||
// Gym check-in (mobile-only)
|
||||
'Check in': 'Giriş yap',
|
||||
'At the gym': 'Salonda',
|
||||
'Show this at the gym': 'Bunu salonda göster',
|
||||
'Add your gym card': 'Salon kartını ekle',
|
||||
'Add a card': 'Kart ekle',
|
||||
'Type the number on your membership card, import a photo of it, or scan it with the camera. No extra app needed at the gym — just open this screen.': 'Üyelik kartındaki numarayı yaz, fotoğrafını içe aktar ya da kamerayla tara. Salonda ekstra bir uygulamaya gerek yok — sadece bu ekranı aç.',
|
||||
'Remove this card?': 'Bu kart kaldırılsın mı?',
|
||||
'Scan it, import a photo, or type the code by hand.': 'Tara, bir fotoğraf içe aktar ya da kodu elle yaz.',
|
||||
'Scan': 'Tara',
|
||||
'Import photo': 'Fotoğraf içe aktar',
|
||||
'Label': 'Etiket',
|
||||
'e.g. FitZone downtown': 'örn. FitZone merkez',
|
||||
'Code': 'Kod',
|
||||
'Membership number or code': 'Üyelik numarası veya kodu',
|
||||
'Save card': 'Kartı kaydet',
|
||||
'Gym card': 'Salon kartı',
|
||||
'Card added': 'Kart eklendi',
|
||||
'Nothing to save yet': 'Henüz kaydedilecek bir şey yok',
|
||||
"That's not a QR code — only QR cards can be shown here": 'Bu bir QR kod değil — burada yalnızca QR kartlar gösterilebilir',
|
||||
'No QR code found in that image': 'Bu görüntüde QR kod bulunamadı',
|
||||
'Could not read that image': 'Bu görüntü okunamadı',
|
||||
'Camera permission is needed to scan. Enable it in Settings.': 'Taramak için kamera izni gerekir. Ayarlar’dan etkinleştir.',
|
||||
'Scanning is not available on this device.': 'Tarama bu cihazda kullanılamıyor.',
|
||||
'Could not start the scanner': 'Tarayıcı başlatılamadı',
|
||||
'Gym check-in': 'Salon girişi',
|
||||
'Show a card on Home with your membership QR codes.': 'Ana sayfada üyelik QR kodlarınızı içeren bir kart gösterir.',
|
||||
'Point the camera at the QR code': 'Kamerayı QR koda tutun',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'Kamera burada kullanılamıyor — bir fotoğraf içe aktarın veya kodu yazın.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'Kamera erişimi reddedildi — tarayıcıda izin verip tekrar deneyin.',
|
||||
}
|
||||
@@ -1086,4 +1086,34 @@ export default {
|
||||
'Set to 0 to go back to the default ({0}).': '设为 0 即恢复默认值({0})。',
|
||||
'Applies to this exercise everywhere, not just this plan.': '对这个动作处处生效,不只在此计划中。',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': '记录的仍是总重量——杆重只用于每侧杠铃片的计算。',
|
||||
// Gym check-in (mobile-only)
|
||||
'Check in': '签到',
|
||||
'At the gym': '在健身房',
|
||||
'Show this at the gym': '在健身房出示这个',
|
||||
'Add your gym card': '添加你的会员卡',
|
||||
'Add a card': '添加卡片',
|
||||
'Type the number on your membership card, import a photo of it, or scan it with the camera. No extra app needed at the gym — just open this screen.': '输入会员卡上的号码、导入卡片照片,或用相机扫描。在健身房无需额外应用——打开此界面即可。',
|
||||
'Remove this card?': '删除这张卡片?',
|
||||
'Scan it, import a photo, or type the code by hand.': '扫描它、导入照片,或手动输入代码。',
|
||||
'Scan': '扫描',
|
||||
'Import photo': '导入照片',
|
||||
'Label': '名称',
|
||||
'e.g. FitZone downtown': '例如 FitZone 市中心店',
|
||||
'Code': '代码',
|
||||
'Membership number or code': '会员号或代码',
|
||||
'Save card': '保存卡片',
|
||||
'Gym card': '健身房卡片',
|
||||
'Card added': '已添加卡片',
|
||||
'Nothing to save yet': '暂无可保存的内容',
|
||||
"That's not a QR code — only QR cards can be shown here": '这不是二维码——此处只能显示二维码卡片',
|
||||
'No QR code found in that image': '在该图片中未找到二维码',
|
||||
'Could not read that image': '无法读取该图片',
|
||||
'Camera permission is needed to scan. Enable it in Settings.': '扫描需要相机权限。请在设置中开启。',
|
||||
'Scanning is not available on this device.': '此设备不支持扫描。',
|
||||
'Could not start the scanner': '无法启动扫描器',
|
||||
'Gym check-in': '健身房签到',
|
||||
'Show a card on Home with your membership QR codes.': '在首页显示一张包含会员二维码的卡片。',
|
||||
'Point the camera at the QR code': '将摄像头对准二维码',
|
||||
'Camera is not available here — import a photo or type the code instead.': '此处无法使用摄像头 — 请导入照片或手动输入代码。',
|
||||
'Camera access was denied — allow it in your browser and try again.': '摄像头访问被拒绝 — 请在浏览器中允许后重试。',
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
vi.mock('../lib/api.js', () => ({ api: vi.fn(), setRemoteAuth: vi.fn() }))
|
||||
|
||||
import { DEF, useStore } from './useStore.js'
|
||||
|
||||
const clone = value => JSON.parse(JSON.stringify(value))
|
||||
|
||||
beforeEach(() => {
|
||||
localStorage.clear()
|
||||
useStore.setState({ S: clone(DEF), user: null, ready: false })
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
localStorage.clear()
|
||||
useStore.setState({ S: clone(DEF), user: null, ready: false })
|
||||
})
|
||||
|
||||
// gymCards is plain profile data — it rides the same update()/persist() path as everything else,
|
||||
// with no backend or schema change. These pin the contract the check-in view relies on: a fresh
|
||||
// profile starts empty, and adding/removing a card mutates and persists like any other field.
|
||||
|
||||
describe('gymCards state', () => {
|
||||
it('defaults to an empty array on a fresh profile', () => {
|
||||
expect(useStore.getState().S.gymCards).toEqual([])
|
||||
})
|
||||
|
||||
it('adds a card via update and persists it to localStorage', () => {
|
||||
useStore.getState().update(s => {
|
||||
s.gymCards.push({ id: 'c1', label: 'FitZone', value: 'ABC123', fmt: 'qrcode' })
|
||||
}, false)
|
||||
|
||||
const cards = useStore.getState().S.gymCards
|
||||
expect(cards).toHaveLength(1)
|
||||
expect(cards[0]).toMatchObject({ id: 'c1', label: 'FitZone', value: 'ABC123', fmt: 'qrcode' })
|
||||
|
||||
// persist() writes the whole state under the app's storage key — the card must be in it.
|
||||
const saved = JSON.parse(localStorage.getItem('gym_state_v1'))
|
||||
expect(saved.gymCards).toHaveLength(1)
|
||||
expect(saved.gymCards[0].value).toBe('ABC123')
|
||||
})
|
||||
|
||||
it('removes a card by id, leaving the others', () => {
|
||||
useStore.getState().update(s => {
|
||||
s.gymCards.push({ id: 'a', label: 'A', value: '1', fmt: 'qrcode' })
|
||||
s.gymCards.push({ id: 'b', label: 'B', value: '2', fmt: 'qrcode' })
|
||||
}, false)
|
||||
|
||||
useStore.getState().update(s => {
|
||||
s.gymCards = s.gymCards.filter(c => c.id !== 'a')
|
||||
}, false)
|
||||
|
||||
const cards = useStore.getState().S.gymCards
|
||||
expect(cards).toHaveLength(1)
|
||||
expect(cards[0].id).toBe('b')
|
||||
})
|
||||
|
||||
it('keeps multiple cards in insertion order', () => {
|
||||
useStore.getState().update(s => {
|
||||
s.gymCards.push({ id: '1', label: 'One', value: 'x', fmt: 'qrcode' })
|
||||
s.gymCards.push({ id: '2', label: 'Two', value: 'y', fmt: 'qrcode' })
|
||||
s.gymCards.push({ id: '3', label: 'Three', value: 'z', fmt: 'qrcode' })
|
||||
}, false)
|
||||
|
||||
expect(useStore.getState().S.gymCards.map(c => c.id)).toEqual(['1', '2', '3'])
|
||||
})
|
||||
})
|
||||
|
||||
// The Settings switch. On by default; an older profile that predates the key must read as on
|
||||
// too, and off only hides the feature — the cards themselves survive the round trip.
|
||||
describe('checkIn switch', () => {
|
||||
it('is on for a fresh profile', () => {
|
||||
expect(useStore.getState().S.checkIn).toBe(true)
|
||||
})
|
||||
|
||||
it('turning it off keeps the saved cards', () => {
|
||||
useStore.getState().update(s => {
|
||||
s.gymCards.push({ id: 'c1', label: 'FitZone', value: 'ABC123', fmt: 'qrcode' })
|
||||
s.checkIn = false
|
||||
}, false)
|
||||
const S = useStore.getState().S
|
||||
expect(S.checkIn).toBe(false)
|
||||
expect(S.gymCards).toHaveLength(1)
|
||||
})
|
||||
})
|
||||
@@ -38,6 +38,18 @@ export const DEF = {
|
||||
// lib/bar.js). Personal equipment, so it syncs with the account but never travels in a
|
||||
// shared plan. Logged weights stay the total — this only feeds the plate math.
|
||||
barWeights: {},
|
||||
// Gym check-in cards (see views/CheckIn.jsx). Each is a membership
|
||||
// code shown as a QR/barcode at the gym's turnstile — added by typing it, importing a photo
|
||||
// of the card, or scanning it. We only ever keep the code's VALUE, never a photo: the image
|
||||
// is regenerated from `value` every time it's shown (lib/qr.js). `fmt` is the barcode symbology
|
||||
// ('qrcode' | 'ean13' | 'code128' | … — lower-cased BarcodeFormat) so it renders as the same
|
||||
// kind of code the gym issued. Just data, so it syncs and backs up like everything else.
|
||||
// [{ id, label, value, fmt }]
|
||||
gymCards: [],
|
||||
// Whether the check-in feature is on at all (Settings toggle). Off hides the Home
|
||||
// card and the /checkin route; the saved gymCards stay so turning it back on restores them.
|
||||
// Defaults on; an older profile without the key reads as on (`!== false`).
|
||||
checkIn: true,
|
||||
}
|
||||
const clone = o => JSON.parse(JSON.stringify(o))
|
||||
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { useStore } from '../store/useStore.js'
|
||||
import { useUI } from '../store/useUI.js'
|
||||
import { uid } from '../lib/format.js'
|
||||
import { t } from '../lib/i18n.js'
|
||||
import { canRenderFmt } from '../lib/qr.js'
|
||||
import { scanCode, importCodeFromImage } from '../lib/scan.js'
|
||||
import { MOBILE } from '../lib/mobile.js'
|
||||
import Icon from '../components/Icon.jsx'
|
||||
import QrCanvas from '../components/QrCanvas.jsx'
|
||||
import CameraScan from '../components/CameraScan.jsx'
|
||||
import { Button, TextField } from '../components/ui.jsx'
|
||||
import { confirmSheet } from '../sheets.jsx'
|
||||
import { tappable } from '../lib/use-sheet-keyboard.js'
|
||||
|
||||
// Gym check-in (reached from the Home "Check in" card; app and PWA alike). Shows each saved membership
|
||||
// code as a QR the turnstile can read, swiped through horizontally, with a trailing "+" to add
|
||||
// another. We only ever store the code's value + symbology; the QR is regenerated from it here
|
||||
// every time (see lib/qr.js), so nothing sensitive is kept as an image.
|
||||
export default function CheckIn() {
|
||||
const nav = useNavigate()
|
||||
const cards = useStore(s => s.S.gymCards) || []
|
||||
const railRef = useRef(null)
|
||||
const [active, setActive] = useState(0)
|
||||
|
||||
// Which card the horizontal scroll has settled on — drives the little dots. Reading it off the
|
||||
// scroll position keeps the rail itself the single control; no separate paging state to sync.
|
||||
const onScroll = () => {
|
||||
const rail = railRef.current
|
||||
if (!rail) return
|
||||
const i = Math.round(rail.scrollLeft / rail.clientWidth)
|
||||
setActive(i)
|
||||
}
|
||||
|
||||
return <div className="narrow">
|
||||
<div className="hdr">
|
||||
<button className="iconbtn" onClick={() => nav('/home')} aria-label={t('Home')}><Icon name="chevronLeft" /></button>
|
||||
<div style={{ flex: 1 }}>
|
||||
<h1 style={{ fontSize: 28 }}>{t('Check in')}</h1>
|
||||
<div className="sub">{cards.length ? t('Show this at the gym') : t('Add your gym card')}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="ci-rail" ref={railRef} onScroll={onScroll}>
|
||||
{cards.map(card => <CardFace key={card.id} card={card} />)}
|
||||
<button className="ci-add" onClick={openAddCard}>
|
||||
<Icon name="plus" />
|
||||
<span className="ci-add-t">{t('Add a card')}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{(cards.length > 0) && <div className="ci-dots">
|
||||
{cards.map((c, i) => <span key={c.id} className={'ci-dot' + (i === active ? ' on' : '')} />)}
|
||||
{/* the add card is a slide too, so it gets a dot */}
|
||||
<span className={'ci-dot' + (active >= cards.length ? ' on' : '')} />
|
||||
</div>}
|
||||
|
||||
{!cards.length && <div className="muted small" style={{ textAlign: 'center', marginTop: 18, lineHeight: 1.5 }}>
|
||||
{t('Type the number on your membership card, import a photo of it, or scan it with the camera. No extra app needed at the gym — just open this screen.')}
|
||||
</div>}
|
||||
</div>
|
||||
}
|
||||
|
||||
// One saved card: its label, the QR, and the raw value underneath (handy when a reader is fussy
|
||||
// and a staff member types it in). Long-press / the trash button removes it.
|
||||
function CardFace({ card }) {
|
||||
const update = useStore(s => s.update)
|
||||
const remove = () => confirmSheet({
|
||||
title: t('Remove this card?'),
|
||||
message: card.label,
|
||||
confirmText: t('Remove'),
|
||||
danger: true,
|
||||
onConfirm: () => update(s => { s.gymCards = (s.gymCards || []).filter(c => c.id !== card.id) }),
|
||||
})
|
||||
return <div className="ci-card">
|
||||
<div className="row between" style={{ width: '100%', alignItems: 'flex-start' }}>
|
||||
<div className="ci-label" style={{ flex: 1 }}>{card.label}</div>
|
||||
<button className="iconbtn" style={{ width: 30, height: 30, fontSize: 14, color: 'var(--red)' }} onClick={remove} aria-label={t('Remove')}><Icon name="trash" /></button>
|
||||
</div>
|
||||
<div className="ci-qr-plate"><QrCanvas value={card.value} size={230} /></div>
|
||||
<div className="ci-value">{card.value}</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- add-card sheet -- */
|
||||
|
||||
// Opens the add-card sheet. Co-located with the view (not sheets.jsx) because it pulls in the
|
||||
// scanner paths — keeping it here keeps them out of the shared sheets module.
|
||||
export function openAddCard() {
|
||||
useUI.getState().openSheet(close => <AddCard close={close} />)
|
||||
}
|
||||
|
||||
function saveCard({ label, value, fmt }) {
|
||||
const update = useStore.getState().update
|
||||
const toast = useUI.getState().toast
|
||||
const trimmed = (value || '').trim()
|
||||
if (!trimmed) { toast(t('Nothing to save yet')); return false }
|
||||
// We can read many barcode kinds but only redraw QR faithfully — refuse anything else rather
|
||||
// than store a code that would display as the wrong bars at the turnstile.
|
||||
if (fmt && !canRenderFmt(fmt)) { toast(t("That's not a QR code — only QR cards can be shown here")); return false }
|
||||
update(s => {
|
||||
if (!Array.isArray(s.gymCards)) s.gymCards = []
|
||||
s.gymCards.push({ id: uid(), label: (label || '').trim() || t('Gym card'), value: trimmed, fmt: 'qrcode' })
|
||||
})
|
||||
toast(t('Card added'))
|
||||
return true
|
||||
}
|
||||
|
||||
function AddCard({ close }) {
|
||||
const [label, setLabel] = useState('')
|
||||
const [value, setValue] = useState('')
|
||||
const [busy, setBusy] = useState(false)
|
||||
const fileRef = useRef(null)
|
||||
const toast = useUI(s => s.toast)
|
||||
|
||||
const commitTyped = () => { if (saveCard({ label, value, fmt: 'qrcode' })) close() }
|
||||
|
||||
// Camera scan: in the app, hands off to the native scanner; in a browser, opens our own camera
|
||||
// sheet on top of this one. Either way the value drops straight into the form so the user can
|
||||
// still name it before saving.
|
||||
const doScan = async () => {
|
||||
if (!MOBILE) {
|
||||
useUI.getState().openSheet(close => <CameraScan
|
||||
onCancel={close}
|
||||
onFound={code => {
|
||||
close()
|
||||
if (!canRenderFmt(code.fmt)) { toast(t("That's not a QR code — only QR cards can be shown here")); return }
|
||||
setValue(code.value)
|
||||
}} />)
|
||||
return
|
||||
}
|
||||
setBusy(true)
|
||||
try {
|
||||
const code = await scanCode()
|
||||
if (!code) return // user backed out
|
||||
if (!canRenderFmt(code.fmt)) { toast(t("That's not a QR code — only QR cards can be shown here")); return }
|
||||
setValue(code.value)
|
||||
} catch (e) {
|
||||
toast(scanErrorMessage(e))
|
||||
} finally { setBusy(false) }
|
||||
}
|
||||
|
||||
const onFile = async ev => {
|
||||
const file = ev.target.files && ev.target.files[0]
|
||||
ev.target.value = '' // let the same file be picked again later
|
||||
if (!file) return
|
||||
setBusy(true)
|
||||
try {
|
||||
const code = await importCodeFromImage(file)
|
||||
if (!code) { toast(t('No QR code found in that image')); return }
|
||||
if (!canRenderFmt(code.fmt)) { toast(t("That's not a QR code — only QR cards can be shown here")); return }
|
||||
setValue(code.value)
|
||||
} catch (e) {
|
||||
toast(t('Could not read that image'))
|
||||
} finally { setBusy(false) }
|
||||
}
|
||||
|
||||
return <>
|
||||
<h3>{t('Add a card')}</h3>
|
||||
<div className="muted small" style={{ marginBottom: 14 }}>{t('Scan it, import a photo, or type the code by hand.')}</div>
|
||||
|
||||
<div className="row" style={{ gap: 8, marginBottom: 16 }}>
|
||||
<Button variant="tinted" icon="camera" onClick={doScan} disabled={busy}>{t('Scan')}</Button>
|
||||
<Button variant="tinted" icon="image" onClick={() => fileRef.current?.click()} disabled={busy}>{t('Import photo')}</Button>
|
||||
</div>
|
||||
|
||||
<label className="sect-t">{t('Label')}</label>
|
||||
<TextField value={label} onChange={e => setLabel(e.target.value)} placeholder={t('e.g. FitZone downtown')} style={{ marginBottom: 12 }} />
|
||||
|
||||
<label className="sect-t">{t('Code')}</label>
|
||||
<TextField value={value} onChange={e => setValue(e.target.value)} placeholder={t('Membership number or code')} inputMode="text" style={{ marginBottom: 16 }} />
|
||||
|
||||
{value.trim() && <div className="ci-qr-plate" style={{ alignSelf: 'center', marginBottom: 16 }}><QrCanvas value={value.trim()} size={150} /></div>}
|
||||
|
||||
<Button variant="primary" onClick={commitTyped} disabled={busy || !value.trim()}>{t('Save card')}</Button>
|
||||
|
||||
<input ref={fileRef} type="file" accept="image/*" hidden onChange={onFile} />
|
||||
</>
|
||||
}
|
||||
|
||||
// Map the thrown reasons from lib/scan.js to something a person can act on.
|
||||
function scanErrorMessage(e) {
|
||||
const m = String(e && e.message)
|
||||
if (m === 'permission-denied') return t('Camera permission is needed to scan. Enable it in Settings.')
|
||||
if (m === 'unsupported') return t('Scanning is not available on this device.')
|
||||
return t('Could not start the scanner')
|
||||
}
|
||||
@@ -94,6 +94,23 @@ export default function Home() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Jump to the gym check-in cards (QR membership codes). Shown here as a quick tap on
|
||||
arrival at the gym; folds away per user via the "Gym check-in" switch in Settings. */}
|
||||
{S.checkIn !== false && (
|
||||
<div className="card tappable" style={{ cursor: 'pointer' }} {...tappable(() => nav('/checkin'))}>
|
||||
<div className="row between">
|
||||
<div className="row" style={{ gap: 9 }}>
|
||||
<span className="lrow-i" style={{ background: 'var(--blue)' }}><Icon name="qr" /></span>
|
||||
<div>
|
||||
<div className="lbl2">{t('At the gym')}</div>
|
||||
<div className="ttl">{t('Check in')}</div>
|
||||
</div>
|
||||
</div>
|
||||
<Icon name="chevronRight" className="chev" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!S.routines.length && !S.active && (
|
||||
<div className="card">
|
||||
<div className="row" style={{ gap: 10, marginBottom: 6 }}>
|
||||
|
||||
@@ -140,6 +140,11 @@ export default function Settings() {
|
||||
options={[{ value: MONDAY, label: t('Monday') }, { value: SUNDAY, label: t('Sunday') }]}
|
||||
value={weekStartOf(S)} onChange={v => update(s => { s.weekStart = v })} />
|
||||
</Row>
|
||||
{/* Membership QR codes on Home (views/CheckIn.jsx); off = no Home card, no route. */}
|
||||
<Row icon="qr" iconTint="var(--blue)" title={t('Gym check-in')}
|
||||
subtitle={t('Show a card on Home with your membership QR codes.')}>
|
||||
<Switch checked={S.checkIn !== false} onChange={v => update(s => { s.checkIn = v })} />
|
||||
</Row>
|
||||
</Section>
|
||||
|
||||
{/* ---------- during a workout ---------- */}
|
||||
|
||||
Reference in new issue
Block a user