1 Commits

Author SHA1 Message Date
marcus
6b0b93ea4b Add Jarvis Today dashboard, habit cards and chat placeholder 2026-11-25 00:06:58 -08:00
12 changed files with 1233 additions and 188 deletions

View File

@@ -6,7 +6,7 @@
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "healthapp",
"userInterfaceStyle": "dark",
"userInterfaceStyle": "automatic",
"backgroundColor": "#0d0d0f",
"ios": {
"icon": "./assets/images/icon.png",
@@ -60,7 +60,8 @@
"image": "./assets/images/splash-icon.png",
"imageWidth": 76
}
]
],
"expo-dev-client"
],
"experiments": {
"typedRoutes": true,

148
package-lock.json generated
View File

@@ -8,9 +8,11 @@
"name": "health-app",
"version": "1.0.0",
"dependencies": {
"@expo-google-fonts/figtree": "^0.4.1",
"@expo/ui": "~57.0.9",
"expo": "~57.0.11",
"expo-constants": "~57.0.9",
"expo-dev-client": "~57.0.22",
"expo-device": "~57.0.1",
"expo-font": "~57.0.1",
"expo-glass-effect": "~57.0.1",
@@ -28,6 +30,7 @@
"react-native": "0.86.2",
"react-native-gesture-handler": "~2.32.0",
"react-native-health-connect": "^4.1.3",
"react-native-keyboard-controller": "1.21.9",
"react-native-reanimated": "4.5.1",
"react-native-safe-area-context": "~5.7.0",
"react-native-screens": "~4.26.0",
@@ -75,7 +78,6 @@
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz",
"integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/code-frame": "^7.29.7",
"@babel/generator": "^7.29.7",
@@ -960,6 +962,7 @@
"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==",
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/helper-plugin-utils": "^7.29.7"
},
@@ -975,6 +978,7 @@
"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==",
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/helper-plugin-utils": "^7.29.7"
},
@@ -1006,6 +1010,7 @@
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.29.8.tgz",
"integrity": "sha512-0UpIXPtdDtMXfnV2OJAVMLpj3H/92vmkA6lpSRakmycJvj3VUy6Xs1dM8tXRugupykr5WB+LpiVl0J8LMVg2mg==",
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/helper-plugin-utils": "^7.29.7"
},
@@ -1195,6 +1200,12 @@
"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": {
"version": "0.4.42",
"resolved": "https://registry.npmjs.org/@expo-google-fonts/material-symbols/-/material-symbols-0.4.42.tgz",
@@ -1584,9 +1595,9 @@
}
},
"node_modules/@expo/schema-utils": {
"version": "57.0.2",
"resolved": "https://registry.npmjs.org/@expo/schema-utils/-/schema-utils-57.0.2.tgz",
"integrity": "sha512-fMu/jyN0l1Wzv7XkeWR4IYCx1M8ryui3FdBNGrWwbRgJ7EhxXxK8E2jxP2W3pbgUwUY0V3hG8+GyfCZwny+Lxw==",
"version": "57.0.3",
"resolved": "https://registry.npmjs.org/@expo/schema-utils/-/schema-utils-57.0.3.tgz",
"integrity": "sha512-HcxLkgZbutEjhMVqOPw+MsSjQSqLLG6KtdjbNltms5AN7LibbGe32ae8TRnjeRcelE0+dGOdjdby8seGAO01IQ==",
"license": "MIT"
},
"node_modules/@expo/sdk-runtime-versions": {
@@ -2219,6 +2230,7 @@
"resolved": "https://registry.npmjs.org/@react-native/babel-preset/-/babel-preset-0.86.2.tgz",
"integrity": "sha512-4XKEJ6jKW9lXMB1O5o47gBoGgolde1fbX13gLW/erlcn+1ky+MHHo5UjuM3RWGdPJHIvIzekDDumSUHhB9x5iQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/core": "^7.25.2",
"@babel/plugin-proposal-export-default-from": "^7.24.7",
@@ -2381,6 +2393,7 @@
"resolved": "https://registry.npmjs.org/@react-native/metro-babel-transformer/-/metro-babel-transformer-0.86.2.tgz",
"integrity": "sha512-mX1wgLErdb2hDgXJr9zM9SWLe+ZteZTFTwRWGOQ53yEJwc9DVSnxdTlAtVdMeOj2ntycKh0R8jYdat2Am43cwQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/core": "^7.25.2",
"@react-native/babel-preset": "0.86.2",
@@ -2399,6 +2412,7 @@
"resolved": "https://registry.npmjs.org/@react-native/metro-config/-/metro-config-0.86.2.tgz",
"integrity": "sha512-hJno256j+MS0b3JD1aD3ouTGZVacKNVBuXL2atMQQ8BZ060vl1ptnZ83y569aDW+/rgFSOcqn6ydKeSz4uUKQQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@react-native/js-polyfills": "0.86.2",
"@react-native/metro-babel-transformer": "0.86.2",
@@ -2449,6 +2463,7 @@
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.1.tgz",
"integrity": "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==",
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/code-frame": "^7.10.4",
"@babel/runtime": "^7.12.5",
@@ -2468,6 +2483,7 @@
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",
"integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=10"
},
@@ -2480,6 +2496,7 @@
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz",
"integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"ansi-regex": "^5.0.1",
"ansi-styles": "^5.0.0",
@@ -2493,7 +2510,8 @@
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
"license": "MIT"
"license": "MIT",
"peer": true
},
"node_modules/@testing-library/jest-dom": {
"version": "6.9.1",
@@ -2537,7 +2555,8 @@
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz",
"integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==",
"license": "MIT"
"license": "MIT",
"peer": true
},
"node_modules/@types/hammerjs": {
"version": "2.0.46",
@@ -2583,7 +2602,6 @@
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.18.tgz",
"integrity": "sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==",
"license": "MIT",
"peer": true,
"dependencies": {
"csstype": "^3.2.2"
}
@@ -3049,7 +3067,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.10.44",
"caniuse-lite": "^1.0.30001806",
@@ -3576,7 +3593,8 @@
"version": "0.5.16",
"resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz",
"integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==",
"license": "MIT"
"license": "MIT",
"peer": true
},
"node_modules/dom-serializer": {
"version": "2.0.0",
@@ -3740,7 +3758,6 @@
"resolved": "https://registry.npmjs.org/expo/-/expo-57.0.11.tgz",
"integrity": "sha512-R97257N39Dw0kQFuI4/RvYx95GQ+dmePdo8hxcMOjDxAT4VcCckjILJeAWCE19Jxjb92hZ5NDXAfDPkkV1RB9w==",
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/runtime": "^7.20.0",
"@expo/cli": "^57.0.13",
@@ -3833,7 +3850,6 @@
"resolved": "https://registry.npmjs.org/expo-constants/-/expo-constants-57.0.9.tgz",
"integrity": "sha512-Y47sGiF+U8fwicUSPdJPjB27PuU+FgLK4Mpai0ksZF5hv8jNN3HBqKuDNxsiu70uHBKf80TaR4gwMPh0pmETiQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@expo/env": "~2.4.2"
},
@@ -3842,6 +3858,59 @@
"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": {
"version": "57.0.1",
"resolved": "https://registry.npmjs.org/expo-device/-/expo-device-57.0.1.tgz",
@@ -3869,7 +3938,6 @@
"resolved": "https://registry.npmjs.org/expo-font/-/expo-font-57.0.1.tgz",
"integrity": "sha512-QyS9L1Kh9sKJg4gfU6rdbpxpmH+DyzBX8z6jVvXMUDoqLr1GqmkO/Wu379KCXjL///kWbhpNlbi7AgBuj4VdIQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"fontfaceobserver": "^2.1.0"
},
@@ -3910,6 +3978,12 @@
}
}
},
"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": {
"version": "57.0.1",
"resolved": "https://registry.npmjs.org/expo-keep-awake/-/expo-keep-awake-57.0.1.tgz",
@@ -3925,7 +3999,6 @@
"resolved": "https://registry.npmjs.org/expo-linking/-/expo-linking-57.0.5.tgz",
"integrity": "sha512-SmJI3wr0EVfeKPGf+Qgr9gUbrXk8mM0ATqYLvAX/EAzawDjohPzMJ5pTt7TYMX0Wknj4XCtyCQrGhnERMXT6cQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"expo-constants": "~57.0.9",
"invariant": "^2.2.4"
@@ -3935,6 +4008,18 @@
"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": {
"version": "57.0.9",
"resolved": "https://registry.npmjs.org/expo-modules-autolinking/-/expo-modules-autolinking-57.0.9.tgz",
@@ -3985,7 +4070,6 @@
"resolved": "https://registry.npmjs.org/expo-router/-/expo-router-57.0.11.tgz",
"integrity": "sha512-kE2hz4lLkddZ94vN4nmbq5aXeo0t6FaZ8xJn/Hyn8/dQPsGlvDK0j4ZVayEUUdNmkNHsBVihgf1bl/2rCsYEzA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@expo/log-box": "^57.0.2",
"@expo/metro-runtime": "^57.0.8",
@@ -4069,7 +4153,6 @@
"resolved": "https://registry.npmjs.org/expo-server/-/expo-server-57.0.1.tgz",
"integrity": "sha512-sBfVDH6dmKVHZxqUxbfkzS00PZELMZt1IpnHKxcOTMZtR/t7CtRAFrbXcisG+EyzeqHSVDacZT+1tbYfZt5D8w==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=20.16.0"
}
@@ -4135,6 +4218,15 @@
}
}
},
"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": {
"version": "57.0.2",
"resolved": "https://registry.npmjs.org/expo-web-browser/-/expo-web-browser-57.0.2.tgz",
@@ -4333,7 +4425,6 @@
"resolved": "https://registry.npmjs.org/ws/-/ws-8.21.3.tgz",
"integrity": "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=10.0.0"
},
@@ -5443,6 +5534,7 @@
"resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz",
"integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==",
"license": "MIT",
"peer": true,
"bin": {
"lz-string": "bin/bin.js"
}
@@ -6447,7 +6539,6 @@
"resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz",
"integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
@@ -6467,7 +6558,6 @@
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz",
"integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==",
"license": "MIT",
"peer": true,
"dependencies": {
"scheduler": "^0.27.0"
},
@@ -6504,7 +6594,6 @@
"resolved": "https://registry.npmjs.org/react-native/-/react-native-0.86.2.tgz",
"integrity": "sha512-zbJXGZpwfZGA79Z9ob6Atvfx4nAQL8yJBa35s58E4Oo+khPykfQP2sTeumkKbjwajFYfVayg8pj7Il9nIfTk7A==",
"license": "MIT",
"peer": true,
"dependencies": {
"@react-native/assets-registry": "0.86.2",
"@react-native/codegen": "0.86.2",
@@ -6580,7 +6669,6 @@
"resolved": "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-2.32.0.tgz",
"integrity": "sha512-uYIMOKlKENORq2SABE+jIjbPU+h5I/sQKcq2v16zRq848nwEp1fWRVwML4QWqijc8UcXJC25o54S8GQd4Mf2OA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@egjs/hammerjs": "^2.0.17",
"@types/react-test-renderer": "^19.1.0",
@@ -6632,12 +6720,25 @@
"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": {
"version": "4.5.1",
"resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-4.5.1.tgz",
"integrity": "sha512-RnMvtDuR+68ig864gAvZCOdZehqhC5rFmMo0kn+ARfgVSTvFeF6IFLBVgMPUu0KwihaapEyW24WRi6nEyy1kSA==",
"license": "MIT",
"peer": true,
"dependencies": {
"react-native-is-edge-to-edge": "^1.3.1",
"semver": "^7.7.3"
@@ -6653,7 +6754,6 @@
"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==",
"license": "MIT",
"peer": true,
"peerDependencies": {
"react": "*",
"react-native": "*"
@@ -6693,7 +6793,6 @@
"resolved": "https://registry.npmjs.org/react-native-web/-/react-native-web-0.21.2.tgz",
"integrity": "sha512-SO2t9/17zM4iEnFvlu2DA9jqNbzNhoUP+AItkoCOyFmDMOhUnBBznBDCYN92fGdfAkfQlWzPoez6+zLxFNsZEg==",
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/runtime": "^7.18.6",
"@react-native/normalize-colors": "^0.74.1",
@@ -6726,7 +6825,6 @@
"resolved": "https://registry.npmjs.org/react-native-worklets/-/react-native-worklets-0.10.1.tgz",
"integrity": "sha512-62mRM19bDpfpdI8HLkEErcdOsrAPDtE9lA/sw+5lLRpzBHNhxaoj9QyY2KjXqUmirelxkX4zuPGTC3VdA0feJA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/plugin-transform-arrow-functions": "^7.27.1",
"@babel/plugin-transform-class-properties": "^7.28.6",
@@ -6762,7 +6860,6 @@
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz",
"integrity": "sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
@@ -7528,7 +7625,6 @@
"integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
"devOptional": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"

View File

@@ -3,9 +3,11 @@
"main": "expo-router/entry",
"version": "1.0.0",
"dependencies": {
"@expo-google-fonts/figtree": "^0.4.1",
"@expo/ui": "~57.0.9",
"expo": "~57.0.11",
"expo-constants": "~57.0.9",
"expo-dev-client": "~57.0.22",
"expo-device": "~57.0.1",
"expo-font": "~57.0.1",
"expo-glass-effect": "~57.0.1",
@@ -23,6 +25,7 @@
"react-native": "0.86.2",
"react-native-gesture-handler": "~2.32.0",
"react-native-health-connect": "^4.1.3",
"react-native-keyboard-controller": "1.21.9",
"react-native-reanimated": "4.5.1",
"react-native-safe-area-context": "~5.7.0",
"react-native-screens": "~4.26.0",

View File

@@ -1,23 +1,33 @@
import {
Figtree_400Regular, Figtree_500Medium, Figtree_600SemiBold, Figtree_700Bold,
Figtree_800ExtraBold, useFonts,
} from '@expo-google-fonts/figtree';
import { Stack } from 'expo-router';
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { View } from 'react-native';
import { KeyboardProvider } from 'react-native-keyboard-controller';
import { AuthProvider, useAuth } from '../lib/api';
import { C } from '../lib/theme';
import { C, F, isDark } from '../lib/theme';
function Gate() {
const { ready } = useAuth();
if (!ready) return <View style={{ flex: 1, backgroundColor: C.bg }} />;
const [fontsLoaded] = useFonts({
Figtree_400Regular, Figtree_500Medium, Figtree_600SemiBold, Figtree_700Bold, Figtree_800ExtraBold,
});
if (!ready || !fontsLoaded) return <View style={{ flex: 1, backgroundColor: C.bg }} />;
return (
<Stack
screenOptions={{
headerStyle: { backgroundColor: C.bg },
headerTintColor: C.text,
headerTitleStyle: { fontWeight: '600', fontSize: 17 },
headerTitleStyle: { fontFamily: F.bold, fontSize: 18 },
headerShadowVisible: false,
contentStyle: { backgroundColor: C.bg },
}}>
<Stack.Screen name="index" options={{ title: 'Health' }} />
<Stack.Screen name="index" options={{ headerShown: false }} />
<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="sleep" options={{ title: 'Sleep' }} />
<Stack.Screen name="fitbit" options={{ title: 'Fitbit Air' }} />
@@ -32,9 +42,11 @@ function Gate() {
export default function RootLayout() {
return (
<KeyboardProvider>
<AuthProvider>
<StatusBar style="light" />
<StatusBar style={isDark ? 'light' : 'dark'} />
<Gate />
</AuthProvider>
</KeyboardProvider>
);
}

22
src/app/chat.tsx Normal file
View File

@@ -0,0 +1,22 @@
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 },
});

View File

@@ -1,160 +1,188 @@
import { Link, Stack } 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 { router } from 'expo-router';
import React, { useMemo, useState } from 'react';
import { Pressable, RefreshControl, ScrollView, StyleSheet, Text, View } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import {
CHAT_BAR_SPACE, Card, ChatBar, GoalBar, HabitCard, HabitGrid, Heading, RoundButton, StreakGrid,
} from '../components/kit';
import { clearCache, useAuth } from '../lib/api';
import { buildBrief } from '../lib/brief';
import {
AdherenceResponse, GoalsResponse, Habit, dailyHabits, goalRows, habitStreaks, setCheckin,
} from '../lib/life';
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';
const GOALS_SHOWN = 4;
export default function Today() {
const insets = useSafeAreaInsets();
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(() =>
loadAll({
meta: 'meta', bio: 'biomarkers', wo: 'workouts', sApi: 'sleepApi',
sc: 'sleepCycle', dexa: 'dexa', med: 'medStats', fitbit: 'fitbitSummary',
adh: 'lifeAdherence', goals: 'lifeGoals', wo: 'workouts', sApi: 'sleepApi', sc: 'sleepCycle',
} as const),
);
const r = data as
| {
meta: HealthMeta | null;
bio: BiomarkersResponse | null;
adh: AdherenceResponse | null;
goals: GoalsResponse | 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" />);
const brief = useMemo(() => {
if (!r) return null;
const nights = r.sApi && r.sc ? shapeSleep(r.sApi, r.sc) : [];
const lastNight = nights[nights.length - 1];
const ws = r.wo ? [...r.wo.workouts].sort((a, b) => (a.start_time < b.start_time ? -1 : 1)) : [];
const lastWo = ws[ws.length - 1];
return buildBrief({
sleep: lastNight ? { date: lastNight.date, asleepSec: lastNight.asleep } : null,
workout: lastWo ? { title: lastWo.title, start: lastWo.start_time } : null,
adherence: r.adh,
goals: r.goals,
});
}, [r]);
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" />);
const habits = useMemo<Habit[]>(() => {
if (!r?.adh) return [];
return dailyHabits(r.adh).map((h) => {
const k = `${h.protocolId}:${h.ruleId}`;
return k in pending ? { ...h, done: !!pending[k] } : h;
});
}, [r, pending]);
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
const rows = useMemo(() => (r?.adh ? habitStreaks(r.adh) : []), [r]);
const goals = useMemo(() => (r?.goals ? goalRows(r.goals) : []), [r]);
const doneCount = habits.filter((h) => h.done).length;
const toggle = async (h: Habit, done: boolean | null) => {
if (!r?.adh) return;
const k = `${h.protocolId}:${h.ruleId}`;
setPending((p) => ({ ...p, [k]: done }));
try {
await setCheckin(h, r.adh.today, done);
refresh();
} catch {
// put the card back the way the server has it
setPending((p) => {
const n = { ...p };
delete n[k];
return n;
});
}
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" />);
const onRefresh = () => {
setRefreshing(true);
clearCache();
setPending({});
refresh();
setTimeout(() => setRefreshing(false), 500);
};
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" />,
);
}
const date = new Date().toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric' });
return (
<>
<Stack.Screen
options={{
headerRight: () => (
<Link href="/settings">
<Text style={{ fontSize: 18, padding: 6 }}>⚙️</Text>
</Link>
),
<View style={{ flex: 1, backgroundColor: C.bg }}>
<ScrollView
contentContainerStyle={{
paddingTop: insets.top + 10, paddingHorizontal: 16,
paddingBottom: insets.bottom + CHAT_BAR_SPACE + 16,
}}
refreshControl={
<RefreshControl
refreshing={refreshing} onRefresh={onRefresh} tintColor={C.muted} colors={[C.accent]}
progressBackgroundColor={C.surface}
/>
<Screen onRefresh={refresh}>
<Sec
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 ? (
<Link href="/settings" style={{ padding: 24, textAlign: 'center', color: C.accent, fontSize: 15 }}>
Add your API token in Settings to load your data →
</Link>
<Card style={{ padding: 20, marginTop: 8 }}>
<Text style={s.headline}>Connect your data</Text>
<Text style={s.line}>Add your API token in Settings and your day will appear here.</Text>
<Pressable style={s.cta} onPress={() => router.push('/settings')} accessibilityRole="button">
<Text style={s.ctaT}>Open Settings</Text>
</Pressable>
</Card>
) : loading && !r ? (
<Text style={{ color: C.muted, fontSize: 13, textAlign: 'center', padding: 24 }}>
Loading…
</Text>
<Text style={[s.line, { marginTop: 24 }]}>Loading your day…</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} />
{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}
<Text style={{ fontSize: 11, color: C.dim, marginTop: 32 }}>
Personal health data · served from rehbock.xyz over HTTPS · nothing cached on device
</Text>
</Screen>
</>
)}
</ScrollView>
<ChatBar />
</View>
);
}
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 },
});

146
src/app/systems.tsx Normal file
View File

@@ -0,0 +1,146 @@
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>
</>
);
}

328
src/components/kit.tsx Normal file
View File

@@ -0,0 +1,328 @@
/* 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 },
});

View File

@@ -16,6 +16,8 @@ export const EP = {
traits: `${BASE}/ancestry-traits.json`,
fitbitSummary: `${BASE}/api/health/v1/fitbit/summary?days=30`,
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;
export const FITBIT_SYNC_URL = `${BASE}/api/health/v1/fitbit/sync`;

72
src/lib/brief.ts Normal file
View File

@@ -0,0 +1,72 @@
/* 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 Normal file
View File

@@ -0,0 +1,275 @@
/* 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,
};
});
}

View File

@@ -1,25 +1,85 @@
/* Dark palette ported from the health.rehbock.xyz PWA */
export const C = {
bg: '#0d0d0f',
surface: '#141417',
surface2: '#1c1c21',
border: '#252529',
text: '#e8e8ed',
muted: '#8a8a99',
dim: '#4a4a55',
green: '#34c759',
greenDim: 'rgba(52,199,89,0.12)',
yellow: '#f5c542',
yellowDim: 'rgba(245,197,66,0.12)',
red: '#ff453a',
redDim: 'rgba(255,69,58,0.12)',
accent: '#6e6af0',
accentDim: 'rgba(110,106,240,0.12)',
// validated series palette (dark, surface #141417)
s1: '#3987e5',
s2: '#d95926',
s3: '#199e70',
s4: '#c98500',
awake: '#3c3c46',
gridline: '#232328',
/* Jarvis design tokens.
Direction: Waymo's calm surfaces, big rounded cards and bold geometric type,
with Hevy's dense rows, blue accent and green "done" rows.
The palette is chosen once at launch from the phone's light/dark setting;
changing that setting takes effect the next time the app starts. */
import { Appearance } from 'react-native';
const light = {
bg: '#EEF1F7',
surface: '#FFFFFF',
surface2: '#F2F4F9',
border: '#E1E5EE',
text: '#0C1730',
muted: '#5F6B80',
dim: '#A3ACBD',
green: '#1FA94B',
greenDim: '#DDF6CF',
yellow: '#C98A00',
yellowDim: 'rgba(201,138,0,0.12)',
red: '#E5484D',
redDim: 'rgba(229,72,77,0.10)',
accent: '#0B6BFF',
accentDim: 'rgba(11,107,255,0.10)',
onAccent: '#FFFFFF',
// 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 };