fix(treetest): make parent-node Select button translatable - #18
Conversation
The non-leaf "Select" button was hardcoded in English and couldn't be customized, unlike every other participant-facing label. Thread a new selectAsAnswer custom text through the existing pipeline: - new nullable select_as_answer_text column on tree_configs (falls back to the language preset default for existing studies) - selectAsAnswer added to all six language presets - editable in the Messages tab next to the other tree navigation labels - setup tree preview mirrors the configured label Fixes #17
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #17 by making the parent-node “Select” button label part of the existing Tree Test custom-text + language-preset pipeline, so it can be translated via presets and customized per study configuration.
Changes:
- Adds a new
selectAsAnswercustom-text field end-to-end (types → DB column → server actions → participant UI). - Extends all language presets with a localized
selectAsAnswerstring. - Exposes the new label in the setup Messages tab and wires it into the setup preview.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/types/tree-test.ts | Adds selectAsAnswer to typed custom-text shapes used across setup and runtime config. |
| src/lib/treetest/actions.ts | Persists/loads selectAsAnswerText in create/save/load + includes it in loaded test config. |
| src/lib/languages.ts | Adds selectAsAnswer to the translation interface and all preset definitions. |
| src/db/schema.ts | Adds selectAsAnswerText column mapping for tree_configs. |
| src/components/tree-test.tsx | Replaces the hardcoded “Select” with config.customText.selectAsAnswer in participant UI. |
| src/components/tree-preview.tsx | Threads a configurable label into the setup preview’s participant-view mock. |
| src/app/(main)/treetest/setup/[id]/_components/tree-tab.tsx | Passes the configured selectAsAnswer text into the preview component. |
| src/app/(main)/treetest/setup/[id]/_components/setup-tabs.tsx | Initializes customText.selectAsAnswer in the setup form state. |
| src/app/(main)/treetest/setup/[id]/_components/messages-tab.tsx | Adds a new input to edit the Select button label in setup UI. |
| drizzle/0008_peaceful_apocalypse.sql | Migration adding select_as_answer_text to tree_configs. |
| drizzle/meta/0008_snapshot.json | Drizzle snapshot update reflecting the new column. |
| drizzle/meta/_journal.json | Drizzle journal update registering migration 0008. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greptile SummaryThis PR makes the parent-node Select button configurable and translatable.
Confidence Score: 5/5This looks safe to merge. No blocking issues found in the changed code.
What T-Rex did
Important Files Changed
Reviews (1): Last reviewed commit: "fix(treetest): make parent-node Select b..." | Re-trigger Greptile |
Summary
Fixes #17 — the "Select" button shown on parent nodes (when "allow non-leaf answers" is enabled) was hardcoded in English at
tree-test.tsx, so it stayed untranslated even when a study used a language preset, and it couldn't be customized in the test configuration.This threads a new
selectAsAnswercustom text through the existing custom-text pipeline, exactly likefindItHere:select_as_answer_textcolumn ontree_configs(migration0008). Existing studies with a NULL value fall back to the English default via the same||fallback pattern used by every other custom text, so no backfill is needed.languages.ts):selectAsAnsweradded to all six presets — en "Select", es "Seleccionar", fr "Sélectionner", de "Auswählen", pt "Selecionar", it "Seleziona".tree-test.tsx): usesconfig.customText.selectAsAnswerinstead of the hardcoded literal.messages-tab.tsx): new "Select Button" input in the Tree Navigation section; switching a language preset picks it up automatically since presets spread the fullcustomTextobject.tree-preview.tsx/tree-tab.tsx): the participant-view mock now shows the configured label.actions.ts): the create/save/load paths read and write the new column.Test plan
tsc --noEmit,oxlint, andoxfmt --checkpassnpm run db:migrate/db:push)