Show "modified" and "old" intervention even if we know nothing about generator
This commit is contained in:
parent
39cb40acb9
commit
a80d69dfca
1 changed files with 15 additions and 39 deletions
|
|
@ -1,45 +1,21 @@
|
|||
import { ProofHintFlags } from "../../models/proof";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
export const interventionText = (
|
||||
t: any,
|
||||
f: ProofHintFlags
|
||||
): string | undefined => {
|
||||
export const interventionText = (t: any, f: ProofHintFlags): string | undefined => {
|
||||
let res = "";
|
||||
|
||||
if (f.generator !== "unknown" && f.generatorSource === "c2pa") {
|
||||
if (f.generator === "camera") {
|
||||
res += "<b>" + t("cc.captured_with_camera") + "</b> ";
|
||||
} else if (f.generator === "screenshot") {
|
||||
res += "<b>" + t("cc.screenshot") + "</b> ";
|
||||
} else if (f.generator === "ai") {
|
||||
res += "<b>" + t("cc.generated_with_ai") + "</b> ";
|
||||
}
|
||||
if ((f.edits?.length ?? 0) > 0) {
|
||||
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;
|
||||
} else if (f.generator !== "unknown") {
|
||||
if (f.generator === "camera") {
|
||||
res += "<b>" + t("cc.captured_with_camera") + "</b> ";
|
||||
} else if (f.generator === "screenshot") {
|
||||
res += "<b>" + t("cc.screenshot_probably") + "</b> ";
|
||||
return res;
|
||||
} else if (f.generator === "ai") {
|
||||
res += "<b>" + t("cc.generated_with_ai") + "</b> ";
|
||||
}
|
||||
if ((f.edits?.length ?? 0) > 0) {
|
||||
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;
|
||||
if (f.generator === "camera") {
|
||||
res += "<b>" + t("cc.captured_with_camera") + "</b> ";
|
||||
} else if (f.generator === "screenshot") {
|
||||
res += "<b>" + (f.generatorSource === "c2pa" ? t("cc.screenshot") : t("cc.screenshot_probably")) + "</b> ";
|
||||
} else if (f.generator === "ai") {
|
||||
res += "<b>" + t("cc.generated_with_ai") + "</b> ";
|
||||
}
|
||||
return undefined;
|
||||
if ((f.edits?.length ?? 0) > 0) {
|
||||
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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue