Files
group-2-threaded-project-pe…/web/components/petUtils.js
2026-03-25 08:19:44 -06:00

55 lines
830 B
JavaScript

//Temporary, until image support is added
export const SPECIES_EMOJI = {
dog: "🐶",
cat: "🐱",
bird: "🐦",
rabbit: "🐰",
hamster: "🐹",
fish: "🐟",
turtle: "🐢",
snake: "🐍",
lizard: "🦎",
guinea: "🐹",
};
export function getSpeciesEmoji(species) {
if (!species) {
return "🐾";
}
const key = species.toLowerCase();
for (const [k, v] of Object.entries(SPECIES_EMOJI)) {
if (key.includes(k)) {
return v;
}
}
return "🐾";
}
export function getStatusClass(status) {
if (!status) {
return "";
}
const s = status.toLowerCase();
if (s === "available") {
return "status-available";
}
if (s === "adopted") {
return "status-adopted";
}
if (s === "pending") {
return "status-pending";
}
return "status-other";
}