Spaces:
Sleeping

emotion-ui / src /utils /emotionUtils.js
Aya
clean deploy emotion ui frontend
20d0e47
Raw History Blame Contribute Delete
822 Bytes
import { emotionNames } from "../constants/translations";
export const getEmotionColor = (emotion) => {
const colors = {
happy: "#58002C",
sad: "#AC1634",
angry: "#7A0028",
neutral: "#E77291",
fearful: "#D4A5A5",
disgust: "#7C9F6E",
surprised: "#FFC4A4",
};
return colors[emotion?.toLowerCase()] || "#FFB7C5";
};
export const translateEmotion = (lang, name) =>
emotionNames[lang]?.[name] || name;
export const getEmotionIcon = (prediction) => {
const icons = {
Happy: "😊",
Angry: "😠",
Sad: "😒",
Neutral: "😐",
};
return icons[prediction] || "🎭";
};
export const formatTime = (seconds) => {
const mins = Math.floor(seconds / 60);
const secs = seconds % 60;
return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
};