mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-16 16:18:09 +00:00
Updates branding and naming conventions to use "Seerr" instead of "Jellyseerr" across all files, components, hooks, and translations. Renames files, functions, classes, variables, and UI text to reflect the new naming convention while maintaining identical functionality. Updates asset references including logo and screenshot images. Changes API class name, storage keys, atom names, and all related utilities to use "Seerr" prefix. Modifies translation keys and user-facing text to match the rebrand.
78 lines
2.4 KiB
TypeScript
78 lines
2.4 KiB
TypeScript
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
|
import { useEffect, useState } from "react";
|
|
import { TouchableOpacity, View, type ViewProps } from "react-native";
|
|
import { MediaStatus } from "@/utils/jellyseerr/server/constants/media";
|
|
|
|
interface Props {
|
|
mediaStatus?: MediaStatus;
|
|
showRequestIcon: boolean;
|
|
onPress?: () => void;
|
|
}
|
|
|
|
const SeerrStatusIcon: React.FC<Props & ViewProps> = ({
|
|
mediaStatus,
|
|
showRequestIcon,
|
|
onPress,
|
|
...props
|
|
}) => {
|
|
const [badgeIcon, setBadgeIcon] =
|
|
useState<keyof typeof MaterialCommunityIcons.glyphMap>();
|
|
const [badgeStyle, setBadgeStyle] = useState<string>();
|
|
|
|
// Match similar to what Jellyseerr is currently using
|
|
// https://github.com/Fallenbagel/jellyseerr/blob/8a097d5195749c8d1dca9b473b8afa96a50e2fe2/src/components/Common/StatusBadgeMini/index.tsx#L33C1-L62C4
|
|
useEffect(() => {
|
|
switch (mediaStatus) {
|
|
case MediaStatus.PROCESSING:
|
|
setBadgeStyle(
|
|
"bg-indigo-500 border-indigo-400 ring-indigo-400 text-indigo-100",
|
|
);
|
|
setBadgeIcon("clock");
|
|
break;
|
|
case MediaStatus.AVAILABLE:
|
|
setBadgeStyle(
|
|
"bg-purple-500 border-green-400 ring-green-400 text-green-100",
|
|
);
|
|
setBadgeIcon("check");
|
|
break;
|
|
case MediaStatus.PENDING:
|
|
setBadgeStyle(
|
|
"bg-yellow-500 border-yellow-400 ring-yellow-400 text-yellow-100",
|
|
);
|
|
setBadgeIcon("bell");
|
|
break;
|
|
case MediaStatus.BLACKLISTED:
|
|
setBadgeStyle("bg-red-500 border-white-400 ring-white-400 text-white");
|
|
setBadgeIcon("eye-off");
|
|
break;
|
|
case MediaStatus.PARTIALLY_AVAILABLE:
|
|
setBadgeStyle(
|
|
"bg-green-500 border-green-400 ring-green-400 text-green-100",
|
|
);
|
|
setBadgeIcon("minus");
|
|
break;
|
|
default:
|
|
if (showRequestIcon) {
|
|
setBadgeStyle("bg-green-600");
|
|
setBadgeIcon("plus");
|
|
}
|
|
break;
|
|
}
|
|
}, [mediaStatus, showRequestIcon, setBadgeStyle, setBadgeIcon]);
|
|
|
|
return (
|
|
badgeIcon && (
|
|
<TouchableOpacity onPress={onPress} disabled={onPress === undefined}>
|
|
<View
|
|
className={`${badgeStyle ?? "bg-purple-600"} rounded-full h-6 w-6 flex items-center justify-center ${props.className}`}
|
|
{...props}
|
|
>
|
|
<MaterialCommunityIcons name={badgeIcon} size={18} color='white' />
|
|
</View>
|
|
</TouchableOpacity>
|
|
)
|
|
);
|
|
};
|
|
|
|
export default SeerrStatusIcon;
|