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() {
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;

View File

@@ -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.",

View File

@@ -19,12 +19,14 @@ interface TVJellyseerrPosterProps {
item: MovieResult | TvResult;
onPress: () => void;
isFirstItem?: boolean;
disabled?: boolean;
}
const TVJellyseerrPoster: React.FC<TVJellyseerrPosterProps> = ({
item,
onPress,
isFirstItem = false,
disabled = false,
}) => {
const typography = useScaledTVTypography();
const sizes = useScaledTVSizes();
@@ -50,7 +52,9 @@ const TVJellyseerrPoster: React.FC<TVJellyseerrPosterProps> = ({
onPress={onPress}
onFocus={handleFocus}
onBlur={handleBlur}
hasTVPreferredFocus={isFirstItem}
hasTVPreferredFocus={isFirstItem && !disabled}
disabled={disabled}
focusable={!disabled}
>
<Animated.View
style={[
@@ -144,11 +148,13 @@ const TVJellyseerrPoster: React.FC<TVJellyseerrPosterProps> = ({
interface TVJellyseerrPersonPosterProps {
item: PersonResult;
onPress: () => void;
disabled?: boolean;
}
const TVJellyseerrPersonPoster: React.FC<TVJellyseerrPersonPosterProps> = ({
item,
onPress,
disabled = false,
}) => {
const typography = useScaledTVTypography();
const sizes = useScaledTVSizes();
@@ -163,7 +169,13 @@ const TVJellyseerrPersonPoster: React.FC<TVJellyseerrPersonPosterProps> = ({
const avatarSize = Math.round(sizes.posters.poster * 0.67);
return (
<Pressable onPress={onPress} onFocus={handleFocus} onBlur={handleBlur}>
<Pressable
onPress={onPress}
onFocus={handleFocus}
onBlur={handleBlur}
disabled={disabled}
focusable={!disabled}
>
<Animated.View
style={[
animatedStyle,
@@ -232,6 +244,7 @@ interface TVJellyseerrMovieSectionProps {
title: string;
items: MovieResult[];
isFirstSection?: boolean;
disabled?: boolean;
onItemPress: (item: MovieResult) => void;
}
@@ -239,6 +252,7 @@ const TVJellyseerrMovieSection: React.FC<TVJellyseerrMovieSectionProps> = ({
title,
items,
isFirstSection = false,
disabled = false,
onItemPress,
}) => {
const typography = useScaledTVTypography();
@@ -274,6 +288,7 @@ const TVJellyseerrMovieSection: React.FC<TVJellyseerrMovieSectionProps> = ({
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<TVJellyseerrTvSectionProps> = ({
title,
items,
isFirstSection = false,
disabled = false,
onItemPress,
}) => {
const typography = useScaledTVTypography();
@@ -327,6 +344,7 @@ const TVJellyseerrTvSection: React.FC<TVJellyseerrTvSectionProps> = ({
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<TVJellyseerrPersonSectionProps> = ({
title,
items,
isFirstSection: _isFirstSection = false,
disabled = false,
onItemPress,
}) => {
const typography = useScaledTVTypography();
@@ -379,6 +399,7 @@ const TVJellyseerrPersonSection: React.FC<TVJellyseerrPersonSectionProps> = ({
<TVJellyseerrPersonPoster
item={item}
onPress={() => 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}
/>
<TVJellyseerrTvSection
title={t("search.request_series")}
items={tvResults}
isFirstSection={false}
disabled={disabled}
onItemPress={onTvPress}
/>
<TVJellyseerrPersonSection
title={t("search.actors")}
items={personResults}
isFirstSection={false}
disabled={disabled}
onItemPress={onPersonPress}
/>
</View>

View File

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

View File

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