From 6fba5bcc10513888dae41d4ae7d0a490f645c812 Mon Sep 17 00:00:00 2001 From: Type <79042381+TypeFor@users.noreply.github.com> Date: Sun, 16 Aug 2026 00:29:13 +0200 Subject: [PATCH] FIX - align health app with observable data Remove inferred condition, recovery, and player-health values from the Health UI and NUI contract. Keep browser mocks and tests aligned, correct the default development API port, remove the misleading Medical ID disclosure, and apply the shared page gutter to prevent clipped cards. --- frontend/src/stores/health.test.ts | 1 - frontend/src/stores/phone.ts | 6 -- frontend/src/types/health.ts | 5 -- frontend/src/utils/nui.test.ts | 2 +- frontend/src/utils/nui.ts | 2 +- .../src/views/apps/HealthApp.contract.test.ts | 7 ++ frontend/src/views/apps/HealthApp.vue | 77 +------------------ frontend/testserver/index.cjs | 1 - frontend/testserver/smoke.cjs | 2 +- sky_phone/config/locales/en.lua | 5 -- sky_phone/source/client/health.lua | 16 ---- 11 files changed, 11 insertions(+), 113 deletions(-) diff --git a/frontend/src/stores/health.test.ts b/frontend/src/stores/health.test.ts index 729a192..72ff30e 100644 --- a/frontend/src/stores/health.test.ts +++ b/frontend/src/stores/health.test.ts @@ -22,7 +22,6 @@ const overview: HealthOverview = { playerName: 'Alex Morgan', }, previousWeekSteps: 0, - snapshot: { healthPercent: 100 }, } describe('health store', () => { diff --git a/frontend/src/stores/phone.ts b/frontend/src/stores/phone.ts index 874a43d..eb9ca99 100644 --- a/frontend/src/stores/phone.ts +++ b/frontend/src/stores/phone.ts @@ -368,10 +368,6 @@ const healthFallbackLocales = { kilocalories: '{count} kcal', thisWeek: 'This week', snapshot: 'Health snapshot', - condition: 'Condition', - recovery: 'Recovery', - currentHealth: 'Current health', - conditions: { good: 'Good', fair: 'Fair', low: 'Low' }, trends: { title: 'Trends', week: 'Week', @@ -402,8 +398,6 @@ const healthFallbackLocales = { phoneNumber: 'Phone number', emergencyCall: 'Emergency call', callContact: 'Call emergency contact', - privacy: - 'Information is stored with your character and can be shown to emergency services.', saveFailed: 'Medical ID could not be saved.', }, errors: { diff --git a/frontend/src/types/health.ts b/frontend/src/types/health.ts index d28fa9b..bde20b7 100644 --- a/frontend/src/types/health.ts +++ b/frontend/src/types/health.ts @@ -17,17 +17,12 @@ export type HealthMedicalId = { playerName: string } -export type HealthSnapshot = { - healthPercent: number -} - export type HealthOverview = { dailyStepGoal: number days: HealthActivityDay[] emergencyNumber: string medicalId: HealthMedicalId previousWeekSteps: number - snapshot: HealthSnapshot } export type HealthMedicalIdInput = Omit diff --git a/frontend/src/utils/nui.test.ts b/frontend/src/utils/nui.test.ts index a05e2c7..39dc5e2 100644 --- a/frontend/src/utils/nui.test.ts +++ b/frontend/src/utils/nui.test.ts @@ -34,7 +34,7 @@ describe('nuiCall', () => { }) expect(vi.getTimerCount()).toBe(0) expect(fetchMock).toHaveBeenCalledWith( - 'http://localhost:3001/api/test', + 'http://localhost:3002/api/test', expect.objectContaining({ signal: expect.any(AbortSignal) }), ) }) diff --git a/frontend/src/utils/nui.ts b/frontend/src/utils/nui.ts index 0088297..eecee7e 100644 --- a/frontend/src/utils/nui.ts +++ b/frontend/src/utils/nui.ts @@ -15,7 +15,7 @@ export async function nuiCall( 'apiPort', ) const baseUrl = import.meta.env.DEV - ? `http://localhost:${developmentPort ?? '3001'}/api` + ? `http://localhost:${developmentPort ?? '3002'}/api` : `https://${resourceName}` const requestData = import.meta.env.DEV ? { diff --git a/frontend/src/views/apps/HealthApp.contract.test.ts b/frontend/src/views/apps/HealthApp.contract.test.ts index 3950b7f..0852dbd 100644 --- a/frontend/src/views/apps/HealthApp.contract.test.ts +++ b/frontend/src/views/apps/HealthApp.contract.test.ts @@ -8,6 +8,7 @@ describe('HealthApp Sky UI contract', () => { expect(source).toContain(' { expect(source).toContain("nuiCall('calls:dial'") expect(source).toContain('health.saveMedicalId') }) + + it('does not present values the phone cannot observe', () => { + expect(source).not.toContain('healthPercent') + expect(source).not.toContain('recoveryPercent') + expect(source).not.toContain('conditionKey') + }) }) diff --git a/frontend/src/views/apps/HealthApp.vue b/frontend/src/views/apps/HealthApp.vue index 34aa4d1..2e15f1b 100644 --- a/frontend/src/views/apps/HealthApp.vue +++ b/frontend/src/views/apps/HealthApp.vue @@ -9,7 +9,6 @@ import { MapPin, Phone, RefreshCw, - ShieldCheck, Timer, UserRound, } from 'lucide-vue-next' @@ -102,20 +101,6 @@ const trendCopy = computed(() => { } return phone.t('Apps.health.trends.same') }) -const healthPercent = computed( - () => overview.value?.snapshot.healthPercent ?? 0, -) -const conditionKey = computed(() => - healthPercent.value >= 70 - ? 'good' - : healthPercent.value >= 35 - ? 'fair' - : 'low', -) -const recoveryPercent = computed(() => { - const activeLoad = Math.min(20, Math.round((today.value?.activeSeconds ?? 0) / 180)) - return Math.max(0, Math.min(100, healthPercent.value - activeLoad)) -}) const dateRange = computed(() => { if (!visibleDays.value.length) return '' const start = new Date(`${visibleDays.value[0].date}T12:00:00`) @@ -248,7 +233,7 @@ onBeforeUnmount(() => { - +
{{ phone.t('Apps.health.loading') }} @@ -333,34 +318,6 @@ onBeforeUnmount(() => {
-
-

{{ phone.t('Apps.health.snapshot') }}

-
-
- - - - {{ phone.t('Apps.health.condition') }} - {{ - phone.t(`Apps.health.conditions.${conditionKey}`) - }} -
-
- - - - {{ phone.t('Apps.health.recovery') }} - {{ recoveryPercent }}% -
-
- - - - {{ phone.t('Apps.health.currentHealth') }} - {{ healthPercent }}% -
-
-