refactor(app): render a release's sections from their own component

This commit is contained in:
Mohamed Boudra
2026-11-10 10:05:14 +01:00
parent ccdca942e9
commit a57f0911bd
@@ -189,18 +189,20 @@ const ReleaseView = memo(function ReleaseView({ release, isCurrent }: ReleaseVie
{t(showingAllChanges ? "changelog.hideAllChanges" : "changelog.showAllChanges")}
</Button>
) : null}
{showsSections
? keyChangelogSections(release.sections).map(({ key, section }) => (
<View key={key} style={styles.section}>
{section.title ? <Text style={styles.sectionTitle}>{section.title}</Text> : null}
{section.body ? <MarkdownRenderer text={section.body} compact /> : null}
</View>
))
: null}
{showsSections ? <ReleaseSections sections={release.sections} /> : null}
</View>
);
});
function ReleaseSections({ sections }: { sections: readonly ChangelogSection[] }) {
return keyChangelogSections(sections).map(({ key, section }) => (
<View key={key} style={styles.section}>
{section.title ? <Text style={styles.sectionTitle}>{section.title}</Text> : null}
{section.body ? <MarkdownRenderer text={section.body} compact /> : null}
</View>
));
}
/** A release can repeat a section title; the occurrence keeps the key stable. */
function keyChangelogSections(
sections: readonly ChangelogSection[],