mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 15:48:05 +00:00
feat: add toggle to hide streamystats watchlist tab/functions
This commit is contained in:
@@ -44,6 +44,9 @@ export default function page() {
|
||||
const [promotedWatchlists, setPromotedWatchlists] = useState<boolean>(
|
||||
settings?.streamyStatsPromotedWatchlists ?? false,
|
||||
);
|
||||
const [hideWatchlistsTab, setHideWatchlistsTab] = useState<boolean>(
|
||||
settings?.hideWatchlistsTab ?? false,
|
||||
);
|
||||
|
||||
const isUrlLocked = pluginSettings?.streamyStatsServerUrl?.locked === true;
|
||||
const isStreamystatsEnabled = !!url;
|
||||
@@ -56,6 +59,7 @@ export default function page() {
|
||||
streamyStatsMovieRecommendations: movieRecs,
|
||||
streamyStatsSeriesRecommendations: seriesRecs,
|
||||
streamyStatsPromotedWatchlists: promotedWatchlists,
|
||||
hideWatchlistsTab: hideWatchlistsTab,
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: ["search"] });
|
||||
queryClient.invalidateQueries({ queryKey: ["streamystats"] });
|
||||
@@ -66,6 +70,7 @@ export default function page() {
|
||||
movieRecs,
|
||||
seriesRecs,
|
||||
promotedWatchlists,
|
||||
hideWatchlistsTab,
|
||||
updateSettings,
|
||||
queryClient,
|
||||
t,
|
||||
@@ -90,12 +95,14 @@ export default function page() {
|
||||
setMovieRecs(false);
|
||||
setSeriesRecs(false);
|
||||
setPromotedWatchlists(false);
|
||||
setHideWatchlistsTab(false);
|
||||
updateSettings({
|
||||
streamyStatsServerUrl: "",
|
||||
searchEngine: "Jellyfin",
|
||||
streamyStatsMovieRecommendations: false,
|
||||
streamyStatsSeriesRecommendations: false,
|
||||
streamyStatsPromotedWatchlists: false,
|
||||
hideWatchlistsTab: false,
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: ["streamystats"] });
|
||||
queryClient.invalidateQueries({ queryKey: ["search"] });
|
||||
@@ -214,6 +221,16 @@ export default function page() {
|
||||
disabled={!isStreamystatsEnabled}
|
||||
/>
|
||||
</ListItem>
|
||||
<ListItem
|
||||
title={t("home.settings.plugins.streamystats.hide_watchlists_tab")}
|
||||
disabledByAdmin={pluginSettings?.hideWatchlistsTab?.locked === true}
|
||||
>
|
||||
<Switch
|
||||
value={hideWatchlistsTab}
|
||||
onValueChange={setHideWatchlistsTab}
|
||||
disabled={!isStreamystatsEnabled}
|
||||
/>
|
||||
</ListItem>
|
||||
</ListGroup>
|
||||
<Text className='px-4 text-xs text-neutral-500 mt-1'>
|
||||
{t("home.settings.plugins.streamystats.home_sections_hint")}
|
||||
|
||||
@@ -106,7 +106,8 @@ export default function TabLayout() {
|
||||
name='(watchlists)'
|
||||
options={{
|
||||
title: t("watchlists.title"),
|
||||
tabBarItemHidden: !settings?.streamyStatsServerUrl,
|
||||
tabBarItemHidden:
|
||||
!settings?.streamyStatsServerUrl || settings?.hideWatchlistsTab,
|
||||
tabBarIcon:
|
||||
Platform.OS === "android"
|
||||
? (_e) => require("@/assets/icons/list.png")
|
||||
|
||||
@@ -123,7 +123,10 @@ export const ItemContent: React.FC<ItemContentProps> = React.memo(
|
||||
|
||||
<PlayedStatus items={[item]} size='large' />
|
||||
<AddToFavorites item={item} />
|
||||
<AddToWatchlist item={item} />
|
||||
{settings.streamyStatsServerUrl &&
|
||||
!settings.hideWatchlistsTab && (
|
||||
<AddToWatchlist item={item} />
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
@@ -142,7 +145,10 @@ export const ItemContent: React.FC<ItemContentProps> = React.memo(
|
||||
|
||||
<PlayedStatus items={[item]} size='large' />
|
||||
<AddToFavorites item={item} />
|
||||
<AddToWatchlist item={item} />
|
||||
{settings.streamyStatsServerUrl &&
|
||||
!settings.hideWatchlistsTab && (
|
||||
<AddToWatchlist item={item} />
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
@@ -155,6 +161,8 @@ export const ItemContent: React.FC<ItemContentProps> = React.memo(
|
||||
user,
|
||||
itemWithSources,
|
||||
settings.hideRemoteSessionButton,
|
||||
settings.streamyStatsServerUrl,
|
||||
settings.hideWatchlistsTab,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -286,6 +286,7 @@
|
||||
"enable_movie_recommendations": "Movie Recommendations",
|
||||
"enable_series_recommendations": "Series Recommendations",
|
||||
"enable_promoted_watchlists": "Promoted Watchlists",
|
||||
"hide_watchlists_tab": "Hide Watchlists Tab",
|
||||
"home_sections_hint": "Show personalized recommendations and promoted watchlists from Streamystats on the home page.",
|
||||
"recommended_movies": "Recommended Movies",
|
||||
"recommended_series": "Recommended Series",
|
||||
|
||||
@@ -202,6 +202,7 @@ export type Settings = {
|
||||
videoPlayerIOS: VideoPlayerIOS;
|
||||
// Appearance
|
||||
hideRemoteSessionButton: boolean;
|
||||
hideWatchlistsTab: boolean;
|
||||
// Audio look-ahead caching
|
||||
audioLookaheadEnabled: boolean;
|
||||
audioLookaheadCount: number;
|
||||
@@ -290,6 +291,7 @@ export const defaultValues: Settings = {
|
||||
videoPlayerIOS: VideoPlayerIOS.VLC,
|
||||
// Appearance
|
||||
hideRemoteSessionButton: false,
|
||||
hideWatchlistsTab: false,
|
||||
// Audio look-ahead caching defaults
|
||||
audioLookaheadEnabled: true,
|
||||
audioLookaheadCount: 2,
|
||||
|
||||
Reference in New Issue
Block a user