Skip to content

Replace robot type free-text input with searchable combo box - #1

Merged
mark-takada-airoa merged 3 commits into
mainfrom
feat/robot-type-combo-box
Jun 8, 2026
Merged

mark-takada-airoa merged 3 commits into
mainfrom
feat/robot-type-combo-box

Conversation

@mark-takada-airoa

@mark-takada-airoa mark-takada-airoa commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor

Background

The robot_type field was previously a free-text input, which allowed arbitrary values like Model-X1 and made it hard to keep robot identification consistent across the platform. We now want to constrain it to the two supported models (yubi-stationary, yubi-portable).

Overview

Replaced the robot type free-text Input with a SearchableSelect on both the create and edit robot forms, backed by a typed ROBOT_TYPE constant and localized labels. The field is required on submit. Seed data and API docs were updated to match.

Technical changes

  • frontend/src/shared/lib/status-constants.ts: added ROBOT_TYPE constant and RobotTypeValue type (yubi-stationary / yubi-portable).
  • frontend/src/shared/hooks/use-status-labels.ts: added useRobotTypeLabel hook returning localized labels.
  • frontend/src/features/robots/components/create-robot-form.tsx: swapped input for SearchableSelect; default value is now ROBOT_TYPE.YUBI_STATIONARY; the form schema enforces robot_type as a required z.enum.
  • frontend/src/features/robots/components/edit-robot-form.tsx: same UI swap; if the existing robot_type is not one of the known values, the field initializes empty and the required z.enum validation blocks submit with a "Robot type is required" error until a valid value is picked.
  • frontend/src/shared/lib/locales/{en,ja}/translation.json: removed robotTypePlaceholder; added robotTypeYubiStationary, robotTypeYubiPortable, selectRobotType, robotTypeRequired.
  • backend/internal/database/seeder/initial_data.sql & docs/robot-api-guide.md: updated sample robot_type from Model-X1 to yubi-stationary.
  • frontend/src/lib/api/generated/api.ts: regenerated schema picks up new optional site_id / site_name fields on Robot (incidental regeneration).

UI changes

Before After
image image

Manual verification

Expand verification steps
  • Open the create robot form and confirm the Robot Type field is a searchable select defaulting to "Yubi Stationary".
image
  • Submit the form and verify the created robot has robot_type: "yubi-stationary".
image
  • Open the edit form for a robot whose stored robot_type is one of yubi-stationary / yubi-portable and confirm it is preselected.
image
  • Open the edit form for a robot with a legacy/unknown robot_type and confirm the field renders empty; attempting to save without picking a value should show a "Robot type is required" error and prevent submission.
image image image
  • Switch the UI language between English and Japanese and confirm the select labels and placeholder localize correctly.
image image

🤖 Generated with Claude Code

@mark-takada-airoa
mark-takada-airoa force-pushed the feat/robot-type-combo-box branch from 088cbf4 to 2e44f14 Compare June 5, 2026 06:00
Comment thread frontend/src/lib/api/generated/api.ts Resolved

@petr-airoa petr-airoa 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.

Thanks! LGTM!

@mark-takada-airoa
mark-takada-airoa merged commit 6b7bb6d into main Jun 8, 2026
3 checks passed
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.

2 participants