From 6f1d3e4f66fd3552a49a671d8eb81b60f6a3041d Mon Sep 17 00:00:00 2001 From: Lance Chant <13349722+lancechant@users.noreply.github.com> Date: Tue, 9 Jun 2026 09:41:49 +0200 Subject: [PATCH] chore: PR comments Fixing PR comments from coderabbit Signed-off-by: Lance Chant <13349722+lancechant@users.noreply.github.com> --- app/(auth)/(tabs)/(home)/settings.tv.tsx | 3 +- app/(auth)/(tabs)/(search)/index.tsx | 6 +++- .../search/TVJellyseerrSearchResults.tsx | 30 +++++++++++++++++-- components/search/TVSearchPage.tsx | 1 + hooks/useJellyseerr.ts | 6 ---- translations/en.json | 1 + 6 files changed, 36 insertions(+), 11 deletions(-) diff --git a/app/(auth)/(tabs)/(home)/settings.tv.tsx b/app/(auth)/(tabs)/(home)/settings.tv.tsx index d29859c3d..0064b68ae 100644 --- a/app/(auth)/(tabs)/(home)/settings.tv.tsx +++ b/app/(auth)/(tabs)/(home)/settings.tv.tsx @@ -52,7 +52,7 @@ import { clearTopShelfCacheSafely } from "@/utils/topshelf/cache"; export default function SettingsTV() { const { t } = useTranslation(); const insets = useSafeAreaInsets(); - const { settings, updateSettings } = useSettings(); + const { settings, updateSettings, pluginSettings } = useSettings(); const { logout, loginWithSavedCredential, loginWithPassword } = useJellyfin(); const [user] = useAtom(userAtom); const [api] = useAtom(apiAtom); @@ -69,7 +69,6 @@ export default function SettingsTV() { settings.jellyseerrServerUrl || "", ); const [jellyseerrPassword, setJellyseerrPassword] = useState(""); - const { pluginSettings } = useSettings(); const isJellyseerrLocked = pluginSettings?.jellyseerrServerUrl?.locked === true; diff --git a/app/(auth)/(tabs)/(search)/index.tsx b/app/(auth)/(tabs)/(search)/index.tsx index 61c9107dd..006d3bd27 100644 --- a/app/(auth)/(tabs)/(search)/index.tsx +++ b/app/(auth)/(tabs)/(search)/index.tsx @@ -125,8 +125,11 @@ export default function SearchPage() { const { jellyseerrApi } = useJellyseerr(); // Alert when seerr server is configured but user hasn't connected (only when focused) + const jellyseerrAlertedRef = useRef(false); useEffect(() => { if (!isFocused || !settings?.jellyseerrServerUrl || jellyseerrApi) return; + if (jellyseerrAlertedRef.current) return; + jellyseerrAlertedRef.current = true; Alert.alert( t("jellyseerr.connect_to_jellyseerr", "Connect to Jellyseerr"), t( @@ -134,7 +137,7 @@ export default function SearchPage() { "Jellyseerr is available. Connect in Settings to enable request features.", ), ); - }, []); + }, [isFocused, settings?.jellyseerrServerUrl, jellyseerrApi, t]); // Validate jellyseerr session when switching to Discover useEffect(() => { @@ -147,6 +150,7 @@ export default function SearchPage() { validateJellyseerrSession(settings.jellyseerrServerUrl).then((status) => { if (status.valid) return; Alert.alert( + t("jellyseerr.session_expired", "Session expired"), t( "jellyseerr.session_expired_connect_again", "Your Jellyseerr session has expired. Please reconnect in Settings.", diff --git a/components/search/TVJellyseerrSearchResults.tsx b/components/search/TVJellyseerrSearchResults.tsx index 80f0dcd26..5eac5f463 100644 --- a/components/search/TVJellyseerrSearchResults.tsx +++ b/components/search/TVJellyseerrSearchResults.tsx @@ -19,12 +19,14 @@ interface TVJellyseerrPosterProps { item: MovieResult | TvResult; onPress: () => void; isFirstItem?: boolean; + disabled?: boolean; } const TVJellyseerrPoster: React.FC = ({ item, onPress, isFirstItem = false, + disabled = false, }) => { const typography = useScaledTVTypography(); const sizes = useScaledTVSizes(); @@ -50,7 +52,9 @@ const TVJellyseerrPoster: React.FC = ({ onPress={onPress} onFocus={handleFocus} onBlur={handleBlur} - hasTVPreferredFocus={isFirstItem} + hasTVPreferredFocus={isFirstItem && !disabled} + disabled={disabled} + focusable={!disabled} > = ({ interface TVJellyseerrPersonPosterProps { item: PersonResult; onPress: () => void; + disabled?: boolean; } const TVJellyseerrPersonPoster: React.FC = ({ item, onPress, + disabled = false, }) => { const typography = useScaledTVTypography(); const sizes = useScaledTVSizes(); @@ -163,7 +169,13 @@ const TVJellyseerrPersonPoster: React.FC = ({ const avatarSize = Math.round(sizes.posters.poster * 0.67); return ( - + void; } @@ -239,6 +252,7 @@ const TVJellyseerrMovieSection: React.FC = ({ title, items, isFirstSection = false, + disabled = false, onItemPress, }) => { const typography = useScaledTVTypography(); @@ -274,6 +288,7 @@ const TVJellyseerrMovieSection: React.FC = ({ item={item} onPress={() => onItemPress(item)} isFirstItem={isFirstSection && index === 0} + disabled={disabled} /> )} /> @@ -285,6 +300,7 @@ interface TVJellyseerrTvSectionProps { title: string; items: TvResult[]; isFirstSection?: boolean; + disabled?: boolean; onItemPress: (item: TvResult) => void; } @@ -292,6 +308,7 @@ const TVJellyseerrTvSection: React.FC = ({ title, items, isFirstSection = false, + disabled = false, onItemPress, }) => { const typography = useScaledTVTypography(); @@ -327,6 +344,7 @@ const TVJellyseerrTvSection: React.FC = ({ item={item} onPress={() => onItemPress(item)} isFirstItem={isFirstSection && index === 0} + disabled={disabled} /> )} /> @@ -338,6 +356,7 @@ interface TVJellyseerrPersonSectionProps { title: string; items: PersonResult[]; isFirstSection?: boolean; + disabled?: boolean; onItemPress: (item: PersonResult) => void; } @@ -345,6 +364,7 @@ const TVJellyseerrPersonSection: React.FC = ({ title, items, isFirstSection: _isFirstSection = false, + disabled = false, onItemPress, }) => { const typography = useScaledTVTypography(); @@ -379,6 +399,7 @@ const TVJellyseerrPersonSection: React.FC = ({ onItemPress(item)} + disabled={disabled} /> )} /> @@ -396,6 +417,7 @@ export interface TVJellyseerrSearchResultsProps { onMoviePress: (item: MovieResult) => void; onTvPress: (item: TvResult) => void; onPersonPress: (item: PersonResult) => void; + disabled?: boolean; } export const TVJellyseerrSearchResults: React.FC< @@ -410,6 +432,7 @@ export const TVJellyseerrSearchResults: React.FC< onMoviePress, onTvPress, onPersonPress, + disabled = false, }) => { const { t } = useTranslation(); const typography = useScaledTVTypography(); @@ -450,18 +473,21 @@ export const TVJellyseerrSearchResults: React.FC< title={t("search.request_movies")} items={movieResults} isFirstSection={false} + disabled={disabled} onItemPress={onMoviePress} /> diff --git a/components/search/TVSearchPage.tsx b/components/search/TVSearchPage.tsx index 98781ef50..f76e86a22 100644 --- a/components/search/TVSearchPage.tsx +++ b/components/search/TVSearchPage.tsx @@ -345,6 +345,7 @@ export const TVSearchPage: React.FC = ({ loading={jellyseerrLoading} noResults={jellyseerrNoResults} searchQuery={debouncedSearch} + disabled={isSearchFocused} onMoviePress={onJellyseerrMoviePress || (() => {})} onTvPress={onJellyseerrTvPress || (() => {})} onPersonPress={onJellyseerrPersonPress || (() => {})} diff --git a/hooks/useJellyseerr.ts b/hooks/useJellyseerr.ts index e6d679436..ec0b91767 100644 --- a/hooks/useJellyseerr.ts +++ b/hooks/useJellyseerr.ts @@ -80,12 +80,6 @@ export async function validateJellyseerrSession( const user = storage.get(JELLYSEERR_USER); const cookies = storage.get(JELLYSEERR_COOKIES); - console.log( - "Validating Jellyseerr session with server URL:", - serverUrl, - !user, - !cookies, - ); if (!user || !cookies) { return { valid: false, reason: "no_session" }; } diff --git a/translations/en.json b/translations/en.json index 7313d6482..8c5b636af 100644 --- a/translations/en.json +++ b/translations/en.json @@ -824,6 +824,7 @@ "are_you_sure_you_want_to_request_all_seasons": "Are you sure you want to request all seasons?", "failed_to_login": "Failed to Login", "connect_to_jellyseerr": "Connect to Jellyseerr", + "session_expired": "Session expired", "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.", "cast": "Cast",