chore: PR comments

Fixing PR comments from coderabbit

Signed-off-by: Lance Chant <13349722+lancechant@users.noreply.github.com>
This commit is contained in:
Lance Chant
2026-06-09 09:41:49 +02:00
parent 151a39c7fc
commit 6f1d3e4f66
6 changed files with 36 additions and 11 deletions

View File

@@ -52,7 +52,7 @@ import { clearTopShelfCacheSafely } from "@/utils/topshelf/cache";
export default function SettingsTV() { export default function SettingsTV() {
const { t } = useTranslation(); const { t } = useTranslation();
const insets = useSafeAreaInsets(); const insets = useSafeAreaInsets();
const { settings, updateSettings } = useSettings(); const { settings, updateSettings, pluginSettings } = useSettings();
const { logout, loginWithSavedCredential, loginWithPassword } = useJellyfin(); const { logout, loginWithSavedCredential, loginWithPassword } = useJellyfin();
const [user] = useAtom(userAtom); const [user] = useAtom(userAtom);
const [api] = useAtom(apiAtom); const [api] = useAtom(apiAtom);
@@ -69,7 +69,6 @@ export default function SettingsTV() {
settings.jellyseerrServerUrl || "", settings.jellyseerrServerUrl || "",
); );
const [jellyseerrPassword, setJellyseerrPassword] = useState(""); const [jellyseerrPassword, setJellyseerrPassword] = useState("");
const { pluginSettings } = useSettings();
const isJellyseerrLocked = const isJellyseerrLocked =
pluginSettings?.jellyseerrServerUrl?.locked === true; pluginSettings?.jellyseerrServerUrl?.locked === true;

View File

@@ -125,8 +125,11 @@ export default function SearchPage() {
const { jellyseerrApi } = useJellyseerr(); const { jellyseerrApi } = useJellyseerr();
// Alert when seerr server is configured but user hasn't connected (only when focused) // Alert when seerr server is configured but user hasn't connected (only when focused)
const jellyseerrAlertedRef = useRef(false);
useEffect(() => { useEffect(() => {
if (!isFocused || !settings?.jellyseerrServerUrl || jellyseerrApi) return; if (!isFocused || !settings?.jellyseerrServerUrl || jellyseerrApi) return;
if (jellyseerrAlertedRef.current) return;
jellyseerrAlertedRef.current = true;
Alert.alert( Alert.alert(
t("jellyseerr.connect_to_jellyseerr", "Connect to Jellyseerr"), t("jellyseerr.connect_to_jellyseerr", "Connect to Jellyseerr"),
t( t(
@@ -134,7 +137,7 @@ export default function SearchPage() {
"Jellyseerr is available. Connect in Settings to enable request features.", "Jellyseerr is available. Connect in Settings to enable request features.",
), ),
); );
}, []); }, [isFocused, settings?.jellyseerrServerUrl, jellyseerrApi, t]);
// Validate jellyseerr session when switching to Discover // Validate jellyseerr session when switching to Discover
useEffect(() => { useEffect(() => {
@@ -147,6 +150,7 @@ export default function SearchPage() {
validateJellyseerrSession(settings.jellyseerrServerUrl).then((status) => { validateJellyseerrSession(settings.jellyseerrServerUrl).then((status) => {
if (status.valid) return; if (status.valid) return;
Alert.alert( Alert.alert(
t("jellyseerr.session_expired", "Session expired"),
t( t(
"jellyseerr.session_expired_connect_again", "jellyseerr.session_expired_connect_again",
"Your Jellyseerr session has expired. Please reconnect in Settings.", "Your Jellyseerr session has expired. Please reconnect in Settings.",

View File

@@ -19,12 +19,14 @@ interface TVJellyseerrPosterProps {
item: MovieResult | TvResult; item: MovieResult | TvResult;
onPress: () => void; onPress: () => void;
isFirstItem?: boolean; isFirstItem?: boolean;
disabled?: boolean;
} }
const TVJellyseerrPoster: React.FC<TVJellyseerrPosterProps> = ({ const TVJellyseerrPoster: React.FC<TVJellyseerrPosterProps> = ({
item, item,
onPress, onPress,
isFirstItem = false, isFirstItem = false,
disabled = false,
}) => { }) => {
const typography = useScaledTVTypography(); const typography = useScaledTVTypography();
const sizes = useScaledTVSizes(); const sizes = useScaledTVSizes();
@@ -50,7 +52,9 @@ const TVJellyseerrPoster: React.FC<TVJellyseerrPosterProps> = ({
onPress={onPress} onPress={onPress}
onFocus={handleFocus} onFocus={handleFocus}
onBlur={handleBlur} onBlur={handleBlur}
hasTVPreferredFocus={isFirstItem} hasTVPreferredFocus={isFirstItem && !disabled}
disabled={disabled}
focusable={!disabled}
> >
<Animated.View <Animated.View
style={[ style={[
@@ -144,11 +148,13 @@ const TVJellyseerrPoster: React.FC<TVJellyseerrPosterProps> = ({
interface TVJellyseerrPersonPosterProps { interface TVJellyseerrPersonPosterProps {
item: PersonResult; item: PersonResult;
onPress: () => void; onPress: () => void;
disabled?: boolean;
} }
const TVJellyseerrPersonPoster: React.FC<TVJellyseerrPersonPosterProps> = ({ const TVJellyseerrPersonPoster: React.FC<TVJellyseerrPersonPosterProps> = ({
item, item,
onPress, onPress,
disabled = false,
}) => { }) => {
const typography = useScaledTVTypography(); const typography = useScaledTVTypography();
const sizes = useScaledTVSizes(); const sizes = useScaledTVSizes();
@@ -163,7 +169,13 @@ const TVJellyseerrPersonPoster: React.FC<TVJellyseerrPersonPosterProps> = ({
const avatarSize = Math.round(sizes.posters.poster * 0.67); const avatarSize = Math.round(sizes.posters.poster * 0.67);
return ( return (
<Pressable onPress={onPress} onFocus={handleFocus} onBlur={handleBlur}> <Pressable
onPress={onPress}
onFocus={handleFocus}
onBlur={handleBlur}
disabled={disabled}
focusable={!disabled}
>
<Animated.View <Animated.View
style={[ style={[
animatedStyle, animatedStyle,
@@ -232,6 +244,7 @@ interface TVJellyseerrMovieSectionProps {
title: string; title: string;
items: MovieResult[]; items: MovieResult[];
isFirstSection?: boolean; isFirstSection?: boolean;
disabled?: boolean;
onItemPress: (item: MovieResult) => void; onItemPress: (item: MovieResult) => void;
} }
@@ -239,6 +252,7 @@ const TVJellyseerrMovieSection: React.FC<TVJellyseerrMovieSectionProps> = ({
title, title,
items, items,
isFirstSection = false, isFirstSection = false,
disabled = false,
onItemPress, onItemPress,
}) => { }) => {
const typography = useScaledTVTypography(); const typography = useScaledTVTypography();
@@ -274,6 +288,7 @@ const TVJellyseerrMovieSection: React.FC<TVJellyseerrMovieSectionProps> = ({
item={item} item={item}
onPress={() => onItemPress(item)} onPress={() => onItemPress(item)}
isFirstItem={isFirstSection && index === 0} isFirstItem={isFirstSection && index === 0}
disabled={disabled}
/> />
)} )}
/> />
@@ -285,6 +300,7 @@ interface TVJellyseerrTvSectionProps {
title: string; title: string;
items: TvResult[]; items: TvResult[];
isFirstSection?: boolean; isFirstSection?: boolean;
disabled?: boolean;
onItemPress: (item: TvResult) => void; onItemPress: (item: TvResult) => void;
} }
@@ -292,6 +308,7 @@ const TVJellyseerrTvSection: React.FC<TVJellyseerrTvSectionProps> = ({
title, title,
items, items,
isFirstSection = false, isFirstSection = false,
disabled = false,
onItemPress, onItemPress,
}) => { }) => {
const typography = useScaledTVTypography(); const typography = useScaledTVTypography();
@@ -327,6 +344,7 @@ const TVJellyseerrTvSection: React.FC<TVJellyseerrTvSectionProps> = ({
item={item} item={item}
onPress={() => onItemPress(item)} onPress={() => onItemPress(item)}
isFirstItem={isFirstSection && index === 0} isFirstItem={isFirstSection && index === 0}
disabled={disabled}
/> />
)} )}
/> />
@@ -338,6 +356,7 @@ interface TVJellyseerrPersonSectionProps {
title: string; title: string;
items: PersonResult[]; items: PersonResult[];
isFirstSection?: boolean; isFirstSection?: boolean;
disabled?: boolean;
onItemPress: (item: PersonResult) => void; onItemPress: (item: PersonResult) => void;
} }
@@ -345,6 +364,7 @@ const TVJellyseerrPersonSection: React.FC<TVJellyseerrPersonSectionProps> = ({
title, title,
items, items,
isFirstSection: _isFirstSection = false, isFirstSection: _isFirstSection = false,
disabled = false,
onItemPress, onItemPress,
}) => { }) => {
const typography = useScaledTVTypography(); const typography = useScaledTVTypography();
@@ -379,6 +399,7 @@ const TVJellyseerrPersonSection: React.FC<TVJellyseerrPersonSectionProps> = ({
<TVJellyseerrPersonPoster <TVJellyseerrPersonPoster
item={item} item={item}
onPress={() => onItemPress(item)} onPress={() => onItemPress(item)}
disabled={disabled}
/> />
)} )}
/> />
@@ -396,6 +417,7 @@ export interface TVJellyseerrSearchResultsProps {
onMoviePress: (item: MovieResult) => void; onMoviePress: (item: MovieResult) => void;
onTvPress: (item: TvResult) => void; onTvPress: (item: TvResult) => void;
onPersonPress: (item: PersonResult) => void; onPersonPress: (item: PersonResult) => void;
disabled?: boolean;
} }
export const TVJellyseerrSearchResults: React.FC< export const TVJellyseerrSearchResults: React.FC<
@@ -410,6 +432,7 @@ export const TVJellyseerrSearchResults: React.FC<
onMoviePress, onMoviePress,
onTvPress, onTvPress,
onPersonPress, onPersonPress,
disabled = false,
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const typography = useScaledTVTypography(); const typography = useScaledTVTypography();
@@ -450,18 +473,21 @@ export const TVJellyseerrSearchResults: React.FC<
title={t("search.request_movies")} title={t("search.request_movies")}
items={movieResults} items={movieResults}
isFirstSection={false} isFirstSection={false}
disabled={disabled}
onItemPress={onMoviePress} onItemPress={onMoviePress}
/> />
<TVJellyseerrTvSection <TVJellyseerrTvSection
title={t("search.request_series")} title={t("search.request_series")}
items={tvResults} items={tvResults}
isFirstSection={false} isFirstSection={false}
disabled={disabled}
onItemPress={onTvPress} onItemPress={onTvPress}
/> />
<TVJellyseerrPersonSection <TVJellyseerrPersonSection
title={t("search.actors")} title={t("search.actors")}
items={personResults} items={personResults}
isFirstSection={false} isFirstSection={false}
disabled={disabled}
onItemPress={onPersonPress} onItemPress={onPersonPress}
/> />
</View> </View>

View File

@@ -345,6 +345,7 @@ export const TVSearchPage: React.FC<TVSearchPageProps> = ({
loading={jellyseerrLoading} loading={jellyseerrLoading}
noResults={jellyseerrNoResults} noResults={jellyseerrNoResults}
searchQuery={debouncedSearch} searchQuery={debouncedSearch}
disabled={isSearchFocused}
onMoviePress={onJellyseerrMoviePress || (() => {})} onMoviePress={onJellyseerrMoviePress || (() => {})}
onTvPress={onJellyseerrTvPress || (() => {})} onTvPress={onJellyseerrTvPress || (() => {})}
onPersonPress={onJellyseerrPersonPress || (() => {})} onPersonPress={onJellyseerrPersonPress || (() => {})}

View File

@@ -80,12 +80,6 @@ export async function validateJellyseerrSession(
const user = storage.get<JellyseerrUser>(JELLYSEERR_USER); const user = storage.get<JellyseerrUser>(JELLYSEERR_USER);
const cookies = storage.get<string[]>(JELLYSEERR_COOKIES); const cookies = storage.get<string[]>(JELLYSEERR_COOKIES);
console.log(
"Validating Jellyseerr session with server URL:",
serverUrl,
!user,
!cookies,
);
if (!user || !cookies) { if (!user || !cookies) {
return { valid: false, reason: "no_session" }; return { valid: false, reason: "no_session" };
} }

View File

@@ -824,6 +824,7 @@
"are_you_sure_you_want_to_request_all_seasons": "Are you sure you want to request all seasons?", "are_you_sure_you_want_to_request_all_seasons": "Are you sure you want to request all seasons?",
"failed_to_login": "Failed to Login", "failed_to_login": "Failed to Login",
"connect_to_jellyseerr": "Connect to Jellyseerr", "connect_to_jellyseerr": "Connect to Jellyseerr",
"session_expired": "Session expired",
"session_expired_connect_again": "Your Jellyseerr session has expired. Please reconnect in Settings.", "session_expired_connect_again": "Your Jellyseerr session has expired. Please reconnect in Settings.",
"connect_in_settings": "Jellyseerr is available. Connect in Settings to enable request features.", "connect_in_settings": "Jellyseerr is available. Connect in Settings to enable request features.",
"cast": "Cast", "cast": "Cast",