Skip to content

Enhance internationalization and UI components: Add new segment types… - #614

Merged
tenkus47 merged 3 commits into
developfrom
update-translation-load-root-too
Sep 18, 2026
Merged

tenkus47 merged 3 commits into
developfrom
update-translation-load-root-too

Conversation

@tenkus47

Copy link
Copy Markdown
Member

… to en.json, improve layout spacing in RelatedTexts and TranslationView components, and update alignment logic in library services. Add tests for segment translations and related segments to ensure accurate data handling.

… to en.json, improve layout spacing in RelatedTexts and TranslationView components, and update alignment logic in library services. Add tests for segment translations and related segments to ensure accurate data handling.
@tenkus47
tenkus47 requested a review from Tech-lo September 18, 2026 07:34
@greptile-apps

greptile-apps Bot commented Sep 18, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The latest changes appear safe to merge, with no new blocking issue found.

Findings

  1. P1 Segment Types Stay Hidden
  2. P2 Missing Texts Become Translations
  3. P2 Untitled Groups Lose Identity
Fix with agent prompt
### Issue 1
src/services/library/segments.ts:undefined-236
The service now passes each related segment's structural type to the panel and adds localized labels, but both related-resource views still render only `item.content`. Nothing reads `item.type` or the new `segment.type.*` keys, so titles, front matter, back matter, and verses remain visually indistinguishable even though the new service behavior and tests say the panel labels them.

### Issue 2
src/services/library/segments.ts:40-41
`fetchTextSafe` converts both missing metadata and transient metadata failures to `null`, but this classifier assigns every null value to the translation category. A stale related `text_id` or failed metadata request can therefore create and count a translation group with an empty title and null language, producing a blank translation entry instead of omitting or explicitly handling unavailable metadata.

### Issue 3
src/routes/chapterV2/utils/resources/components/related-texts/RelatedTexts.tsx:70-81
When metadata is unavailable and the title is empty, this condition removes the whole heading, including the segment count, language styling, and only visible group identifier. The same pattern appears in `RootText.tsx`. If multiple untitled groups are shown, they become indistinguishable stacks with only generic “Open Text” actions, making it difficult to tell which text each segment belongs to.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The latest changes address the previous review by preserving meaningful group headings, exposing structural segment labels, and distinguishing missing resources from operational failures during text and alignment resolution.

  • Adds an “Untitled text” fallback across translation, commentary, and root-text groups.
  • Labels related segments by structural type.
  • Propagates non-not-found alignment and edition lookup failures.
  • Extends coverage for missing metadata, ancestry traversal, and ID resolution.
  • No new actionable issue was identified.

Reviews (3) · Last reviewed commit: "Enhance internationalization and UI comp..."

Comment thread src/services/library/textDetails.ts Outdated
segments: [],
segments: segments.map((segment, index) => ({
id: segment.id,
content: contents[index],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Segment Types Stay Hidden

The service now passes each related segment's structural type to the panel and adds localized labels, but both related-resource views still render only item.content. Nothing reads item.type or the new segment.type.* keys, so titles, front matter, back matter, and verses remain visually indistinguishable even though the new service behavior and tests say the panel labels them.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/services/library/segments.ts
Line: 236

Comment:
**Segment Types Stay Hidden**

The service now passes each related segment's structural type to the panel and adds localized labels, but both related-resource views still render only `item.content`. Nothing reads `item.type` or the new `segment.type.*` keys, so titles, front matter, back matter, and verses remain visually indistinguishable even though the new service behavior and tests say the panel labels them.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +40 to +41
const classifyText = (text: LibraryText | null | undefined): string =>
text?.commentary_of ? COMMENTARY : TRANSLATION;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Missing Texts Become Translations

fetchTextSafe converts both missing metadata and transient metadata failures to null, but this classifier assigns every null value to the translation category. A stale related text_id or failed metadata request can therefore create and count a translation group with an empty title and null language, producing a blank translation entry instead of omitting or explicitly handling unavailable metadata.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/services/library/segments.ts
Line: 40-41

Comment:
**Missing Texts Become Translations**

`fetchTextSafe` converts both missing metadata and transient metadata failures to `null`, but this classifier assigns every null value to the translation category. A stale related `text_id` or failed metadata request can therefore create and count a translation group with an empty title and null language, producing a blank translation entry instead of omitting or explicitly handling unavailable metadata.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

…tionView: Update UI to display segment types for better clarity. Enhance tests to verify segment type rendering and handle cases with missing types.
Comment thread src/services/library/alignments.ts
Comment on lines +70 to +81
{commentary.title && (
<h3
className={` my-2 border-b-2 border-red-700 pb-3 text-lg font-semibold text-gray-800 ${getLanguageClass(
commentary.language,
)}`}
>
{commentary.title}
{commentary.segments?.length > 1
? ` (${commentary.segments.length})`
: ""}
</h3>
)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Untitled Groups Lose Identity

When metadata is unavailable and the title is empty, this condition removes the whole heading, including the segment count, language styling, and only visible group identifier. The same pattern appears in RootText.tsx. If multiple untitled groups are shown, they become indistinguishable stacks with only generic “Open Text” actions, making it difficult to tell which text each segment belongs to.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/routes/chapterV2/utils/resources/components/related-texts/RelatedTexts.tsx
Line: 70-81

Comment:
**Untitled Groups Lose Identity**

When metadata is unavailable and the title is empty, this condition removes the whole heading, including the segment count, language styling, and only visible group identifier. The same pattern appears in `RootText.tsx`. If multiple untitled groups are shown, they become indistinguishable stacks with only generic “Open Text” actions, making it difficult to tell which text each segment belongs to.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

…abel to en.json for better handling of missing titles in RelatedTexts and RootText components. Update TranslationView to display this label when titles are absent, and add tests to verify the correct rendering of the label in various scenarios.
@sonarqubecloud

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@tenkus47
tenkus47 merged commit 162f49e into develop Sep 18, 2026
11 of 12 checks passed
@tenkus47
tenkus47 deleted the update-translation-load-root-too branch September 18, 2026 10:01
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