keanu-weblite/src/components/content-credentials/MediaIntervention.vue

75 lines
2.1 KiB
Vue
Raw Normal View History

2025-09-09 10:56:15 +02:00
<template>
<div class="cc-summary bubble-inset" v-if="mediaInterventionFlags.length > 0 && infoText.length > 0">
2025-09-09 10:56:15 +02:00
<v-icon class="intervention-icon">{{
showCheck ? "$vuetify.icons.ic_intervention_check" : "$vuetify.icons.ic_intervention"
}}</v-icon
><span class="common-caption-small" v-html="infoText" />
</div>
</template>
<script setup lang="ts">
import { computed } from "vue";
import { MediaInterventionFlags } from "../../models/proof";
2025-09-23 17:17:26 +02:00
import { useI18n } from "vue-i18n";
import { interventionText } from "./intervention";
2025-09-23 17:17:26 +02:00
const { t } = useI18n()
2025-09-09 10:56:15 +02:00
const { multiple, mediaInterventionFlags } = defineProps<{
2025-09-09 11:34:48 +02:00
multiple: boolean;
mediaInterventionFlags: MediaInterventionFlags[];
2025-09-09 10:56:15 +02:00
}>();
const showCheck = computed(() => {
if (!multiple && mediaInterventionFlags.length == 1) {
return !!mediaInterventionFlags[0].containsC2PA;
2025-09-09 11:34:48 +02:00
} else if (multiple) {
return mediaInterventionFlags.every((f) => !!f.containsC2PA)
2025-09-09 11:34:48 +02:00
}
return false;
2025-09-09 10:56:15 +02:00
});
const infoText = computed(() => {
if (!multiple && mediaInterventionFlags.length == 1) {
return interventionText(t, mediaInterventionFlags[0]) ?? "";
} else if (multiple && mediaInterventionFlags.length >= 1) {
const modifiedMedia = mediaInterventionFlags.some((f) => f.modified);
const aiGeneratedMedia = mediaInterventionFlags.some((f) => f.generator === "ai");
2025-09-23 17:17:26 +02:00
if (aiGeneratedMedia && modifiedMedia) {
return "<b>" + t("cc.contains_modified_and_ai_generated") + "</b> " + t("cc.take_a_closer_look");
} else if (modifiedMedia) {
return "<b>" + t("cc.contains_modified") + "</b>";
} else if (aiGeneratedMedia) {
return "<b>" + t("cc.contains_ai_generated") + "</b>";
} else {
return "<b>" + t("cc.information_available") + "</b>";
2025-09-09 11:34:48 +02:00
}
2025-09-09 10:56:15 +02:00
}
2025-09-23 17:17:26 +02:00
return "";
2025-09-09 10:56:15 +02:00
});
</script>
<style lang="scss">
@use "@/assets/css/chat.scss" as *;
.cc-summary {
2025-09-09 12:02:18 +02:00
text-align: start;
2025-09-09 10:56:15 +02:00
.intervention-icon {
width: 12px;
height: 12px;
display: inline-flex;
color: #4642F1;
}
}
.messageIn.from-admin .cc-summary {
.intervention-icon {
color: #908EF7;
}
.common-caption-small {
color: #b0b0b0;
2025-09-09 10:56:15 +02:00
}
}
</style>