Skip to content

feat(frontend): add the data contracts, schedule mocks and design tokens - #111

Closed
gac0812 wants to merge 1 commit into
MVPfrom
feat/frontend-contracts-mvp
Closed

gac0812 wants to merge 1 commit into
MVPfrom
feat/frontend-contracts-mvp

Conversation

@gac0812

@gac0812 gac0812 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add the WebSocket schedule/session/voice contract types under frontend/src/types
  • add schedule mock fixtures and overlap detection used by the screens
  • expand design tokens in theme.ts (keep colors.text for main compatibility)

Validation

  • npm ci
  • npm run check
  • npx expo export --platform android --output-dir dist

Second of eight. These have no local dependencies, so they can land before
anything that consumes them.

types/home.ts is the WebSocket contract shared with the backend: the Schedule
entity plus the list, upsert, voice and session message shapes. The filename
is wrong — this is transport, not a home screen — but renaming it belongs in
a refactor, not in the commit that first tracks it.

mocks/schedules.ts is the fixture set the screens render against until the
backend is wired, including the overlap detection that the upsert flow
reports back.

theme.ts grows from two tokens into the full palette, spacing scale and radii
the new screens use. colors.text is kept on top of that palette purely so the
HomeScreen still on main keeps compiling; the wiring commit at the end of
this series removes it along with that screen.
@gac0812 gac0812 closed this Jul 30, 2026
@gac0812
gac0812 deleted the feat/frontend-contracts-mvp branch July 30, 2026 06:54

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Found three concrete contract/mock consistency issues. Local npm ci && npm run check passes, but the Baidu type reference remains unresolved because its symbols are not used yet.

View job run

time_remind_offset_minutes: number;
time_triggered_at: string | null;
geo_triggered_at: string | null;
system_schedule_ref_id: string | null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 — Keep the list contract aligned with the server. ScheduleSummary and handle_list() always include system_alarm_ref_id, but the frontend Schedule type omits it. Consumers typed against this contract cannot access the alarm reference, and the mocks also stop exercising that field. Add system_alarm_ref_id: string | null here and to the fixtures.

schedule_id: scheduleId,
schedule_type: command.payload.schedule_type,
conflicts: findScheduleConflicts(command, schedules, scheduleId),
geofence_armed: command.payload.geofence_armed ?? existingSchedule?.geofence_armed ?? true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 — Mirror the backend's geofence default. When geofence_armed is omitted, ScheduleService sets it to latitude !== null && longitude !== null; it does not preserve the existing value or default to true. A new time-only command therefore returns false from the server but true from this mock, and edits that remove coordinates can also diverge. Derive the fallback from the command coordinates to keep screen behavior representative.

@@ -0,0 +1 @@
/// <reference types="@baidumap/jsapi-v4-types" />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 — Install the referenced type package. @baidumap/jsapi-v4-types is absent from both package.json and the lockfile, and TypeScript reports this directive as unresolved under --traceResolution. The normal check currently passes only because no BMapGL symbols are used yet, so this file provides no declarations when the map code lands. Add the package as a dev dependency (and update the lockfile), or replace this with an actual local declaration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant