Compare commits
1 Commits
jarvis-tod
...
v1.0.10
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be0f893f67 |
@@ -6,54 +6,31 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
# RN/NDK builds need ~6GB and once took down the 8GB VPS — desktop runner only.
|
# Builds on Marcus's MacBook: runner label `macos`, host mode (no container),
|
||||||
# Jobs queue while the desktop is offline.
|
# using the Node, JDK 21 and Android SDK set in the runner's config.yaml.
|
||||||
runs-on: desktop
|
# Jobs queue while the laptop is asleep or offline.
|
||||||
container:
|
# (Was `desktop` + a Linux container until 2026-11-24.)
|
||||||
image: eclipse-temurin:21-jdk
|
runs-on: macos
|
||||||
steps:
|
steps:
|
||||||
# actions/checkout needs node, which this container lacks — clone directly
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
run: |
|
run: |
|
||||||
apt-get update -qq && apt-get install -y -qq git unzip curl xz-utils >/dev/null
|
|
||||||
git init -q .
|
git init -q .
|
||||||
git fetch -q --depth 1 "https://git.rehbock.xyz/${{ github.repository }}.git" "${{ github.sha }}"
|
git fetch -q --depth 1 "https://git.rehbock.xyz/${{ github.repository }}.git" "${{ github.sha }}"
|
||||||
git checkout -q FETCH_HEAD
|
git checkout -q FETCH_HEAD
|
||||||
|
|
||||||
# /root/.npm and /root/.gradle and /root/android-sdk are persistent named
|
- name: Toolchain
|
||||||
# volumes (act_runner config.yaml) — downloads below only happen on a cold cache.
|
|
||||||
- name: Install Node 22 (cached in npm volume)
|
|
||||||
run: |
|
run: |
|
||||||
NODE_DIR="$HOME/.npm/_node-v22.14.0"
|
node --version
|
||||||
if [ ! -x "$NODE_DIR/bin/node" ]; then
|
java -version 2>&1 | head -1
|
||||||
curl -sLo /tmp/node.tar.xz https://nodejs.org/dist/v22.14.0/node-v22.14.0-linux-x64.tar.xz
|
test -d "$ANDROID_HOME/platforms" && echo "Android SDK: $ANDROID_HOME"
|
||||||
mkdir -p "$NODE_DIR" && tar xJf /tmp/node.tar.xz -C "$NODE_DIR" --strip-components=1
|
|
||||||
fi
|
|
||||||
echo "$NODE_DIR/bin" >> "$GITHUB_PATH"
|
|
||||||
"$NODE_DIR/bin/node" --version
|
|
||||||
|
|
||||||
- name: npm ci
|
- name: npm ci
|
||||||
run: npm ci --no-audit --no-fund
|
run: npm ci --no-audit --no-fund
|
||||||
|
|
||||||
- name: Install Android SDK + NDK (cached volume)
|
|
||||||
run: |
|
|
||||||
SDK="$HOME/android-sdk"
|
|
||||||
SDKMAN="$SDK/cmdline-tools/latest/bin/sdkmanager"
|
|
||||||
if [ ! -x "$SDKMAN" ]; then
|
|
||||||
mkdir -p "$SDK/cmdline-tools"
|
|
||||||
curl -sLo /tmp/ct.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
|
|
||||||
unzip -q /tmp/ct.zip -d /tmp
|
|
||||||
mv /tmp/cmdline-tools "$SDK/cmdline-tools/latest"
|
|
||||||
fi
|
|
||||||
yes | "$SDKMAN" --sdk_root="$SDK" --licenses >/dev/null 2>&1 || true
|
|
||||||
"$SDKMAN" --sdk_root="$SDK" \
|
|
||||||
"platform-tools" "platforms;android-36" "build-tools;36.0.0" \
|
|
||||||
"ndk;27.1.12297006" "cmake;3.22.1" >/dev/null
|
|
||||||
|
|
||||||
- name: Decode signing keystore
|
- name: Decode signing keystore
|
||||||
env:
|
env:
|
||||||
KEYSTORE_B64: ${{ secrets.KEYSTORE_B64 }}
|
KEYSTORE_B64: ${{ secrets.KEYSTORE_B64 }}
|
||||||
run: echo "$KEYSTORE_B64" | base64 -d > /tmp/release.jks
|
run: echo "$KEYSTORE_B64" | base64 -d > "$PWD/.release.jks"
|
||||||
|
|
||||||
- name: Prebuild android project
|
- name: Prebuild android project
|
||||||
env:
|
env:
|
||||||
@@ -63,13 +40,12 @@ jobs:
|
|||||||
|
|
||||||
- name: Build signed release APK (arm64)
|
- name: Build signed release APK (arm64)
|
||||||
env:
|
env:
|
||||||
HEALTH_KEYSTORE: /tmp/release.jks
|
|
||||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||||
KEY_ALIAS: health
|
KEY_ALIAS: health
|
||||||
VERSION_CODE: ${{ github.run_number }}
|
VERSION_CODE: ${{ github.run_number }}
|
||||||
VERSION_NAME: 1.0.${{ github.run_number }}
|
VERSION_NAME: 1.0.${{ github.run_number }}
|
||||||
run: |
|
run: |
|
||||||
export ANDROID_HOME="$HOME/android-sdk"
|
export HEALTH_KEYSTORE="$PWD/.release.jks"
|
||||||
echo "sdk.dir=$ANDROID_HOME" > android/local.properties
|
echo "sdk.dir=$ANDROID_HOME" > android/local.properties
|
||||||
cd android && ./gradlew assembleRelease -PreactNativeArchitectures=arm64-v8a \
|
cd android && ./gradlew assembleRelease -PreactNativeArchitectures=arm64-v8a \
|
||||||
--no-daemon --console=plain
|
--no-daemon --console=plain
|
||||||
@@ -85,8 +61,8 @@ jobs:
|
|||||||
curl -sf -X POST "$API/releases" \
|
curl -sf -X POST "$API/releases" \
|
||||||
-H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
-H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
||||||
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"body\":\"Automated build of commit ${{ github.sha }}\",\"target_commitish\":\"${{ github.sha }}\"}" \
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"body\":\"Automated build of commit ${{ github.sha }}\",\"target_commitish\":\"${{ github.sha }}\"}" \
|
||||||
> /tmp/release.json
|
> "$PWD/.release.json"
|
||||||
RID=$(grep -o '"id":[0-9]*' /tmp/release.json | head -1 | cut -d: -f2)
|
RID=$(grep -o '"id":[0-9]*' "$PWD/.release.json" | head -1 | cut -d: -f2)
|
||||||
echo "release id: $RID"
|
echo "release id: $RID"
|
||||||
curl -sf -X POST "$API/releases/$RID/assets?name=health-app-$TAG-arm64.apk" \
|
curl -sf -X POST "$API/releases/$RID/assets?name=health-app-$TAG-arm64.apk" \
|
||||||
-H "Authorization: token $TOKEN" \
|
-H "Authorization: token $TOKEN" \
|
||||||
|
|||||||
5
app.json
5
app.json
@@ -6,7 +6,7 @@
|
|||||||
"orientation": "portrait",
|
"orientation": "portrait",
|
||||||
"icon": "./assets/images/icon.png",
|
"icon": "./assets/images/icon.png",
|
||||||
"scheme": "healthapp",
|
"scheme": "healthapp",
|
||||||
"userInterfaceStyle": "automatic",
|
"userInterfaceStyle": "dark",
|
||||||
"backgroundColor": "#0d0d0f",
|
"backgroundColor": "#0d0d0f",
|
||||||
"ios": {
|
"ios": {
|
||||||
"icon": "./assets/images/icon.png",
|
"icon": "./assets/images/icon.png",
|
||||||
@@ -60,8 +60,7 @@
|
|||||||
"image": "./assets/images/splash-icon.png",
|
"image": "./assets/images/splash-icon.png",
|
||||||
"imageWidth": 76
|
"imageWidth": 76
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"expo-dev-client"
|
|
||||||
],
|
],
|
||||||
"experiments": {
|
"experiments": {
|
||||||
"typedRoutes": true,
|
"typedRoutes": true,
|
||||||
|
|||||||
148
package-lock.json
generated
148
package-lock.json
generated
@@ -8,11 +8,9 @@
|
|||||||
"name": "health-app",
|
"name": "health-app",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@expo-google-fonts/figtree": "^0.4.1",
|
|
||||||
"@expo/ui": "~57.0.9",
|
"@expo/ui": "~57.0.9",
|
||||||
"expo": "~57.0.11",
|
"expo": "~57.0.11",
|
||||||
"expo-constants": "~57.0.9",
|
"expo-constants": "~57.0.9",
|
||||||
"expo-dev-client": "~57.0.22",
|
|
||||||
"expo-device": "~57.0.1",
|
"expo-device": "~57.0.1",
|
||||||
"expo-font": "~57.0.1",
|
"expo-font": "~57.0.1",
|
||||||
"expo-glass-effect": "~57.0.1",
|
"expo-glass-effect": "~57.0.1",
|
||||||
@@ -30,7 +28,6 @@
|
|||||||
"react-native": "0.86.2",
|
"react-native": "0.86.2",
|
||||||
"react-native-gesture-handler": "~2.32.0",
|
"react-native-gesture-handler": "~2.32.0",
|
||||||
"react-native-health-connect": "^4.1.3",
|
"react-native-health-connect": "^4.1.3",
|
||||||
"react-native-keyboard-controller": "1.21.9",
|
|
||||||
"react-native-reanimated": "4.5.1",
|
"react-native-reanimated": "4.5.1",
|
||||||
"react-native-safe-area-context": "~5.7.0",
|
"react-native-safe-area-context": "~5.7.0",
|
||||||
"react-native-screens": "~4.26.0",
|
"react-native-screens": "~4.26.0",
|
||||||
@@ -78,6 +75,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz",
|
||||||
"integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
|
"integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.29.7",
|
"@babel/code-frame": "^7.29.7",
|
||||||
"@babel/generator": "^7.29.7",
|
"@babel/generator": "^7.29.7",
|
||||||
@@ -962,7 +960,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.29.7.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.29.7.tgz",
|
||||||
"integrity": "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==",
|
"integrity": "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/helper-plugin-utils": "^7.29.7"
|
"@babel/helper-plugin-utils": "^7.29.7"
|
||||||
},
|
},
|
||||||
@@ -978,7 +975,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.29.7.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.29.7.tgz",
|
||||||
"integrity": "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==",
|
"integrity": "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/helper-plugin-utils": "^7.29.7"
|
"@babel/helper-plugin-utils": "^7.29.7"
|
||||||
},
|
},
|
||||||
@@ -1010,7 +1006,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.29.8.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.29.8.tgz",
|
||||||
"integrity": "sha512-0UpIXPtdDtMXfnV2OJAVMLpj3H/92vmkA6lpSRakmycJvj3VUy6Xs1dM8tXRugupykr5WB+LpiVl0J8LMVg2mg==",
|
"integrity": "sha512-0UpIXPtdDtMXfnV2OJAVMLpj3H/92vmkA6lpSRakmycJvj3VUy6Xs1dM8tXRugupykr5WB+LpiVl0J8LMVg2mg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/helper-plugin-utils": "^7.29.7"
|
"@babel/helper-plugin-utils": "^7.29.7"
|
||||||
},
|
},
|
||||||
@@ -1200,12 +1195,6 @@
|
|||||||
"node": ">=0.8.0"
|
"node": ">=0.8.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@expo-google-fonts/figtree": {
|
|
||||||
"version": "0.4.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@expo-google-fonts/figtree/-/figtree-0.4.1.tgz",
|
|
||||||
"integrity": "sha512-6IQQddGeR3yZBSwiIjy2kd1gA+5s2esF8JAFw6M1qqU4RUlj4Zxkw9J+gixAtZFgd+QIS875EPHqeYlpaRcCRw==",
|
|
||||||
"license": "MIT AND OFL-1.1"
|
|
||||||
},
|
|
||||||
"node_modules/@expo-google-fonts/material-symbols": {
|
"node_modules/@expo-google-fonts/material-symbols": {
|
||||||
"version": "0.4.42",
|
"version": "0.4.42",
|
||||||
"resolved": "https://registry.npmjs.org/@expo-google-fonts/material-symbols/-/material-symbols-0.4.42.tgz",
|
"resolved": "https://registry.npmjs.org/@expo-google-fonts/material-symbols/-/material-symbols-0.4.42.tgz",
|
||||||
@@ -1595,9 +1584,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@expo/schema-utils": {
|
"node_modules/@expo/schema-utils": {
|
||||||
"version": "57.0.3",
|
"version": "57.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@expo/schema-utils/-/schema-utils-57.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@expo/schema-utils/-/schema-utils-57.0.2.tgz",
|
||||||
"integrity": "sha512-HcxLkgZbutEjhMVqOPw+MsSjQSqLLG6KtdjbNltms5AN7LibbGe32ae8TRnjeRcelE0+dGOdjdby8seGAO01IQ==",
|
"integrity": "sha512-fMu/jyN0l1Wzv7XkeWR4IYCx1M8ryui3FdBNGrWwbRgJ7EhxXxK8E2jxP2W3pbgUwUY0V3hG8+GyfCZwny+Lxw==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@expo/sdk-runtime-versions": {
|
"node_modules/@expo/sdk-runtime-versions": {
|
||||||
@@ -2230,7 +2219,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@react-native/babel-preset/-/babel-preset-0.86.2.tgz",
|
"resolved": "https://registry.npmjs.org/@react-native/babel-preset/-/babel-preset-0.86.2.tgz",
|
||||||
"integrity": "sha512-4XKEJ6jKW9lXMB1O5o47gBoGgolde1fbX13gLW/erlcn+1ky+MHHo5UjuM3RWGdPJHIvIzekDDumSUHhB9x5iQ==",
|
"integrity": "sha512-4XKEJ6jKW9lXMB1O5o47gBoGgolde1fbX13gLW/erlcn+1ky+MHHo5UjuM3RWGdPJHIvIzekDDumSUHhB9x5iQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "^7.25.2",
|
"@babel/core": "^7.25.2",
|
||||||
"@babel/plugin-proposal-export-default-from": "^7.24.7",
|
"@babel/plugin-proposal-export-default-from": "^7.24.7",
|
||||||
@@ -2393,7 +2381,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@react-native/metro-babel-transformer/-/metro-babel-transformer-0.86.2.tgz",
|
"resolved": "https://registry.npmjs.org/@react-native/metro-babel-transformer/-/metro-babel-transformer-0.86.2.tgz",
|
||||||
"integrity": "sha512-mX1wgLErdb2hDgXJr9zM9SWLe+ZteZTFTwRWGOQ53yEJwc9DVSnxdTlAtVdMeOj2ntycKh0R8jYdat2Am43cwQ==",
|
"integrity": "sha512-mX1wgLErdb2hDgXJr9zM9SWLe+ZteZTFTwRWGOQ53yEJwc9DVSnxdTlAtVdMeOj2ntycKh0R8jYdat2Am43cwQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "^7.25.2",
|
"@babel/core": "^7.25.2",
|
||||||
"@react-native/babel-preset": "0.86.2",
|
"@react-native/babel-preset": "0.86.2",
|
||||||
@@ -2412,7 +2399,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@react-native/metro-config/-/metro-config-0.86.2.tgz",
|
"resolved": "https://registry.npmjs.org/@react-native/metro-config/-/metro-config-0.86.2.tgz",
|
||||||
"integrity": "sha512-hJno256j+MS0b3JD1aD3ouTGZVacKNVBuXL2atMQQ8BZ060vl1ptnZ83y569aDW+/rgFSOcqn6ydKeSz4uUKQQ==",
|
"integrity": "sha512-hJno256j+MS0b3JD1aD3ouTGZVacKNVBuXL2atMQQ8BZ060vl1ptnZ83y569aDW+/rgFSOcqn6ydKeSz4uUKQQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-native/js-polyfills": "0.86.2",
|
"@react-native/js-polyfills": "0.86.2",
|
||||||
"@react-native/metro-babel-transformer": "0.86.2",
|
"@react-native/metro-babel-transformer": "0.86.2",
|
||||||
@@ -2463,7 +2449,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.1.tgz",
|
||||||
"integrity": "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==",
|
"integrity": "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.10.4",
|
"@babel/code-frame": "^7.10.4",
|
||||||
"@babel/runtime": "^7.12.5",
|
"@babel/runtime": "^7.12.5",
|
||||||
@@ -2483,7 +2468,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",
|
||||||
"integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
|
"integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
},
|
},
|
||||||
@@ -2496,7 +2480,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz",
|
||||||
"integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==",
|
"integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ansi-regex": "^5.0.1",
|
"ansi-regex": "^5.0.1",
|
||||||
"ansi-styles": "^5.0.0",
|
"ansi-styles": "^5.0.0",
|
||||||
@@ -2510,8 +2493,7 @@
|
|||||||
"version": "17.0.2",
|
"version": "17.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
|
||||||
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
|
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
|
||||||
"license": "MIT",
|
"license": "MIT"
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@testing-library/jest-dom": {
|
"node_modules/@testing-library/jest-dom": {
|
||||||
"version": "6.9.1",
|
"version": "6.9.1",
|
||||||
@@ -2555,8 +2537,7 @@
|
|||||||
"version": "5.0.4",
|
"version": "5.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz",
|
||||||
"integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==",
|
"integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==",
|
||||||
"license": "MIT",
|
"license": "MIT"
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@types/hammerjs": {
|
"node_modules/@types/hammerjs": {
|
||||||
"version": "2.0.46",
|
"version": "2.0.46",
|
||||||
@@ -2602,6 +2583,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.18.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.18.tgz",
|
||||||
"integrity": "sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==",
|
"integrity": "sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"csstype": "^3.2.2"
|
"csstype": "^3.2.2"
|
||||||
}
|
}
|
||||||
@@ -3067,6 +3049,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.10.44",
|
"baseline-browser-mapping": "^2.10.44",
|
||||||
"caniuse-lite": "^1.0.30001806",
|
"caniuse-lite": "^1.0.30001806",
|
||||||
@@ -3593,8 +3576,7 @@
|
|||||||
"version": "0.5.16",
|
"version": "0.5.16",
|
||||||
"resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz",
|
"resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz",
|
||||||
"integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==",
|
"integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==",
|
||||||
"license": "MIT",
|
"license": "MIT"
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/dom-serializer": {
|
"node_modules/dom-serializer": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
@@ -3758,6 +3740,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/expo/-/expo-57.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/expo/-/expo-57.0.11.tgz",
|
||||||
"integrity": "sha512-R97257N39Dw0kQFuI4/RvYx95GQ+dmePdo8hxcMOjDxAT4VcCckjILJeAWCE19Jxjb92hZ5NDXAfDPkkV1RB9w==",
|
"integrity": "sha512-R97257N39Dw0kQFuI4/RvYx95GQ+dmePdo8hxcMOjDxAT4VcCckjILJeAWCE19Jxjb92hZ5NDXAfDPkkV1RB9w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.0",
|
"@babel/runtime": "^7.20.0",
|
||||||
"@expo/cli": "^57.0.13",
|
"@expo/cli": "^57.0.13",
|
||||||
@@ -3850,6 +3833,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/expo-constants/-/expo-constants-57.0.9.tgz",
|
"resolved": "https://registry.npmjs.org/expo-constants/-/expo-constants-57.0.9.tgz",
|
||||||
"integrity": "sha512-Y47sGiF+U8fwicUSPdJPjB27PuU+FgLK4Mpai0ksZF5hv8jNN3HBqKuDNxsiu70uHBKf80TaR4gwMPh0pmETiQ==",
|
"integrity": "sha512-Y47sGiF+U8fwicUSPdJPjB27PuU+FgLK4Mpai0ksZF5hv8jNN3HBqKuDNxsiu70uHBKf80TaR4gwMPh0pmETiQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@expo/env": "~2.4.2"
|
"@expo/env": "~2.4.2"
|
||||||
},
|
},
|
||||||
@@ -3858,59 +3842,6 @@
|
|||||||
"react-native": "*"
|
"react-native": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/expo-dev-client": {
|
|
||||||
"version": "57.0.22",
|
|
||||||
"resolved": "https://registry.npmjs.org/expo-dev-client/-/expo-dev-client-57.0.22.tgz",
|
|
||||||
"integrity": "sha512-h2D8crZoeD2Re2vMvmDrb1u1DQusfU/kqHYVPxTFxAt0H6J6OpPvR/O+1arXfthtTkQUbRNFkXPFLLrRZ+ds7Q==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"expo-dev-launcher": "~57.0.23",
|
|
||||||
"expo-dev-menu": "~57.0.22",
|
|
||||||
"expo-dev-menu-interface": "~57.0.0",
|
|
||||||
"expo-manifests": "~57.0.2",
|
|
||||||
"expo-updates-interface": "~57.0.2"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"expo": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/expo-dev-launcher": {
|
|
||||||
"version": "57.0.23",
|
|
||||||
"resolved": "https://registry.npmjs.org/expo-dev-launcher/-/expo-dev-launcher-57.0.23.tgz",
|
|
||||||
"integrity": "sha512-0G4LHr4+zvqGgIoiAsSLgJbPMggOT8eJ+bcN5t/bZXZMvFH8uu4yCoMHAGNZ1jkPH7Ia2hkqW30Zh5QMwQ/AwA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@expo/schema-utils": "^57.0.3",
|
|
||||||
"expo-dev-menu": "~57.0.22",
|
|
||||||
"expo-manifests": "~57.0.2"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"expo": "*",
|
|
||||||
"react-native": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/expo-dev-menu": {
|
|
||||||
"version": "57.0.22",
|
|
||||||
"resolved": "https://registry.npmjs.org/expo-dev-menu/-/expo-dev-menu-57.0.22.tgz",
|
|
||||||
"integrity": "sha512-G8QRNDLhb2CYsBNoS2FIrId8SWYdxlYk+BLEwodJFMnCbz31quLP50DHEcEtMjYuc3/szTnCoaQY8BFNrBAUzA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"expo-dev-menu-interface": "~57.0.0"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"expo": "*",
|
|
||||||
"react-native": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/expo-dev-menu-interface": {
|
|
||||||
"version": "57.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/expo-dev-menu-interface/-/expo-dev-menu-interface-57.0.0.tgz",
|
|
||||||
"integrity": "sha512-F47VdzOHYc19FhI/jBgctpO8a5UskTIxG6a1E5t3W5gF8VImuvBQffdXXfLHhsuCl7dS3v3U0R45cleeVXO1Zg==",
|
|
||||||
"license": "MIT",
|
|
||||||
"peerDependencies": {
|
|
||||||
"expo": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/expo-device": {
|
"node_modules/expo-device": {
|
||||||
"version": "57.0.1",
|
"version": "57.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/expo-device/-/expo-device-57.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/expo-device/-/expo-device-57.0.1.tgz",
|
||||||
@@ -3938,6 +3869,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/expo-font/-/expo-font-57.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/expo-font/-/expo-font-57.0.1.tgz",
|
||||||
"integrity": "sha512-QyS9L1Kh9sKJg4gfU6rdbpxpmH+DyzBX8z6jVvXMUDoqLr1GqmkO/Wu379KCXjL///kWbhpNlbi7AgBuj4VdIQ==",
|
"integrity": "sha512-QyS9L1Kh9sKJg4gfU6rdbpxpmH+DyzBX8z6jVvXMUDoqLr1GqmkO/Wu379KCXjL///kWbhpNlbi7AgBuj4VdIQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fontfaceobserver": "^2.1.0"
|
"fontfaceobserver": "^2.1.0"
|
||||||
},
|
},
|
||||||
@@ -3978,12 +3910,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/expo-json-utils": {
|
|
||||||
"version": "57.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/expo-json-utils/-/expo-json-utils-57.0.2.tgz",
|
|
||||||
"integrity": "sha512-9kYZECLKE3pYZQs+kt3+ggY83Lfryog9/UEo3HJKGcHUZeKKtlFBIPFjI4LzREubsvjP7AsvG0FdEX9EquIoAQ==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/expo-keep-awake": {
|
"node_modules/expo-keep-awake": {
|
||||||
"version": "57.0.1",
|
"version": "57.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/expo-keep-awake/-/expo-keep-awake-57.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/expo-keep-awake/-/expo-keep-awake-57.0.1.tgz",
|
||||||
@@ -3999,6 +3925,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/expo-linking/-/expo-linking-57.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/expo-linking/-/expo-linking-57.0.5.tgz",
|
||||||
"integrity": "sha512-SmJI3wr0EVfeKPGf+Qgr9gUbrXk8mM0ATqYLvAX/EAzawDjohPzMJ5pTt7TYMX0Wknj4XCtyCQrGhnERMXT6cQ==",
|
"integrity": "sha512-SmJI3wr0EVfeKPGf+Qgr9gUbrXk8mM0ATqYLvAX/EAzawDjohPzMJ5pTt7TYMX0Wknj4XCtyCQrGhnERMXT6cQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"expo-constants": "~57.0.9",
|
"expo-constants": "~57.0.9",
|
||||||
"invariant": "^2.2.4"
|
"invariant": "^2.2.4"
|
||||||
@@ -4008,18 +3935,6 @@
|
|||||||
"react-native": "*"
|
"react-native": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/expo-manifests": {
|
|
||||||
"version": "57.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/expo-manifests/-/expo-manifests-57.0.2.tgz",
|
|
||||||
"integrity": "sha512-pPIIcKR73OShwlWMg8H90WRzKUd2krDdKlKAwuQV1FtUwE7H3hQEFw0ePFQY9yFoGMF/77ryYwNKfI5umMcCog==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"expo-json-utils": "~57.0.2"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"expo": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/expo-modules-autolinking": {
|
"node_modules/expo-modules-autolinking": {
|
||||||
"version": "57.0.9",
|
"version": "57.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/expo-modules-autolinking/-/expo-modules-autolinking-57.0.9.tgz",
|
"resolved": "https://registry.npmjs.org/expo-modules-autolinking/-/expo-modules-autolinking-57.0.9.tgz",
|
||||||
@@ -4070,6 +3985,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/expo-router/-/expo-router-57.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/expo-router/-/expo-router-57.0.11.tgz",
|
||||||
"integrity": "sha512-kE2hz4lLkddZ94vN4nmbq5aXeo0t6FaZ8xJn/Hyn8/dQPsGlvDK0j4ZVayEUUdNmkNHsBVihgf1bl/2rCsYEzA==",
|
"integrity": "sha512-kE2hz4lLkddZ94vN4nmbq5aXeo0t6FaZ8xJn/Hyn8/dQPsGlvDK0j4ZVayEUUdNmkNHsBVihgf1bl/2rCsYEzA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@expo/log-box": "^57.0.2",
|
"@expo/log-box": "^57.0.2",
|
||||||
"@expo/metro-runtime": "^57.0.8",
|
"@expo/metro-runtime": "^57.0.8",
|
||||||
@@ -4153,6 +4069,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/expo-server/-/expo-server-57.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/expo-server/-/expo-server-57.0.1.tgz",
|
||||||
"integrity": "sha512-sBfVDH6dmKVHZxqUxbfkzS00PZELMZt1IpnHKxcOTMZtR/t7CtRAFrbXcisG+EyzeqHSVDacZT+1tbYfZt5D8w==",
|
"integrity": "sha512-sBfVDH6dmKVHZxqUxbfkzS00PZELMZt1IpnHKxcOTMZtR/t7CtRAFrbXcisG+EyzeqHSVDacZT+1tbYfZt5D8w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20.16.0"
|
"node": ">=20.16.0"
|
||||||
}
|
}
|
||||||
@@ -4218,15 +4135,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/expo-updates-interface": {
|
|
||||||
"version": "57.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/expo-updates-interface/-/expo-updates-interface-57.0.2.tgz",
|
|
||||||
"integrity": "sha512-x3SA5toiHZEkW+5oeNdUM1Rvt6M3ExegQsSwS3Z1+S9gn9utGYTGBkb8MBQivhjIZiRlQYDIhauxA8kySQEWtQ==",
|
|
||||||
"license": "MIT",
|
|
||||||
"peerDependencies": {
|
|
||||||
"expo": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/expo-web-browser": {
|
"node_modules/expo-web-browser": {
|
||||||
"version": "57.0.2",
|
"version": "57.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/expo-web-browser/-/expo-web-browser-57.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/expo-web-browser/-/expo-web-browser-57.0.2.tgz",
|
||||||
@@ -4425,6 +4333,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.21.3.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.21.3.tgz",
|
||||||
"integrity": "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw==",
|
"integrity": "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.0.0"
|
"node": ">=10.0.0"
|
||||||
},
|
},
|
||||||
@@ -5534,7 +5443,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz",
|
||||||
"integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==",
|
"integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"lz-string": "bin/bin.js"
|
"lz-string": "bin/bin.js"
|
||||||
}
|
}
|
||||||
@@ -6539,6 +6447,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz",
|
||||||
"integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==",
|
"integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
@@ -6558,6 +6467,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz",
|
||||||
"integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==",
|
"integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"scheduler": "^0.27.0"
|
"scheduler": "^0.27.0"
|
||||||
},
|
},
|
||||||
@@ -6594,6 +6504,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-native/-/react-native-0.86.2.tgz",
|
"resolved": "https://registry.npmjs.org/react-native/-/react-native-0.86.2.tgz",
|
||||||
"integrity": "sha512-zbJXGZpwfZGA79Z9ob6Atvfx4nAQL8yJBa35s58E4Oo+khPykfQP2sTeumkKbjwajFYfVayg8pj7Il9nIfTk7A==",
|
"integrity": "sha512-zbJXGZpwfZGA79Z9ob6Atvfx4nAQL8yJBa35s58E4Oo+khPykfQP2sTeumkKbjwajFYfVayg8pj7Il9nIfTk7A==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-native/assets-registry": "0.86.2",
|
"@react-native/assets-registry": "0.86.2",
|
||||||
"@react-native/codegen": "0.86.2",
|
"@react-native/codegen": "0.86.2",
|
||||||
@@ -6669,6 +6580,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-2.32.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-2.32.0.tgz",
|
||||||
"integrity": "sha512-uYIMOKlKENORq2SABE+jIjbPU+h5I/sQKcq2v16zRq848nwEp1fWRVwML4QWqijc8UcXJC25o54S8GQd4Mf2OA==",
|
"integrity": "sha512-uYIMOKlKENORq2SABE+jIjbPU+h5I/sQKcq2v16zRq848nwEp1fWRVwML4QWqijc8UcXJC25o54S8GQd4Mf2OA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@egjs/hammerjs": "^2.0.17",
|
"@egjs/hammerjs": "^2.0.17",
|
||||||
"@types/react-test-renderer": "^19.1.0",
|
"@types/react-test-renderer": "^19.1.0",
|
||||||
@@ -6720,25 +6632,12 @@
|
|||||||
"react-native": "*"
|
"react-native": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-native-keyboard-controller": {
|
|
||||||
"version": "1.21.9",
|
|
||||||
"resolved": "https://registry.npmjs.org/react-native-keyboard-controller/-/react-native-keyboard-controller-1.21.9.tgz",
|
|
||||||
"integrity": "sha512-+TkkFldht4+AXBQeDy1hLE7iqiW8/NkY/ekhcFsKIiRdI9qC5JDzx0TfAg1iYZB2IeOXppmURIy2jFCUjOcV1w==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"react-native-is-edge-to-edge": "^1.2.1"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "*",
|
|
||||||
"react-native": "*",
|
|
||||||
"react-native-reanimated": ">=3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/react-native-reanimated": {
|
"node_modules/react-native-reanimated": {
|
||||||
"version": "4.5.1",
|
"version": "4.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-4.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-4.5.1.tgz",
|
||||||
"integrity": "sha512-RnMvtDuR+68ig864gAvZCOdZehqhC5rFmMo0kn+ARfgVSTvFeF6IFLBVgMPUu0KwihaapEyW24WRi6nEyy1kSA==",
|
"integrity": "sha512-RnMvtDuR+68ig864gAvZCOdZehqhC5rFmMo0kn+ARfgVSTvFeF6IFLBVgMPUu0KwihaapEyW24WRi6nEyy1kSA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react-native-is-edge-to-edge": "^1.3.1",
|
"react-native-is-edge-to-edge": "^1.3.1",
|
||||||
"semver": "^7.7.3"
|
"semver": "^7.7.3"
|
||||||
@@ -6754,6 +6653,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-5.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-5.7.0.tgz",
|
||||||
"integrity": "sha512-/9/MtQz8ODphjsLdZ+GZAIcC/RtoqW9EeShf7Uvnfgm/pzYrJ75y3PV/J1wuAV1T5Dye5ygq4EAW20RoBq0ABQ==",
|
"integrity": "sha512-/9/MtQz8ODphjsLdZ+GZAIcC/RtoqW9EeShf7Uvnfgm/pzYrJ75y3PV/J1wuAV1T5Dye5ygq4EAW20RoBq0ABQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "*",
|
"react": "*",
|
||||||
"react-native": "*"
|
"react-native": "*"
|
||||||
@@ -6793,6 +6693,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-native-web/-/react-native-web-0.21.2.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-web/-/react-native-web-0.21.2.tgz",
|
||||||
"integrity": "sha512-SO2t9/17zM4iEnFvlu2DA9jqNbzNhoUP+AItkoCOyFmDMOhUnBBznBDCYN92fGdfAkfQlWzPoez6+zLxFNsZEg==",
|
"integrity": "sha512-SO2t9/17zM4iEnFvlu2DA9jqNbzNhoUP+AItkoCOyFmDMOhUnBBznBDCYN92fGdfAkfQlWzPoez6+zLxFNsZEg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.18.6",
|
"@babel/runtime": "^7.18.6",
|
||||||
"@react-native/normalize-colors": "^0.74.1",
|
"@react-native/normalize-colors": "^0.74.1",
|
||||||
@@ -6825,6 +6726,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-native-worklets/-/react-native-worklets-0.10.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-worklets/-/react-native-worklets-0.10.1.tgz",
|
||||||
"integrity": "sha512-62mRM19bDpfpdI8HLkEErcdOsrAPDtE9lA/sw+5lLRpzBHNhxaoj9QyY2KjXqUmirelxkX4zuPGTC3VdA0feJA==",
|
"integrity": "sha512-62mRM19bDpfpdI8HLkEErcdOsrAPDtE9lA/sw+5lLRpzBHNhxaoj9QyY2KjXqUmirelxkX4zuPGTC3VdA0feJA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/plugin-transform-arrow-functions": "^7.27.1",
|
"@babel/plugin-transform-arrow-functions": "^7.27.1",
|
||||||
"@babel/plugin-transform-class-properties": "^7.28.6",
|
"@babel/plugin-transform-class-properties": "^7.28.6",
|
||||||
@@ -6860,6 +6762,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz",
|
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz",
|
||||||
"integrity": "sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==",
|
"integrity": "sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
@@ -7625,6 +7528,7 @@
|
|||||||
"integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
|
"integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
|
|||||||
@@ -3,11 +3,9 @@
|
|||||||
"main": "expo-router/entry",
|
"main": "expo-router/entry",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@expo-google-fonts/figtree": "^0.4.1",
|
|
||||||
"@expo/ui": "~57.0.9",
|
"@expo/ui": "~57.0.9",
|
||||||
"expo": "~57.0.11",
|
"expo": "~57.0.11",
|
||||||
"expo-constants": "~57.0.9",
|
"expo-constants": "~57.0.9",
|
||||||
"expo-dev-client": "~57.0.22",
|
|
||||||
"expo-device": "~57.0.1",
|
"expo-device": "~57.0.1",
|
||||||
"expo-font": "~57.0.1",
|
"expo-font": "~57.0.1",
|
||||||
"expo-glass-effect": "~57.0.1",
|
"expo-glass-effect": "~57.0.1",
|
||||||
@@ -25,7 +23,6 @@
|
|||||||
"react-native": "0.86.2",
|
"react-native": "0.86.2",
|
||||||
"react-native-gesture-handler": "~2.32.0",
|
"react-native-gesture-handler": "~2.32.0",
|
||||||
"react-native-health-connect": "^4.1.3",
|
"react-native-health-connect": "^4.1.3",
|
||||||
"react-native-keyboard-controller": "1.21.9",
|
|
||||||
"react-native-reanimated": "4.5.1",
|
"react-native-reanimated": "4.5.1",
|
||||||
"react-native-safe-area-context": "~5.7.0",
|
"react-native-safe-area-context": "~5.7.0",
|
||||||
"react-native-screens": "~4.26.0",
|
"react-native-screens": "~4.26.0",
|
||||||
|
|||||||
@@ -1,33 +1,23 @@
|
|||||||
import {
|
|
||||||
Figtree_400Regular, Figtree_500Medium, Figtree_600SemiBold, Figtree_700Bold,
|
|
||||||
Figtree_800ExtraBold, useFonts,
|
|
||||||
} from '@expo-google-fonts/figtree';
|
|
||||||
import { Stack } from 'expo-router';
|
import { Stack } from 'expo-router';
|
||||||
import { StatusBar } from 'expo-status-bar';
|
import { StatusBar } from 'expo-status-bar';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
import { KeyboardProvider } from 'react-native-keyboard-controller';
|
|
||||||
import { AuthProvider, useAuth } from '../lib/api';
|
import { AuthProvider, useAuth } from '../lib/api';
|
||||||
import { C, F, isDark } from '../lib/theme';
|
import { C } from '../lib/theme';
|
||||||
|
|
||||||
function Gate() {
|
function Gate() {
|
||||||
const { ready } = useAuth();
|
const { ready } = useAuth();
|
||||||
const [fontsLoaded] = useFonts({
|
if (!ready) return <View style={{ flex: 1, backgroundColor: C.bg }} />;
|
||||||
Figtree_400Regular, Figtree_500Medium, Figtree_600SemiBold, Figtree_700Bold, Figtree_800ExtraBold,
|
|
||||||
});
|
|
||||||
if (!ready || !fontsLoaded) return <View style={{ flex: 1, backgroundColor: C.bg }} />;
|
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
screenOptions={{
|
screenOptions={{
|
||||||
headerStyle: { backgroundColor: C.bg },
|
headerStyle: { backgroundColor: C.bg },
|
||||||
headerTintColor: C.text,
|
headerTintColor: C.text,
|
||||||
headerTitleStyle: { fontFamily: F.bold, fontSize: 18 },
|
headerTitleStyle: { fontWeight: '600', fontSize: 17 },
|
||||||
headerShadowVisible: false,
|
headerShadowVisible: false,
|
||||||
contentStyle: { backgroundColor: C.bg },
|
contentStyle: { backgroundColor: C.bg },
|
||||||
}}>
|
}}>
|
||||||
<Stack.Screen name="index" options={{ headerShown: false }} />
|
<Stack.Screen name="index" options={{ title: 'Health' }} />
|
||||||
<Stack.Screen name="systems" options={{ title: 'All systems' }} />
|
|
||||||
<Stack.Screen name="chat" options={{ title: 'Chat' }} />
|
|
||||||
<Stack.Screen name="blood" options={{ title: 'Bloodwork' }} />
|
<Stack.Screen name="blood" options={{ title: 'Bloodwork' }} />
|
||||||
<Stack.Screen name="sleep" options={{ title: 'Sleep' }} />
|
<Stack.Screen name="sleep" options={{ title: 'Sleep' }} />
|
||||||
<Stack.Screen name="fitbit" options={{ title: 'Fitbit Air' }} />
|
<Stack.Screen name="fitbit" options={{ title: 'Fitbit Air' }} />
|
||||||
@@ -42,11 +32,9 @@ function Gate() {
|
|||||||
|
|
||||||
export default function RootLayout() {
|
export default function RootLayout() {
|
||||||
return (
|
return (
|
||||||
<KeyboardProvider>
|
<AuthProvider>
|
||||||
<AuthProvider>
|
<StatusBar style="light" />
|
||||||
<StatusBar style={isDark ? 'light' : 'dark'} />
|
<Gate />
|
||||||
<Gate />
|
</AuthProvider>
|
||||||
</AuthProvider>
|
|
||||||
</KeyboardProvider>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { StyleSheet, Text, View } from 'react-native';
|
|
||||||
import { C, F } from '../lib/theme';
|
|
||||||
|
|
||||||
/* Placeholder until the chat endpoint exists on the server. */
|
|
||||||
export default function Chat() {
|
|
||||||
return (
|
|
||||||
<View style={s.wrap}>
|
|
||||||
<Text style={s.h}>Chat is not connected yet</Text>
|
|
||||||
<Text style={s.p}>
|
|
||||||
This is where you will ask about your data and log things by typing or speaking. The
|
|
||||||
server side is the next piece to be built.
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const s = StyleSheet.create({
|
|
||||||
wrap: { flex: 1, backgroundColor: C.bg, padding: 24, paddingTop: 40 },
|
|
||||||
h: { fontFamily: F.heavy, fontSize: 28, lineHeight: 33, letterSpacing: -0.5, color: C.text, marginBottom: 10 },
|
|
||||||
p: { fontFamily: F.regular, fontSize: 16.5, lineHeight: 24, color: C.muted },
|
|
||||||
});
|
|
||||||
@@ -1,188 +1,160 @@
|
|||||||
import { router } from 'expo-router';
|
import { Link, Stack } from 'expo-router';
|
||||||
import React, { useMemo, useState } from 'react';
|
import React from 'react';
|
||||||
import { Pressable, RefreshControl, ScrollView, StyleSheet, Text, View } from 'react-native';
|
import { Text, View } from 'react-native';
|
||||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
import { NavCard, PriorityCard, Screen, Sec } from '../components/ui';
|
||||||
import {
|
import { useAuth } from '../lib/api';
|
||||||
CHAT_BAR_SPACE, Card, ChatBar, GoalBar, HabitCard, HabitGrid, Heading, RoundButton, StreakGrid,
|
import { agoTxt, fmtD, fmtDY, hm, num, cap } from '../lib/format';
|
||||||
} from '../components/kit';
|
import { shapeBiomarkers, shapeSleep, weekStart, workoutVolume } from '../lib/shape';
|
||||||
import { clearCache, useAuth } from '../lib/api';
|
import { C } from '../lib/theme';
|
||||||
import { buildBrief } from '../lib/brief';
|
import type {
|
||||||
import {
|
BiomarkersResponse, DexaResponse, HealthMeta, MeditationStats, SleepApiResponse,
|
||||||
AdherenceResponse, GoalsResponse, Habit, dailyHabits, goalRows, habitStreaks, setCheckin,
|
SleepCycleExport, WorkoutsResponse,
|
||||||
} from '../lib/life';
|
} from '../lib/types';
|
||||||
import { shapeSleep } from '../lib/shape';
|
|
||||||
import { C, F } from '../lib/theme';
|
|
||||||
import type { SleepApiResponse, SleepCycleExport, WorkoutsResponse } from '../lib/types';
|
|
||||||
import { loadAll, useLoad } from '../lib/use-load';
|
import { loadAll, useLoad } from '../lib/use-load';
|
||||||
|
|
||||||
const GOALS_SHOWN = 4;
|
|
||||||
|
|
||||||
export default function Today() {
|
export default function Today() {
|
||||||
const insets = useSafeAreaInsets();
|
|
||||||
const { hasToken } = useAuth();
|
const { hasToken } = useAuth();
|
||||||
const [refreshing, setRefreshing] = useState(false);
|
|
||||||
const [allGoals, setAllGoals] = useState(false);
|
|
||||||
/** check-ins tapped but not yet confirmed by the server, keyed protocol:rule */
|
|
||||||
const [pending, setPending] = useState<Record<string, boolean | null>>({});
|
|
||||||
|
|
||||||
const { data, loading, refresh } = useLoad(() =>
|
const { data, loading, refresh } = useLoad(() =>
|
||||||
loadAll({
|
loadAll({
|
||||||
adh: 'lifeAdherence', goals: 'lifeGoals', wo: 'workouts', sApi: 'sleepApi', sc: 'sleepCycle',
|
meta: 'meta', bio: 'biomarkers', wo: 'workouts', sApi: 'sleepApi',
|
||||||
|
sc: 'sleepCycle', dexa: 'dexa', med: 'medStats', fitbit: 'fitbitSummary',
|
||||||
} as const),
|
} as const),
|
||||||
);
|
);
|
||||||
|
|
||||||
const r = data as
|
const r = data as
|
||||||
| {
|
| {
|
||||||
adh: AdherenceResponse | null;
|
meta: HealthMeta | null;
|
||||||
goals: GoalsResponse | null;
|
bio: BiomarkersResponse | null;
|
||||||
wo: WorkoutsResponse | null;
|
wo: WorkoutsResponse | null;
|
||||||
sApi: SleepApiResponse | null;
|
sApi: SleepApiResponse | null;
|
||||||
sc: SleepCycleExport | null;
|
sc: SleepCycleExport | null;
|
||||||
|
dexa: DexaResponse | null;
|
||||||
|
med: MeditationStats | null;
|
||||||
|
fitbit: {
|
||||||
|
steps: { day: string; value: number }[];
|
||||||
|
resting_hr: { day: string; avg: number }[];
|
||||||
|
hrv: { day: string; avg: number }[];
|
||||||
|
} | null;
|
||||||
}
|
}
|
||||||
| undefined;
|
| undefined;
|
||||||
|
|
||||||
const brief = useMemo(() => {
|
const cards: React.ReactNode[] = [];
|
||||||
if (!r) return null;
|
if (r) {
|
||||||
const nights = r.sApi && r.sc ? shapeSleep(r.sApi, r.sc) : [];
|
if (r.sApi && r.sc) {
|
||||||
const lastNight = nights[nights.length - 1];
|
const nights = shapeSleep(r.sApi, r.sc);
|
||||||
const ws = r.wo ? [...r.wo.workouts].sort((a, b) => (a.start_time < b.start_time ? -1 : 1)) : [];
|
const last = nights[nights.length - 1];
|
||||||
const lastWo = ws[ws.length - 1];
|
cards.push(
|
||||||
return buildBrief({
|
<NavCard key="sleep" title="Sleep" big={hm(last.asleep)} href="/sleep"
|
||||||
sleep: lastNight ? { date: lastNight.date, asleepSec: lastNight.asleep } : null,
|
note={`Last night on record — ${fmtD(last.date)} (${last.src})`} />,
|
||||||
workout: lastWo ? { title: lastWo.title, start: lastWo.start_time } : null,
|
);
|
||||||
adherence: r.adh,
|
} else cards.push(<NavCard key="sleep" title="Sleep" big="—" note="Couldn’t load" href="/sleep" />);
|
||||||
goals: r.goals,
|
|
||||||
});
|
|
||||||
}, [r]);
|
|
||||||
|
|
||||||
const habits = useMemo<Habit[]>(() => {
|
if (r.wo) {
|
||||||
if (!r?.adh) return [];
|
const ws = [...r.wo.workouts].sort((a, b) => (a.start_time < b.start_time ? -1 : 1));
|
||||||
return dailyHabits(r.adh).map((h) => {
|
const last = ws[ws.length - 1];
|
||||||
const k = `${h.protocolId}:${h.ruleId}`;
|
const { vol } = workoutVolume(last);
|
||||||
return k in pending ? { ...h, done: !!pending[k] } : h;
|
const wkCount = ws.filter(
|
||||||
});
|
(w) => weekStart(w.start_time) === weekStart(new Date().toISOString()),
|
||||||
}, [r, pending]);
|
).length;
|
||||||
|
cards.push(
|
||||||
|
<NavCard key="train" title="Training" big={last.title} href="/train"
|
||||||
|
note={`${agoTxt(last.start_time)} · ${num(Math.round(vol))} kg · ${wkCount} this week`} />,
|
||||||
|
);
|
||||||
|
} else cards.push(<NavCard key="train" title="Training" big="—" note="Couldn’t load" href="/train" />);
|
||||||
|
|
||||||
const rows = useMemo(() => (r?.adh ? habitStreaks(r.adh) : []), [r]);
|
if (r.bio) {
|
||||||
const goals = useMemo(() => (r?.goals ? goalRows(r.goals) : []), [r]);
|
const marks = shapeBiomarkers(r.bio);
|
||||||
const doneCount = habits.filter((h) => h.done).length;
|
const latestDraw = r.bio.biomarkers.reduce((m, b) => (b.collected > m ? b.collected : m), '');
|
||||||
|
const flagged = marks.filter((m) => m.latest.flagged && m.latest.collected === latestDraw);
|
||||||
|
cards.push(
|
||||||
|
<NavCard key="blood" title="Blood" big={String(marks.length)} unit="markers" href="/blood"
|
||||||
|
flagline={
|
||||||
|
flagged.length
|
||||||
|
? `${flagged.length} flagged: ${flagged.slice(0, 3).map((f) => cap(f.name)).join(', ')}${flagged.length > 3 ? '…' : ''}`
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
okline={flagged.length ? undefined : 'All markers in range'}
|
||||||
|
note={`Latest draw ${fmtDY(latestDraw)}`} />,
|
||||||
|
);
|
||||||
|
} else cards.push(<NavCard key="blood" title="Blood" big="—" note="Couldn’t load" href="/blood" />);
|
||||||
|
|
||||||
const toggle = async (h: Habit, done: boolean | null) => {
|
if (r.dexa) {
|
||||||
if (!r?.adh) return;
|
const scan = r.dexa.scans[r.dexa.scans.length - 1];
|
||||||
const k = `${h.protocolId}:${h.ruleId}`;
|
cards.push(
|
||||||
setPending((p) => ({ ...p, [k]: done }));
|
<NavCard key="body" title="Body" big={`${scan.summary.total_body_fat_pct}`} unit="% fat"
|
||||||
try {
|
href="/body"
|
||||||
await setCheckin(h, r.adh.today, done);
|
note={`${scan.summary.total_lean_mass_kg} kg lean · DXA ${fmtD(scan.scan_date)}`} />,
|
||||||
refresh();
|
);
|
||||||
} catch {
|
} else cards.push(<NavCard key="body" title="Body" big="—" note="Couldn’t load" href="/body" />);
|
||||||
// put the card back the way the server has it
|
|
||||||
setPending((p) => {
|
if (r.med) {
|
||||||
const n = { ...p };
|
cards.push(
|
||||||
delete n[k];
|
<NavCard key="mind" title="Mind" big={String(r.med.totalMinutes)} unit="min" href="/mind"
|
||||||
return n;
|
note={`${r.med.totalSessions} sessions · streak ${r.med.currentStreak}`} />,
|
||||||
});
|
);
|
||||||
|
} else cards.push(<NavCard key="mind" title="Mind" big="—" note="Couldn’t load" href="/mind" />);
|
||||||
|
|
||||||
|
{
|
||||||
|
const fb = r.fitbit;
|
||||||
|
const steps = fb?.steps?.length ? fb.steps[fb.steps.length - 1] : null;
|
||||||
|
const hrv = fb?.hrv?.length ? fb.hrv[fb.hrv.length - 1] : null;
|
||||||
|
cards.push(
|
||||||
|
<NavCard key="fitbit" title="Fitbit" href="/fitbit"
|
||||||
|
big={steps ? num(Math.round(steps.value)) : '—'} unit={steps ? 'steps' : undefined}
|
||||||
|
note={
|
||||||
|
steps
|
||||||
|
? `${fmtD(steps.day)}${hrv ? ` · HRV ${Math.round(hrv.avg)} ms` : ''}`
|
||||||
|
: 'Open to sync from Health Connect'
|
||||||
|
} />,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
const onRefresh = () => {
|
cards.push(
|
||||||
setRefreshing(true);
|
<NavCard key="dna" title="DNA" big="99" unit="traits" href="/dna"
|
||||||
clearCache();
|
note="AncestryDNA trait report" />,
|
||||||
setPending({});
|
);
|
||||||
refresh();
|
}
|
||||||
setTimeout(() => setRefreshing(false), 500);
|
|
||||||
};
|
|
||||||
|
|
||||||
const date = new Date().toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric' });
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{ flex: 1, backgroundColor: C.bg }}>
|
<>
|
||||||
<ScrollView
|
<Stack.Screen
|
||||||
contentContainerStyle={{
|
options={{
|
||||||
paddingTop: insets.top + 10, paddingHorizontal: 16,
|
headerRight: () => (
|
||||||
paddingBottom: insets.bottom + CHAT_BAR_SPACE + 16,
|
<Link href="/settings">
|
||||||
|
<Text style={{ fontSize: 18, padding: 6 }}>⚙️</Text>
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
}}
|
}}
|
||||||
refreshControl={
|
/>
|
||||||
<RefreshControl
|
<Screen onRefresh={refresh}>
|
||||||
refreshing={refreshing} onRefresh={onRefresh} tintColor={C.muted} colors={[C.accent]}
|
<Sec
|
||||||
progressBackgroundColor={C.surface}
|
title={new Date().toLocaleDateString('en-US', {
|
||||||
/>
|
weekday: 'long', month: 'long', day: 'numeric',
|
||||||
}>
|
})}
|
||||||
<View style={s.top}>
|
/>
|
||||||
<Text style={s.date}>{date}</Text>
|
|
||||||
<RoundButton glyph="⚙︎" label="Settings" onPress={() => router.push('/settings')} />
|
|
||||||
</View>
|
|
||||||
|
|
||||||
{!hasToken ? (
|
{!hasToken ? (
|
||||||
<Card style={{ padding: 20, marginTop: 8 }}>
|
<Link href="/settings" style={{ padding: 24, textAlign: 'center', color: C.accent, fontSize: 15 }}>
|
||||||
<Text style={s.headline}>Connect your data</Text>
|
Add your API token in Settings to load your data →
|
||||||
<Text style={s.line}>Add your API token in Settings and your day will appear here.</Text>
|
</Link>
|
||||||
<Pressable style={s.cta} onPress={() => router.push('/settings')} accessibilityRole="button">
|
|
||||||
<Text style={s.ctaT}>Open Settings</Text>
|
|
||||||
</Pressable>
|
|
||||||
</Card>
|
|
||||||
) : loading && !r ? (
|
) : loading && !r ? (
|
||||||
<Text style={[s.line, { marginTop: 24 }]}>Loading your day…</Text>
|
<Text style={{ color: C.muted, fontSize: 13, textAlign: 'center', padding: 24 }}>
|
||||||
|
Loading…
|
||||||
|
</Text>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 10 }}>{cards}</View>
|
||||||
{brief ? (
|
|
||||||
<View style={{ paddingHorizontal: 4 }}>
|
|
||||||
<Text style={s.headline}>{brief.headline}</Text>
|
|
||||||
{brief.lines.map((l) => (
|
|
||||||
<Text key={l} style={s.line}>{l}</Text>
|
|
||||||
))}
|
|
||||||
</View>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
{r?.adh && habits.length ? (
|
|
||||||
<>
|
|
||||||
<Heading title="Today" meta={`${doneCount} of ${habits.length} done`} />
|
|
||||||
<HabitGrid>
|
|
||||||
{habits.map((h) => (
|
|
||||||
<HabitCard key={h.ruleId} habit={h} onToggle={(done) => toggle(h, done)} />
|
|
||||||
))}
|
|
||||||
</HabitGrid>
|
|
||||||
|
|
||||||
<Heading title="Last 14 days" action="All systems" onAction={() => router.push('/systems')} />
|
|
||||||
<Card style={{ paddingVertical: 10 }}>
|
|
||||||
<StreakGrid rows={rows} />
|
|
||||||
</Card>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<Card style={{ padding: 16, marginTop: 24 }}>
|
|
||||||
<Text style={s.line}>Your daily habits could not be loaded. Pull down to try again.</Text>
|
|
||||||
</Card>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{goals.length ? (
|
|
||||||
<>
|
|
||||||
<Heading
|
|
||||||
title="Goals"
|
|
||||||
action={goals.length > GOALS_SHOWN ? (allGoals ? 'Show fewer' : `All ${goals.length}`) : undefined}
|
|
||||||
onAction={() => setAllGoals((v) => !v)}
|
|
||||||
/>
|
|
||||||
<Card style={{ paddingVertical: 6 }}>
|
|
||||||
{(allGoals ? goals : goals.slice(0, GOALS_SHOWN)).map((g) => (
|
|
||||||
<GoalBar key={g.id} goal={g} />
|
|
||||||
))}
|
|
||||||
</Card>
|
|
||||||
</>
|
|
||||||
) : null}
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</ScrollView>
|
{r?.meta?.current_priorities?.length ? (
|
||||||
<ChatBar />
|
<>
|
||||||
</View>
|
<Sec title="Priorities" count={r.meta.current_priorities.length} />
|
||||||
|
{r.meta.current_priorities.map((p, i) => (
|
||||||
|
<PriorityCard key={p.title} p={p} rank={i + 1} />
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
<Text style={{ fontSize: 11, color: C.dim, marginTop: 32 }}>
|
||||||
|
Personal health data · served from rehbock.xyz over HTTPS · nothing cached on device
|
||||||
|
</Text>
|
||||||
|
</Screen>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const s = StyleSheet.create({
|
|
||||||
top: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginBottom: 14, paddingLeft: 4 },
|
|
||||||
date: { fontFamily: F.semibold, fontSize: 15, color: C.muted },
|
|
||||||
headline: { fontFamily: F.heavy, fontSize: 32, lineHeight: 37, letterSpacing: -0.7, color: C.text, marginBottom: 10 },
|
|
||||||
line: { fontFamily: F.regular, fontSize: 16.5, lineHeight: 24, color: C.muted, marginBottom: 2 },
|
|
||||||
cta: {
|
|
||||||
marginTop: 16, height: 54, borderRadius: 16, backgroundColor: C.accent,
|
|
||||||
alignItems: 'center', justifyContent: 'center',
|
|
||||||
},
|
|
||||||
ctaT: { fontFamily: F.bold, fontSize: 17, color: C.onAccent },
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -1,146 +0,0 @@
|
|||||||
import { Link } from 'expo-router';
|
|
||||||
import React from 'react';
|
|
||||||
import { Text, View } from 'react-native';
|
|
||||||
import { NavCard, PriorityCard, Screen, Sec } from '../components/ui';
|
|
||||||
import { useAuth } from '../lib/api';
|
|
||||||
import { agoTxt, fmtD, fmtDY, hm, num, cap } from '../lib/format';
|
|
||||||
import { shapeBiomarkers, shapeSleep, weekStart, workoutVolume } from '../lib/shape';
|
|
||||||
import { C } from '../lib/theme';
|
|
||||||
import type {
|
|
||||||
BiomarkersResponse, DexaResponse, HealthMeta, MeditationStats, SleepApiResponse,
|
|
||||||
SleepCycleExport, WorkoutsResponse,
|
|
||||||
} from '../lib/types';
|
|
||||||
import { loadAll, useLoad } from '../lib/use-load';
|
|
||||||
|
|
||||||
export default function Systems() {
|
|
||||||
const { hasToken } = useAuth();
|
|
||||||
const { data, loading, refresh } = useLoad(() =>
|
|
||||||
loadAll({
|
|
||||||
meta: 'meta', bio: 'biomarkers', wo: 'workouts', sApi: 'sleepApi',
|
|
||||||
sc: 'sleepCycle', dexa: 'dexa', med: 'medStats', fitbit: 'fitbitSummary',
|
|
||||||
} as const),
|
|
||||||
);
|
|
||||||
|
|
||||||
const r = data as
|
|
||||||
| {
|
|
||||||
meta: HealthMeta | null;
|
|
||||||
bio: BiomarkersResponse | null;
|
|
||||||
wo: WorkoutsResponse | null;
|
|
||||||
sApi: SleepApiResponse | null;
|
|
||||||
sc: SleepCycleExport | null;
|
|
||||||
dexa: DexaResponse | null;
|
|
||||||
med: MeditationStats | null;
|
|
||||||
fitbit: {
|
|
||||||
steps: { day: string; value: number }[];
|
|
||||||
resting_hr: { day: string; avg: number }[];
|
|
||||||
hrv: { day: string; avg: number }[];
|
|
||||||
} | null;
|
|
||||||
}
|
|
||||||
| undefined;
|
|
||||||
|
|
||||||
const cards: React.ReactNode[] = [];
|
|
||||||
if (r) {
|
|
||||||
if (r.sApi && r.sc) {
|
|
||||||
const nights = shapeSleep(r.sApi, r.sc);
|
|
||||||
const last = nights[nights.length - 1];
|
|
||||||
cards.push(
|
|
||||||
<NavCard key="sleep" title="Sleep" big={hm(last.asleep)} href="/sleep"
|
|
||||||
note={`Last night on record — ${fmtD(last.date)} (${last.src})`} />,
|
|
||||||
);
|
|
||||||
} else cards.push(<NavCard key="sleep" title="Sleep" big="—" note="Couldn’t load" href="/sleep" />);
|
|
||||||
|
|
||||||
if (r.wo) {
|
|
||||||
const ws = [...r.wo.workouts].sort((a, b) => (a.start_time < b.start_time ? -1 : 1));
|
|
||||||
const last = ws[ws.length - 1];
|
|
||||||
const { vol } = workoutVolume(last);
|
|
||||||
const wkCount = ws.filter(
|
|
||||||
(w) => weekStart(w.start_time) === weekStart(new Date().toISOString()),
|
|
||||||
).length;
|
|
||||||
cards.push(
|
|
||||||
<NavCard key="train" title="Training" big={last.title} href="/train"
|
|
||||||
note={`${agoTxt(last.start_time)} · ${num(Math.round(vol))} kg · ${wkCount} this week`} />,
|
|
||||||
);
|
|
||||||
} else cards.push(<NavCard key="train" title="Training" big="—" note="Couldn’t load" href="/train" />);
|
|
||||||
|
|
||||||
if (r.bio) {
|
|
||||||
const marks = shapeBiomarkers(r.bio);
|
|
||||||
const latestDraw = r.bio.biomarkers.reduce((m, b) => (b.collected > m ? b.collected : m), '');
|
|
||||||
const flagged = marks.filter((m) => m.latest.flagged && m.latest.collected === latestDraw);
|
|
||||||
cards.push(
|
|
||||||
<NavCard key="blood" title="Blood" big={String(marks.length)} unit="markers" href="/blood"
|
|
||||||
flagline={
|
|
||||||
flagged.length
|
|
||||||
? `${flagged.length} flagged: ${flagged.slice(0, 3).map((f) => cap(f.name)).join(', ')}${flagged.length > 3 ? '…' : ''}`
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
okline={flagged.length ? undefined : 'All markers in range'}
|
|
||||||
note={`Latest draw ${fmtDY(latestDraw)}`} />,
|
|
||||||
);
|
|
||||||
} else cards.push(<NavCard key="blood" title="Blood" big="—" note="Couldn’t load" href="/blood" />);
|
|
||||||
|
|
||||||
if (r.dexa) {
|
|
||||||
const scan = r.dexa.scans[r.dexa.scans.length - 1];
|
|
||||||
cards.push(
|
|
||||||
<NavCard key="body" title="Body" big={`${scan.summary.total_body_fat_pct}`} unit="% fat"
|
|
||||||
href="/body"
|
|
||||||
note={`${scan.summary.total_lean_mass_kg} kg lean · DXA ${fmtD(scan.scan_date)}`} />,
|
|
||||||
);
|
|
||||||
} else cards.push(<NavCard key="body" title="Body" big="—" note="Couldn’t load" href="/body" />);
|
|
||||||
|
|
||||||
if (r.med) {
|
|
||||||
cards.push(
|
|
||||||
<NavCard key="mind" title="Mind" big={String(r.med.totalMinutes)} unit="min" href="/mind"
|
|
||||||
note={`${r.med.totalSessions} sessions · streak ${r.med.currentStreak}`} />,
|
|
||||||
);
|
|
||||||
} else cards.push(<NavCard key="mind" title="Mind" big="—" note="Couldn’t load" href="/mind" />);
|
|
||||||
|
|
||||||
{
|
|
||||||
const fb = r.fitbit;
|
|
||||||
const steps = fb?.steps?.length ? fb.steps[fb.steps.length - 1] : null;
|
|
||||||
const hrv = fb?.hrv?.length ? fb.hrv[fb.hrv.length - 1] : null;
|
|
||||||
cards.push(
|
|
||||||
<NavCard key="fitbit" title="Fitbit" href="/fitbit"
|
|
||||||
big={steps ? num(Math.round(steps.value)) : '—'} unit={steps ? 'steps' : undefined}
|
|
||||||
note={
|
|
||||||
steps
|
|
||||||
? `${fmtD(steps.day)}${hrv ? ` · HRV ${Math.round(hrv.avg)} ms` : ''}`
|
|
||||||
: 'Open to sync from Health Connect'
|
|
||||||
} />,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
cards.push(
|
|
||||||
<NavCard key="dna" title="DNA" big="99" unit="traits" href="/dna"
|
|
||||||
note="AncestryDNA trait report" />,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Screen onRefresh={refresh}>
|
|
||||||
{!hasToken ? (
|
|
||||||
<Link href="/settings" style={{ padding: 24, textAlign: 'center', color: C.accent, fontSize: 15 }}>
|
|
||||||
Add your API token in Settings to load your data →
|
|
||||||
</Link>
|
|
||||||
) : loading && !r ? (
|
|
||||||
<Text style={{ color: C.muted, fontSize: 13, textAlign: 'center', padding: 24 }}>
|
|
||||||
Loading…
|
|
||||||
</Text>
|
|
||||||
) : (
|
|
||||||
<View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 10 }}>{cards}</View>
|
|
||||||
)}
|
|
||||||
{r?.meta?.current_priorities?.length ? (
|
|
||||||
<>
|
|
||||||
<Sec title="Priorities" count={r.meta.current_priorities.length} />
|
|
||||||
{r.meta.current_priorities.map((p, i) => (
|
|
||||||
<PriorityCard key={p.title} p={p} rank={i + 1} />
|
|
||||||
))}
|
|
||||||
</>
|
|
||||||
) : null}
|
|
||||||
<Text style={{ fontSize: 11, color: C.dim, marginTop: 32 }}>
|
|
||||||
Personal health data · served from rehbock.xyz over HTTPS · nothing cached on device
|
|
||||||
</Text>
|
|
||||||
</Screen>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,328 +0,0 @@
|
|||||||
/* Jarvis component kit: the pieces the Today screen is built from.
|
|
||||||
Plain React Native on the tokens in lib/theme, so every surface is ours to shape. */
|
|
||||||
import { router } from 'expo-router';
|
|
||||||
import React from 'react';
|
|
||||||
import { Pressable, StyleSheet, Text, View, ViewStyle } from 'react-native';
|
|
||||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
||||||
import type { CellState, GoalRow, Habit, StreakRow, TodayItem } from '../lib/life';
|
|
||||||
import { C, F, R, SYS } from '../lib/theme';
|
|
||||||
|
|
||||||
/* ---- surfaces ---- */
|
|
||||||
|
|
||||||
export function Card({ children, style }: { children: React.ReactNode; style?: ViewStyle }) {
|
|
||||||
return <View style={[s.card, style]}>{children}</View>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Section heading with an optional action on the right. */
|
|
||||||
export function Heading({
|
|
||||||
title, action, onAction, meta,
|
|
||||||
}: {
|
|
||||||
title: string;
|
|
||||||
action?: string;
|
|
||||||
onAction?: () => void;
|
|
||||||
meta?: string;
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<View style={s.heading}>
|
|
||||||
<Text style={s.headingT}>{title}</Text>
|
|
||||||
{action ? (
|
|
||||||
<Pressable onPress={onAction} hitSlop={10} accessibilityRole="button">
|
|
||||||
<Text style={s.headingA}>{action}</Text>
|
|
||||||
</Pressable>
|
|
||||||
) : meta ? (
|
|
||||||
<Text style={s.headingM}>{meta}</Text>
|
|
||||||
) : null}
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Round icon button, as on a map screen. */
|
|
||||||
export function RoundButton({
|
|
||||||
glyph, onPress, label,
|
|
||||||
}: {
|
|
||||||
glyph: string;
|
|
||||||
onPress: () => void;
|
|
||||||
label: string;
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<Pressable
|
|
||||||
onPress={onPress} hitSlop={8} accessibilityRole="button" accessibilityLabel={label}
|
|
||||||
style={({ pressed }) => [s.round, pressed && { opacity: 0.7 }]}>
|
|
||||||
<Text style={s.roundT}>{glyph}</Text>
|
|
||||||
</Pressable>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---- today's protocol ---- */
|
|
||||||
|
|
||||||
/** One rule. Manual rules toggle on tap and turn green when done; auto rules show their state. */
|
|
||||||
export function CheckRow({
|
|
||||||
item, onToggle, last,
|
|
||||||
}: {
|
|
||||||
item: TodayItem;
|
|
||||||
onToggle?: (done: boolean | null) => void;
|
|
||||||
last?: boolean;
|
|
||||||
}) {
|
|
||||||
const done = item.status === 'met';
|
|
||||||
const missed = item.status === 'missed';
|
|
||||||
const tappable = !item.auto && !item.week && !!onToggle;
|
|
||||||
|
|
||||||
let sub: string | null = null;
|
|
||||||
if (item.week) sub = `${item.week.count} of ${item.week.need} this week`;
|
|
||||||
else if (item.auto) {
|
|
||||||
sub = done ? 'Met, from your trackers'
|
|
||||||
: missed ? 'Missed, from your trackers'
|
|
||||||
: item.status === 'nodata' ? 'No tracker data yet'
|
|
||||||
: 'Ticks itself from your trackers';
|
|
||||||
}
|
|
||||||
|
|
||||||
const body = (
|
|
||||||
<View style={[s.row, done && s.rowDone, !last && s.rowLine]}>
|
|
||||||
<View style={[s.box, done && s.boxDone, missed && s.boxMiss]}>
|
|
||||||
{done ? <Text style={s.boxTick}>✓</Text> : missed ? <Text style={s.boxX}>✕</Text> : null}
|
|
||||||
</View>
|
|
||||||
<View style={{ flex: 1 }}>
|
|
||||||
<Text style={[s.rowT, done && { color: C.text }]}>{item.label}</Text>
|
|
||||||
{sub ? <Text style={s.rowSub}>{sub}</Text> : null}
|
|
||||||
</View>
|
|
||||||
{item.auto ? <Text style={s.auto}>auto</Text> : null}
|
|
||||||
<View style={[s.sysDot, { backgroundColor: SYS[item.system] ?? C.dim }]} />
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!tappable) return body;
|
|
||||||
return (
|
|
||||||
<Pressable
|
|
||||||
onPress={() => onToggle!(done ? null : true)}
|
|
||||||
accessibilityRole="checkbox" accessibilityState={{ checked: done }}
|
|
||||||
style={({ pressed }) => pressed && { opacity: 0.6 }}>
|
|
||||||
{body}
|
|
||||||
</Pressable>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---- 14-day streak grid ---- */
|
|
||||||
|
|
||||||
function Cell({ state, color, today }: { state: CellState; color: string; today: boolean }) {
|
|
||||||
const bg =
|
|
||||||
state === 'met' ? color
|
|
||||||
: state === 'part' ? color + '66' // 40% of the system colour
|
|
||||||
: state === 'miss' ? C.border
|
|
||||||
: 'transparent';
|
|
||||||
return (
|
|
||||||
<View
|
|
||||||
style={[
|
|
||||||
s.cell,
|
|
||||||
{ backgroundColor: bg },
|
|
||||||
state === 'none' && { borderWidth: 1, borderColor: C.border },
|
|
||||||
today && { borderWidth: 1.5, borderColor: C.text },
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function StreakGrid({
|
|
||||||
rows, onRow,
|
|
||||||
}: {
|
|
||||||
rows: StreakRow[];
|
|
||||||
/** omit for rows that lead nowhere */
|
|
||||||
onRow?: (key: string) => void;
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<View>
|
|
||||||
{rows.map((r) => {
|
|
||||||
const color = SYS[r.color ?? r.key] ?? C.accent;
|
|
||||||
const inner = (
|
|
||||||
<>
|
|
||||||
<Text style={s.streakName} numberOfLines={1}>{r.label}</Text>
|
|
||||||
<View style={s.cells}>
|
|
||||||
{r.cells.map((c, i) => (
|
|
||||||
<Cell key={i} state={c} color={color} today={i === r.cells.length - 1} />
|
|
||||||
))}
|
|
||||||
</View>
|
|
||||||
<Text style={s.streakPct}>{r.pct == null ? '' : `${r.pct}%`}</Text>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
return onRow ? (
|
|
||||||
<Pressable
|
|
||||||
key={r.key} onPress={() => onRow(r.key)} accessibilityRole="button"
|
|
||||||
accessibilityLabel={`${r.label}, ${r.pct == null ? 'no data' : r.pct + ' percent'}`}
|
|
||||||
style={({ pressed }) => [s.streakRow, pressed && { opacity: 0.6 }]}>
|
|
||||||
{inner}
|
|
||||||
</Pressable>
|
|
||||||
) : (
|
|
||||||
<View key={r.key} style={s.streakRow}>{inner}</View>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
<View style={s.axis}>
|
|
||||||
<Text style={s.axisT}>14 days ago</Text>
|
|
||||||
<Text style={s.axisT}>today</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---- the daily six: one big square per habit, tap to mark it done ---- */
|
|
||||||
|
|
||||||
export function HabitCard({ habit, onToggle }: { habit: Habit; onToggle: (done: boolean | null) => void }) {
|
|
||||||
const color = SYS[habit.system] ?? C.accent;
|
|
||||||
return (
|
|
||||||
<Pressable
|
|
||||||
onPress={() => onToggle(habit.done ? null : true)}
|
|
||||||
accessibilityRole="checkbox" accessibilityState={{ checked: habit.done }}
|
|
||||||
accessibilityLabel={habit.label}
|
|
||||||
style={({ pressed }) => [
|
|
||||||
s.habit,
|
|
||||||
habit.done && { backgroundColor: color },
|
|
||||||
pressed && { transform: [{ scale: 0.97 }] },
|
|
||||||
]}>
|
|
||||||
<View style={[s.habitRing, { borderColor: habit.done ? '#FFFFFF' : color }, habit.done && { backgroundColor: '#FFFFFF' }]}>
|
|
||||||
{habit.done ? <Text style={[s.habitTick, { color }]}>✓</Text> : null}
|
|
||||||
</View>
|
|
||||||
<View>
|
|
||||||
<Text style={[s.habitT, habit.done && { color: '#FFFFFF' }]}>{habit.label}</Text>
|
|
||||||
<Text style={[s.habitS, habit.done && { color: 'rgba(255,255,255,0.85)' }]}>
|
|
||||||
{habit.done ? 'Done today' : 'Tap when done'}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
</Pressable>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function HabitGrid({ children }: { children: React.ReactNode }) {
|
|
||||||
return <View style={s.habits}>{children}</View>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---- goals ---- */
|
|
||||||
|
|
||||||
export function GoalBar({ goal }: { goal: GoalRow }) {
|
|
||||||
const color = SYS[goal.system] ?? C.accent;
|
|
||||||
return (
|
|
||||||
<View style={s.goal}>
|
|
||||||
<View style={s.goalHead}>
|
|
||||||
<Text style={s.goalT} numberOfLines={1}>{goal.title}</Text>
|
|
||||||
<Text style={s.goalV}>{goal.value}</Text>
|
|
||||||
</View>
|
|
||||||
<View style={s.track}>
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
width: `${Math.round((goal.progress ?? 0) * 100)}%`, height: '100%',
|
|
||||||
borderRadius: 3, backgroundColor: color,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---- chat bar, pinned to the bottom of a screen ---- */
|
|
||||||
|
|
||||||
export const CHAT_BAR_SPACE = 92;
|
|
||||||
|
|
||||||
export function ChatBar() {
|
|
||||||
const insets = useSafeAreaInsets();
|
|
||||||
return (
|
|
||||||
<View pointerEvents="box-none" style={[s.chatWrap, { paddingBottom: Math.max(insets.bottom, 12) }]}>
|
|
||||||
<Pressable
|
|
||||||
onPress={() => router.push('/chat')} accessibilityRole="button"
|
|
||||||
accessibilityLabel="Ask or log anything"
|
|
||||||
style={({ pressed }) => [s.chat, pressed && { opacity: 0.85 }]}>
|
|
||||||
<Text style={s.chatT}>Ask or log anything</Text>
|
|
||||||
<View style={s.mic}>
|
|
||||||
<View style={s.micBody} />
|
|
||||||
<View style={s.micStem} />
|
|
||||||
</View>
|
|
||||||
</Pressable>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const s = StyleSheet.create({
|
|
||||||
card: {
|
|
||||||
backgroundColor: C.surface, borderRadius: R.card, borderCurve: 'continuous',
|
|
||||||
overflow: 'hidden',
|
|
||||||
},
|
|
||||||
|
|
||||||
heading: {
|
|
||||||
flexDirection: 'row', justifyContent: 'space-between', alignItems: 'baseline',
|
|
||||||
marginTop: 26, marginBottom: 10, paddingHorizontal: 4,
|
|
||||||
},
|
|
||||||
headingT: { fontFamily: F.bold, fontSize: 19, color: C.text, letterSpacing: -0.2 },
|
|
||||||
headingA: { fontFamily: F.semibold, fontSize: 15, color: C.accent },
|
|
||||||
headingM: { fontFamily: F.medium, fontSize: 14, color: C.muted },
|
|
||||||
|
|
||||||
round: {
|
|
||||||
width: 44, height: 44, borderRadius: 22, backgroundColor: C.surface,
|
|
||||||
alignItems: 'center', justifyContent: 'center',
|
|
||||||
shadowColor: '#0C1730', shadowOpacity: 0.08, shadowRadius: 8, shadowOffset: { width: 0, height: 2 },
|
|
||||||
elevation: 2,
|
|
||||||
},
|
|
||||||
roundT: { fontSize: 19, color: C.text },
|
|
||||||
|
|
||||||
row: { flexDirection: 'row', alignItems: 'center', gap: 13, paddingVertical: 13, paddingHorizontal: 16 },
|
|
||||||
rowDone: { backgroundColor: C.greenDim },
|
|
||||||
rowLine: { borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: C.border },
|
|
||||||
rowT: { fontFamily: F.semibold, fontSize: 16, color: C.text },
|
|
||||||
rowSub: { fontFamily: F.regular, fontSize: 13, color: C.muted, marginTop: 2 },
|
|
||||||
box: {
|
|
||||||
width: 28, height: 28, borderRadius: 9, borderCurve: 'continuous',
|
|
||||||
backgroundColor: C.surface2, alignItems: 'center', justifyContent: 'center',
|
|
||||||
},
|
|
||||||
boxDone: { backgroundColor: C.green },
|
|
||||||
boxMiss: { backgroundColor: C.redDim },
|
|
||||||
boxTick: { color: '#FFFFFF', fontSize: 16, fontFamily: F.heavy, lineHeight: 19 },
|
|
||||||
boxX: { color: C.red, fontSize: 13, fontFamily: F.bold, lineHeight: 16 },
|
|
||||||
auto: {
|
|
||||||
fontFamily: F.medium, fontSize: 12, color: C.muted, backgroundColor: C.surface2,
|
|
||||||
paddingHorizontal: 9, paddingVertical: 3, borderRadius: R.pill, overflow: 'hidden',
|
|
||||||
},
|
|
||||||
sysDot: { width: 8, height: 8, borderRadius: 4 },
|
|
||||||
|
|
||||||
streakRow: { flexDirection: 'row', alignItems: 'center', paddingVertical: 7, paddingHorizontal: 16 },
|
|
||||||
streakName: { width: 74, fontFamily: F.semibold, fontSize: 15, color: C.text },
|
|
||||||
cells: { flex: 1, flexDirection: 'row', gap: 4 },
|
|
||||||
cell: { flex: 1, aspectRatio: 1, borderRadius: 5, borderCurve: 'continuous' },
|
|
||||||
streakPct: {
|
|
||||||
width: 44, textAlign: 'right', fontFamily: F.medium, fontSize: 13, color: C.muted,
|
|
||||||
fontVariant: ['tabular-nums'],
|
|
||||||
},
|
|
||||||
axis: {
|
|
||||||
flexDirection: 'row', justifyContent: 'space-between',
|
|
||||||
marginLeft: 90, marginRight: 60, marginTop: 4,
|
|
||||||
},
|
|
||||||
axisT: { fontFamily: F.regular, fontSize: 11.5, color: C.dim },
|
|
||||||
|
|
||||||
habits: { flexDirection: 'row', flexWrap: 'wrap', gap: 12 },
|
|
||||||
habit: {
|
|
||||||
width: '48.2%', aspectRatio: 1, borderRadius: R.card, borderCurve: 'continuous',
|
|
||||||
backgroundColor: C.surface, padding: 16, justifyContent: 'space-between',
|
|
||||||
},
|
|
||||||
habitRing: {
|
|
||||||
width: 40, height: 40, borderRadius: 20, borderWidth: 3,
|
|
||||||
alignItems: 'center', justifyContent: 'center',
|
|
||||||
},
|
|
||||||
habitTick: { fontFamily: F.heavy, fontSize: 21, lineHeight: 25 },
|
|
||||||
habitT: { fontFamily: F.bold, fontSize: 19, lineHeight: 23, letterSpacing: -0.2, color: C.text },
|
|
||||||
habitS: { fontFamily: F.medium, fontSize: 13.5, color: C.muted, marginTop: 5 },
|
|
||||||
|
|
||||||
goal: { paddingVertical: 11, paddingHorizontal: 16 },
|
|
||||||
goalHead: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'baseline', gap: 12, marginBottom: 8 },
|
|
||||||
goalT: { flex: 1, fontFamily: F.semibold, fontSize: 15.5, color: C.text },
|
|
||||||
goalV: { fontFamily: F.medium, fontSize: 13.5, color: C.muted, fontVariant: ['tabular-nums'] },
|
|
||||||
track: { height: 6, borderRadius: 3, backgroundColor: C.surface2, overflow: 'hidden' },
|
|
||||||
|
|
||||||
chatWrap: { position: 'absolute', left: 0, right: 0, bottom: 0, paddingHorizontal: 14, paddingTop: 10 },
|
|
||||||
chat: {
|
|
||||||
height: 58, borderRadius: 29, backgroundColor: C.surface, paddingLeft: 22, paddingRight: 9,
|
|
||||||
flexDirection: 'row', alignItems: 'center',
|
|
||||||
shadowColor: '#0C1730', shadowOpacity: 0.16, shadowRadius: 18, shadowOffset: { width: 0, height: 6 },
|
|
||||||
elevation: 8,
|
|
||||||
},
|
|
||||||
chatT: { flex: 1, fontFamily: F.medium, fontSize: 16.5, color: C.muted },
|
|
||||||
mic: {
|
|
||||||
width: 42, height: 42, borderRadius: 21, backgroundColor: C.accent,
|
|
||||||
alignItems: 'center', justifyContent: 'center',
|
|
||||||
},
|
|
||||||
micBody: { width: 9, height: 15, borderRadius: 5, backgroundColor: C.onAccent },
|
|
||||||
micStem: { width: 2, height: 4, backgroundColor: C.onAccent, marginTop: 2, borderRadius: 1 },
|
|
||||||
});
|
|
||||||
@@ -16,8 +16,6 @@ export const EP = {
|
|||||||
traits: `${BASE}/ancestry-traits.json`,
|
traits: `${BASE}/ancestry-traits.json`,
|
||||||
fitbitSummary: `${BASE}/api/health/v1/fitbit/summary?days=30`,
|
fitbitSummary: `${BASE}/api/health/v1/fitbit/summary?days=30`,
|
||||||
fitbitLatest: `${BASE}/api/health/v1/fitbit/latest`,
|
fitbitLatest: `${BASE}/api/health/v1/fitbit/latest`,
|
||||||
lifeAdherence: `${BASE}/api/health/v1/life/adherence?days=14`,
|
|
||||||
lifeGoals: `${BASE}/api/health/v1/life/goals`,
|
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const FITBIT_SYNC_URL = `${BASE}/api/health/v1/fitbit/sync`;
|
export const FITBIT_SYNC_URL = `${BASE}/api/health/v1/fitbit/sync`;
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
/* The Today brief, written from data already on the screen.
|
|
||||||
A later version will come from the chat model; this one only states facts. */
|
|
||||||
import { agoTxt, daysAgo, fmtD } from './format';
|
|
||||||
import type { AdherenceResponse, GoalsResponse } from './life';
|
|
||||||
|
|
||||||
export interface Brief {
|
|
||||||
headline: string;
|
|
||||||
lines: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BriefInput {
|
|
||||||
/** most recent recorded night */
|
|
||||||
sleep?: { date: string; asleepSec: number } | null;
|
|
||||||
/** most recent workout */
|
|
||||||
workout?: { title: string; start: string } | null;
|
|
||||||
adherence?: AdherenceResponse | null;
|
|
||||||
goals?: GoalsResponse | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const hmText = (sec: number) => {
|
|
||||||
const h = Math.floor(sec / 3600);
|
|
||||||
const m = Math.round((sec % 3600) / 60);
|
|
||||||
return `${h} h ${String(m).padStart(2, '0')}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
function greeting(): string {
|
|
||||||
const h = new Date().getHours();
|
|
||||||
return h < 12 ? 'Good morning' : h < 18 ? 'Good afternoon' : 'Good evening';
|
|
||||||
}
|
|
||||||
|
|
||||||
export function buildBrief(i: BriefInput): Brief {
|
|
||||||
const lines: string[] = [];
|
|
||||||
let headline = greeting();
|
|
||||||
|
|
||||||
// sleep: only talk about last night if the tracker actually reported it
|
|
||||||
if (i.sleep) {
|
|
||||||
const age = daysAgo(i.sleep.date);
|
|
||||||
if (age <= 1) {
|
|
||||||
headline = `You slept ${hmText(i.sleep.asleepSec)}`;
|
|
||||||
const sleepRule = i.adherence?.protocols
|
|
||||||
.find((p) => p.system === 'sleep')?.rules.find((r) => r.metric === 'sleep.hours');
|
|
||||||
const target = typeof sleepRule?.value === 'number' ? sleepRule.value * 3600 : null;
|
|
||||||
if (target != null) {
|
|
||||||
const diff = Math.round((i.sleep.asleepSec - target) / 60);
|
|
||||||
lines.push(diff >= 0
|
|
||||||
? `That is ${diff} minutes over your ${sleepRule!.value} hour protocol.`
|
|
||||||
: `That is ${-diff} minutes short of your ${sleepRule!.value} hour protocol.`);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lines.push(`No sleep data since ${fmtD(i.sleep.date)}. Eight Sleep has stopped syncing.`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// training: last session and this week's count against the weekly rule
|
|
||||||
if (i.workout) {
|
|
||||||
const train = i.adherence?.protocols.find((p) => p.system === 'train');
|
|
||||||
const weekly = train?.rules.find((r) => r.period === 'week' && r.metric === 'train.workouts');
|
|
||||||
const weeks = train ? Object.keys(train.weeks).sort() : [];
|
|
||||||
const cur = weekly && weeks.length ? train!.weeks[weeks[weeks.length - 1]]?.[weekly.id] : null;
|
|
||||||
const last = `Your last lift was ${i.workout.title}, ${agoTxt(i.workout.start)}.`;
|
|
||||||
lines.push(cur ? `${last} ${cur.count} of ${cur.need} sessions this week.` : last);
|
|
||||||
}
|
|
||||||
|
|
||||||
// mind: minutes this week against the goal
|
|
||||||
const med = i.goals?.goals.find((g) => g.metric === 'mind.minutes_7d');
|
|
||||||
if (med && med.current != null) {
|
|
||||||
lines.push(`Meditation is at ${Math.round(med.current)} of ${med.target} minutes this week.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!lines.length) lines.push('Pull down to refresh once your trackers have synced.');
|
|
||||||
return { headline, lines };
|
|
||||||
}
|
|
||||||
275
src/lib/life.ts
275
src/lib/life.ts
@@ -1,275 +0,0 @@
|
|||||||
/* Life systems: protocols, check-ins, streaks and goals.
|
|
||||||
Types mirror health-api `life.ts` (GET /v1/life/adherence, /v1/life/goals). */
|
|
||||||
import { EP, invalidate, postJson } from './api';
|
|
||||||
|
|
||||||
export type RuleStatus = 'met' | 'missed' | 'unlogged' | 'nodata' | 'pending';
|
|
||||||
|
|
||||||
export interface LifeRule {
|
|
||||||
id: string;
|
|
||||||
label: string;
|
|
||||||
/** present = evaluated automatically from tracker data; absent = manual check-in */
|
|
||||||
metric?: string;
|
|
||||||
op?: '>=' | '<=' | '>' | '<' | '==';
|
|
||||||
value?: number | string;
|
|
||||||
period?: 'day' | 'week';
|
|
||||||
count?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface LifeProtocol {
|
|
||||||
id: string;
|
|
||||||
key: string;
|
|
||||||
system: string;
|
|
||||||
name: string;
|
|
||||||
version: number;
|
|
||||||
started_on: string;
|
|
||||||
ended_on: string | null;
|
|
||||||
notes?: string | null;
|
|
||||||
rules: LifeRule[];
|
|
||||||
pct: number | null;
|
|
||||||
streak: number;
|
|
||||||
daily: Record<string, {
|
|
||||||
pct: number | null;
|
|
||||||
rules: Record<string, { status: RuleStatus; value: number | boolean | null }>;
|
|
||||||
}>;
|
|
||||||
weeks: Record<string, Record<string, { status: RuleStatus; count: number; need: number }>>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AdherenceResponse {
|
|
||||||
tz: string;
|
|
||||||
today: string;
|
|
||||||
from: string;
|
|
||||||
days: string[];
|
|
||||||
overall: { pct: number | null; today: number | null };
|
|
||||||
systems: Record<string, number | null>;
|
|
||||||
protocols: LifeProtocol[];
|
|
||||||
metrics: Record<string, Record<string, number>>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface LifeGoal {
|
|
||||||
id: string;
|
|
||||||
system: string;
|
|
||||||
title: string;
|
|
||||||
metric: string | null;
|
|
||||||
unit: string | null;
|
|
||||||
baseline: number | null;
|
|
||||||
target: number;
|
|
||||||
current_manual: number | null;
|
|
||||||
current: number | null;
|
|
||||||
/** 0–1, or null when there is nothing to measure yet */
|
|
||||||
progress: number | null;
|
|
||||||
deadline: string | null;
|
|
||||||
achieved_at: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GoalsResponse {
|
|
||||||
goals: LifeGoal[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---- systems ---- */
|
|
||||||
|
|
||||||
export type SystemKey = 'sleep' | 'train' | 'diet' | 'mind' | 'wealth' | 'relate';
|
|
||||||
|
|
||||||
export const SYSTEMS: { key: SystemKey; label: string }[] = [
|
|
||||||
{ key: 'sleep', label: 'Sleep' },
|
|
||||||
{ key: 'train', label: 'Train' },
|
|
||||||
{ key: 'diet', label: 'Diet' },
|
|
||||||
{ key: 'mind', label: 'Mind' },
|
|
||||||
{ key: 'wealth', label: 'Wealth' },
|
|
||||||
{ key: 'relate', label: 'People' },
|
|
||||||
];
|
|
||||||
|
|
||||||
const systemOrder = (s: string) => {
|
|
||||||
const i = SYSTEMS.findIndex((x) => x.key === s);
|
|
||||||
return i < 0 ? SYSTEMS.length : i;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* ---- today's protocol ---- */
|
|
||||||
|
|
||||||
export interface TodayItem {
|
|
||||||
protocolId: string;
|
|
||||||
ruleId: string;
|
|
||||||
system: string;
|
|
||||||
label: string;
|
|
||||||
/** ticks itself from tracker data; cannot be tapped */
|
|
||||||
auto: boolean;
|
|
||||||
status: RuleStatus;
|
|
||||||
/** weekly rules: progress through the week, e.g. 2 of 4 */
|
|
||||||
week?: { count: number; need: number };
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Monday of the week containing `day` (YYYY-MM-DD), matching the server's weekOf(). */
|
|
||||||
function weekOf(day: string): string {
|
|
||||||
const [y, m, d] = day.split('-').map(Number);
|
|
||||||
const dt = new Date(Date.UTC(y, m - 1, d));
|
|
||||||
const dow = (dt.getUTCDay() + 6) % 7;
|
|
||||||
dt.setUTCDate(dt.getUTCDate() - dow);
|
|
||||||
return dt.toISOString().slice(0, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function todayItems(a: AdherenceResponse): TodayItem[] {
|
|
||||||
const out: TodayItem[] = [];
|
|
||||||
const wk = weekOf(a.today);
|
|
||||||
for (const p of a.protocols) {
|
|
||||||
const day = p.daily[a.today];
|
|
||||||
for (const r of p.rules) {
|
|
||||||
if (r.period === 'week') {
|
|
||||||
const w = p.weeks[wk]?.[r.id];
|
|
||||||
if (!w) continue;
|
|
||||||
out.push({
|
|
||||||
protocolId: p.id, ruleId: r.id, system: p.system, label: r.label,
|
|
||||||
auto: !!r.metric, status: w.status, week: { count: w.count, need: w.need },
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
const e = day?.rules[r.id];
|
|
||||||
if (!e) continue;
|
|
||||||
out.push({
|
|
||||||
protocolId: p.id, ruleId: r.id, system: p.system, label: r.label,
|
|
||||||
auto: !!r.metric, status: e.status,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out.sort((x, y) => systemOrder(x.system) - systemOrder(y.system));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Tick or untick a manual rule for a day. `done: null` clears the check-in. */
|
|
||||||
export async function setCheckin(
|
|
||||||
item: Pick<TodayItem, 'protocolId' | 'ruleId'>, day: string, done: boolean | null,
|
|
||||||
): Promise<void> {
|
|
||||||
await postJson(EP_CHECKINS, { protocol_id: item.protocolId, rule_id: item.ruleId, day, done });
|
|
||||||
invalidate('lifeAdherence');
|
|
||||||
}
|
|
||||||
|
|
||||||
const EP_CHECKINS = EP.lifeAdherence.replace(/\/adherence.*$/, '/checkins');
|
|
||||||
|
|
||||||
/* ---- 14-day streak grid ---- */
|
|
||||||
|
|
||||||
/** met = every evaluated rule met; part = some met; miss = none met; none = nothing to evaluate */
|
|
||||||
export type CellState = 'met' | 'part' | 'miss' | 'none';
|
|
||||||
|
|
||||||
export interface StreakRow {
|
|
||||||
key: string;
|
|
||||||
label: string;
|
|
||||||
/** cell colour; defaults to the system colour for `key` */
|
|
||||||
color?: string;
|
|
||||||
cells: CellState[];
|
|
||||||
/** share of evaluated rules met over the window, 0–100, or null with no data */
|
|
||||||
pct: number | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function streakRows(a: AdherenceResponse): StreakRow[] {
|
|
||||||
return SYSTEMS.map(({ key, label }) => {
|
|
||||||
const protos = a.protocols.filter((p) => p.system === key);
|
|
||||||
const cells = a.days.map<CellState>((day) => {
|
|
||||||
let met = 0, missed = 0;
|
|
||||||
for (const p of protos) {
|
|
||||||
const rules = p.daily[day]?.rules;
|
|
||||||
if (!rules) continue;
|
|
||||||
for (const id in rules) {
|
|
||||||
if (rules[id].status === 'met') met++;
|
|
||||||
else if (rules[id].status === 'missed') missed++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (met + missed === 0) return 'none';
|
|
||||||
if (missed === 0) return 'met';
|
|
||||||
return met > 0 ? 'part' : 'miss';
|
|
||||||
});
|
|
||||||
const hasData = cells.some((c) => c !== 'none');
|
|
||||||
return { key, label, cells, pct: hasData ? (a.systems[key] ?? null) : null };
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---- goals ---- */
|
|
||||||
|
|
||||||
export interface GoalRow {
|
|
||||||
id: string;
|
|
||||||
system: string;
|
|
||||||
title: string;
|
|
||||||
/** 0–1 for the bar; null draws an empty bar */
|
|
||||||
progress: number | null;
|
|
||||||
/** right-hand value, e.g. "707k of 1.6M" or "not tracked yet" */
|
|
||||||
value: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const compact = (n: number) => {
|
|
||||||
const a = Math.abs(n);
|
|
||||||
if (a >= 1e6) return (n / 1e6).toFixed(2).replace(/\.?0+$/, '') + 'M';
|
|
||||||
if (a >= 1e4) return Math.round(n / 1e3) + 'k';
|
|
||||||
return Number.isInteger(n) ? String(n) : n.toFixed(1);
|
|
||||||
};
|
|
||||||
|
|
||||||
export function goalRows(g: GoalsResponse): GoalRow[] {
|
|
||||||
return g.goals
|
|
||||||
.filter((x) => !x.achieved_at)
|
|
||||||
.map<GoalRow>((x) => {
|
|
||||||
const cur = x.current ?? x.current_manual;
|
|
||||||
return {
|
|
||||||
id: x.id,
|
|
||||||
system: x.system,
|
|
||||||
title: x.title,
|
|
||||||
progress: x.progress == null ? null : Math.max(0, Math.min(1, x.progress)),
|
|
||||||
value: cur == null ? 'Not tracked yet' : `${compact(cur)} of ${compact(x.target)}`,
|
|
||||||
};
|
|
||||||
})
|
|
||||||
// measured goals first, in system order
|
|
||||||
.sort((x, y) =>
|
|
||||||
Number(y.progress != null) - Number(x.progress != null) ||
|
|
||||||
systemOrder(x.system) - systemOrder(y.system));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---- the daily six: small habits shown as big tap cards on Today ---- */
|
|
||||||
|
|
||||||
/** Protocol key on the server that holds the daily habits (all manual rules). */
|
|
||||||
export const DAILY_KEY = 'daily';
|
|
||||||
|
|
||||||
/** Short name for the streak grid and a colour, by rule id. Unknown ids fall back to the label. */
|
|
||||||
const HABIT_META: Record<string, { short: string; system: SystemKey }> = {
|
|
||||||
read: { short: 'Read', system: 'wealth' },
|
|
||||||
move: { short: 'Exercise', system: 'train' },
|
|
||||||
sit: { short: 'Meditate', system: 'mind' },
|
|
||||||
sleep: { short: 'Sleep', system: 'sleep' },
|
|
||||||
eat: { short: 'Eat well', system: 'diet' },
|
|
||||||
write: { short: 'Write', system: 'relate' },
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface Habit {
|
|
||||||
protocolId: string;
|
|
||||||
ruleId: string;
|
|
||||||
label: string;
|
|
||||||
short: string;
|
|
||||||
/** which system colour the card uses */
|
|
||||||
system: SystemKey;
|
|
||||||
done: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function dailyHabits(a: AdherenceResponse): Habit[] {
|
|
||||||
const p = a.protocols.find((x) => x.key === DAILY_KEY);
|
|
||||||
if (!p) return [];
|
|
||||||
const today = p.daily[a.today]?.rules ?? {};
|
|
||||||
return p.rules
|
|
||||||
.filter((r) => !r.metric && r.period !== 'week')
|
|
||||||
.map((r) => ({
|
|
||||||
protocolId: p.id,
|
|
||||||
ruleId: r.id,
|
|
||||||
label: r.label,
|
|
||||||
short: HABIT_META[r.id]?.short ?? r.label,
|
|
||||||
system: HABIT_META[r.id]?.system ?? 'mind',
|
|
||||||
done: today[r.id]?.status === 'met',
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** One row per habit over the window. Days before the habit existed, and days not ticked, are empty. */
|
|
||||||
export function habitStreaks(a: AdherenceResponse): StreakRow[] {
|
|
||||||
const p = a.protocols.find((x) => x.key === DAILY_KEY);
|
|
||||||
if (!p) return [];
|
|
||||||
return dailyHabits(a).map((h) => {
|
|
||||||
const cells = a.days.map<CellState>((day) =>
|
|
||||||
p.daily[day]?.rules[h.ruleId]?.status === 'met' ? 'met' : 'none');
|
|
||||||
const tracked = a.days.filter((day) => p.daily[day]).length;
|
|
||||||
const met = cells.filter((c) => c === 'met').length;
|
|
||||||
return {
|
|
||||||
key: h.ruleId, label: h.short, cells, color: h.system,
|
|
||||||
pct: tracked ? Math.round((met / tracked) * 100) : null,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
108
src/lib/theme.ts
108
src/lib/theme.ts
@@ -1,85 +1,25 @@
|
|||||||
/* Jarvis design tokens.
|
/* Dark palette ported from the health.rehbock.xyz PWA */
|
||||||
Direction: Waymo's calm surfaces, big rounded cards and bold geometric type,
|
export const C = {
|
||||||
with Hevy's dense rows, blue accent and green "done" rows.
|
bg: '#0d0d0f',
|
||||||
The palette is chosen once at launch from the phone's light/dark setting;
|
surface: '#141417',
|
||||||
changing that setting takes effect the next time the app starts. */
|
surface2: '#1c1c21',
|
||||||
import { Appearance } from 'react-native';
|
border: '#252529',
|
||||||
|
text: '#e8e8ed',
|
||||||
const light = {
|
muted: '#8a8a99',
|
||||||
bg: '#EEF1F7',
|
dim: '#4a4a55',
|
||||||
surface: '#FFFFFF',
|
green: '#34c759',
|
||||||
surface2: '#F2F4F9',
|
greenDim: 'rgba(52,199,89,0.12)',
|
||||||
border: '#E1E5EE',
|
yellow: '#f5c542',
|
||||||
text: '#0C1730',
|
yellowDim: 'rgba(245,197,66,0.12)',
|
||||||
muted: '#5F6B80',
|
red: '#ff453a',
|
||||||
dim: '#A3ACBD',
|
redDim: 'rgba(255,69,58,0.12)',
|
||||||
green: '#1FA94B',
|
accent: '#6e6af0',
|
||||||
greenDim: '#DDF6CF',
|
accentDim: 'rgba(110,106,240,0.12)',
|
||||||
yellow: '#C98A00',
|
// validated series palette (dark, surface #141417)
|
||||||
yellowDim: 'rgba(201,138,0,0.12)',
|
s1: '#3987e5',
|
||||||
red: '#E5484D',
|
s2: '#d95926',
|
||||||
redDim: 'rgba(229,72,77,0.10)',
|
s3: '#199e70',
|
||||||
accent: '#0B6BFF',
|
s4: '#c98500',
|
||||||
accentDim: 'rgba(11,107,255,0.10)',
|
awake: '#3c3c46',
|
||||||
onAccent: '#FFFFFF',
|
gridline: '#232328',
|
||||||
// chart series
|
|
||||||
s1: '#2F7BEA',
|
|
||||||
s2: '#E2622B',
|
|
||||||
s3: '#17A673',
|
|
||||||
s4: '#D49100',
|
|
||||||
awake: '#C9CFDB',
|
|
||||||
gridline: '#E6E9F0',
|
|
||||||
shadow: 'rgba(12,23,48,0.10)',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const dark: typeof light = {
|
|
||||||
bg: '#0B1220',
|
|
||||||
surface: '#162032',
|
|
||||||
surface2: '#1E2A3F',
|
|
||||||
border: '#26334A',
|
|
||||||
text: '#F1F4F9',
|
|
||||||
muted: '#93A0B5',
|
|
||||||
dim: '#55627A',
|
|
||||||
green: '#3DCB63',
|
|
||||||
greenDim: 'rgba(61,203,99,0.18)',
|
|
||||||
yellow: '#F5C542',
|
|
||||||
yellowDim: 'rgba(245,197,66,0.14)',
|
|
||||||
red: '#FF5A5F',
|
|
||||||
redDim: 'rgba(255,90,95,0.14)',
|
|
||||||
accent: '#3B8BFF',
|
|
||||||
accentDim: 'rgba(59,139,255,0.16)',
|
|
||||||
onAccent: '#FFFFFF',
|
|
||||||
s1: '#4C96F5',
|
|
||||||
s2: '#EC7A45',
|
|
||||||
s3: '#2BBF8A',
|
|
||||||
s4: '#E0A21A',
|
|
||||||
awake: '#33415A',
|
|
||||||
gridline: '#223049',
|
|
||||||
shadow: 'rgba(0,0,0,0.5)',
|
|
||||||
};
|
|
||||||
|
|
||||||
export const isDark = Appearance.getColorScheme() === 'dark';
|
|
||||||
|
|
||||||
/** Colours. Existing screens import this as `C`. */
|
|
||||||
export const C = isDark ? dark : light;
|
|
||||||
|
|
||||||
/** One colour per life system, used for streak cells and goal bars. */
|
|
||||||
export const SYS: Record<string, string> = {
|
|
||||||
sleep: C.s1,
|
|
||||||
train: C.s2,
|
|
||||||
diet: C.s3,
|
|
||||||
mind: isDark ? '#9A8BFF' : '#7C6CF0',
|
|
||||||
wealth: C.s4,
|
|
||||||
relate: isDark ? '#F06FA3' : '#DB4F8A',
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Figtree, loaded in the root layout. */
|
|
||||||
export const F = {
|
|
||||||
regular: 'Figtree_400Regular',
|
|
||||||
medium: 'Figtree_500Medium',
|
|
||||||
semibold: 'Figtree_600SemiBold',
|
|
||||||
bold: 'Figtree_700Bold',
|
|
||||||
heavy: 'Figtree_800ExtraBold',
|
|
||||||
};
|
|
||||||
|
|
||||||
export const R = { card: 22, control: 16, chip: 10, pill: 999 };
|
|
||||||
|
|||||||
Reference in New Issue
Block a user