diff --git a/web/components/doc-renderer-v2.tsx b/web/components/doc-renderer-v2.tsx index 54af0e2..196be1f 100644 --- a/web/components/doc-renderer-v2.tsx +++ b/web/components/doc-renderer-v2.tsx @@ -190,7 +190,7 @@ function ChunkCard({ p{fm.page} {fm.image_type && ยท {fm.image_type}} {fm.ufo_anomaly_detected && ( - ยท ๐Ÿ›ธ UAP: {fm.ufo_anomaly_type} + ยท ๐Ÿ›ธ UAP: {(typeof fm.ufo_anomaly_type === "string" && fm.ufo_anomaly_type.trim() && fm.ufo_anomaly_type.toLowerCase() !== "null") ? fm.ufo_anomaly_type : "anomalia"} )} {(showEn || showPt) && ( @@ -374,11 +374,24 @@ function ChunkCard({ {showEn &&

{content_en}

} {showPt && lang === "both" &&

{content_pt}

} {!showEn && showPt &&

{content_pt}

} - {fm.ufo_anomaly_detected && ( -
- ๐Ÿ›ธ UAP flag: {fm.ufo_anomaly_type ?? "anomaly"} โ€” {fm.ufo_anomaly_rationale} -
- )} + {fm.ufo_anomaly_detected && } + + ); +} + +/** UAP anomaly flag โ€” shows type and/or rationale, omitting parts that are + * absent so an uncharacterized flag doesn't render a dangling "anomaly โ€”". */ +function UapFlag({ fm }: { fm: ParsedChunk["fm"] }) { + const clean = (v: unknown) => { + const s = typeof v === "string" ? v.trim() : ""; + return s && s.toLowerCase() !== "null" ? s : null; + }; + const type = clean(fm.ufo_anomaly_type); + const rationale = clean(fm.ufo_anomaly_rationale); + return ( +
+ ๐Ÿ›ธ UAP flag: {type ?? "anomalia"} + {rationale ? ` โ€” ${rationale}` : ""}
); }