-
Notifications
You must be signed in to change notification settings - Fork 19
ECHO-578 Fixes #377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ECHO-578 Fixes #377
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ import { useParams, useSearchParams } from "react-router"; | |
| import { Logo } from "@/components/common/Logo"; | ||
| import { toast } from "@/components/common/Toaster"; | ||
| import { useI18nNavigate } from "@/hooks/useI18nNavigate"; | ||
| import { useLanguage } from "@/hooks/useLanguage"; | ||
| import { useParticipantProjectById } from "../hooks"; | ||
| import { startCooldown } from "../refine/hooks/useRefineSelectionCooldown"; | ||
| import { | ||
|
|
@@ -15,14 +16,22 @@ import { | |
| } from "./hooks"; | ||
| import { VerifyInstructions } from "./VerifyInstructions"; | ||
|
|
||
| const LANGUAGE_TO_LOCALE: Record<string, string> = { | ||
| type LanguageCode = "de" | "en" | "es" | "fr" | "nl"; | ||
|
|
||
| const LANGUAGE_TO_LOCALE: Record<LanguageCode, string> = { | ||
| de: "de-DE", | ||
| en: "en-US", | ||
| es: "es-ES", | ||
| fr: "fr-FR", | ||
| nl: "nl-NL", | ||
| }; | ||
|
|
||
| const localeFromLanguage = (language?: string) => { | ||
| if (!language) return undefined; | ||
| const iso = language.includes("-") ? language.split("-")[0] : language; | ||
| return LANGUAGE_TO_LOCALE[iso as LanguageCode]; | ||
| }; | ||
|
Comment on lines
+19
to
+33
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Centralize Nice, clean helper and mapping; runtime behavior is solid. The only concern is duplication + drift: per the PR summary, similar language→locale logic now lives in other components as well. Once we add or tweak a language, we’ll have to remember to touch multiple maps and union types. I’d pull this into a shared i18n util (e.g. - type LanguageCode = "de" | "en" | "es" | "fr" | "nl";
-
- const LANGUAGE_TO_LOCALE: Record<LanguageCode, string> = {
- de: "de-DE",
- en: "en-US",
- es: "es-ES",
- fr: "fr-FR",
- nl: "nl-NL",
- };
-
- const localeFromLanguage = (language?: string) => {
- if (!language) return undefined;
- const iso = language.includes("-") ? language.split("-")[0] : language;
- return LANGUAGE_TO_LOCALE[iso as LanguageCode];
- };
+ import { LANGUAGE_TO_LOCALE, localeFromLanguage } from "@/lib/i18n/locale";That also lets you derive the union type from whatever source backs
🤖 Prompt for AI Agents |
||
|
|
||
| export const TOPIC_ICON_MAP: Record<string, string> = { | ||
| actions: "↗️", | ||
| agreements: "✅", | ||
|
|
@@ -50,8 +59,11 @@ export const VerifySelection = () => { | |
| const topicsQuery = useVerificationTopics(projectId); | ||
|
|
||
| const projectLanguage = projectQuery.data?.language ?? "en"; | ||
| const { iso639_1: uiLanguageIso } = useLanguage(); | ||
| const languageLocale = | ||
| LANGUAGE_TO_LOCALE[projectLanguage] ?? LANGUAGE_TO_LOCALE.en; | ||
| localeFromLanguage(uiLanguageIso) ?? | ||
| localeFromLanguage(projectLanguage) ?? | ||
| LANGUAGE_TO_LOCALE.en; | ||
|
|
||
| const selectedTopics = topicsQuery.data?.selected_topics ?? []; | ||
| const availableTopics = topicsQuery.data?.available_topics ?? []; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: Dembrane/echo
Length of output: 84
🏁 Script executed:
Repository: Dembrane/echo
Length of output: 91
🏁 Script executed:
Repository: Dembrane/echo
Length of output: 5944
Strings are valid conversation IDs and should not be dropped—the current mapping logic has a bug.
The type definition confirms that
added_conversationscan contain eitherstring[](raw conversation IDs) orProjectChatMessageConversation1[](expanded objects). The current code at lines 159-164 maps strings tonulland filters them out, which silently discards valid conversation IDs that should be included in the output.The fix should preserve strings as-is:
This way, string IDs pass through unchanged while objects have their
conversation_idextracted.🤖 Prompt for AI Agents