Files
group-2-threaded-project-pe…/web/components/petUtils.js
2026-04-20 19:19:30 -06:00

57 lines
955 B
JavaScript

//Temporary, until image support is added
export const SPECIES_EMOJI = {
dog: "🐶",
cat: "🐱",
bird: "🐦",
rabbit: "🐰",
hamster: "🐹",
fish: "🐟",
turtle: "🐢",
snake: "🐍",
lizard: "🦎",
guinea: "🐹",
};
//Returns an emoji for a given species name, falls back to a paw print
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 "🐾";
}
//Returns the CSS class name for a pet's status badge
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";
}