keanu-weblite/src/components/content-credentials/intervention.ts
N-Pex 1aff02c7d4 Rename ProofHintFlags to MediaMetadata
Also, introduce the MediaInterventionFlags class to not send all metadata across, just the info needed for showing the intervention flags.
2025-10-23 10:13:14 +02:00

21 lines
757 B
TypeScript

import { MediaInterventionFlags } from "../../models/proof";
import dayjs from "dayjs";
export const interventionText = (t: any, f: MediaInterventionFlags): string | undefined => {
let res = "";
if (f.generator === "camera") {
res += "<b>" + t("cc.captured_with_camera") + "</b> ";
} else if (f.generator === "screenshot") {
res += "<b>" + t("cc.screenshot_probably") + "</b> ";
} else if (f.generator === "ai") {
res += "<b>" + t("cc.generated_with_ai") + "</b> ";
}
if (f.modified) {
res += "<b>" + t("cc.modified") + "</b> ";
}
if (f.creationDate && dayjs().diff(f.creationDate, "month") >= 3) {
res += "<b>" + t("cc.older_than_n_months", { n: 3 }) + "</b> ";
}
if (res === "") return undefined;
return res;
};