diff --git a/server/interfaces/api/userSettingsInterfaces.ts b/server/interfaces/api/userSettingsInterfaces.ts index fb0767b211..afa9361166 100644 --- a/server/interfaces/api/userSettingsInterfaces.ts +++ b/server/interfaces/api/userSettingsInterfaces.ts @@ -10,10 +10,14 @@ export interface UserSettingsGeneralResponse { movieQuotaDays?: number; tvQuotaLimit?: number; tvQuotaDays?: number; + musicQuotaLimit?: number; + musicQuotaDays?: number; globalMovieQuotaDays?: number; globalMovieQuotaLimit?: number; globalTvQuotaLimit?: number; globalTvQuotaDays?: number; + globalMusicQuotaLimit?: number; + globalMusicQuotaDays?: number; watchlistSyncMovies?: boolean; watchlistSyncTv?: boolean; } diff --git a/server/routes/user/usersettings.ts b/server/routes/user/usersettings.ts index c8b3f50bd2..8835bdb4b3 100644 --- a/server/routes/user/usersettings.ts +++ b/server/routes/user/usersettings.ts @@ -59,10 +59,14 @@ userSettingsRoutes.get<{ id: string }, UserSettingsGeneralResponse>( movieQuotaDays: user.movieQuotaDays, tvQuotaLimit: user.tvQuotaLimit, tvQuotaDays: user.tvQuotaDays, + musicQuotaLimit: user.musicQuotaLimit, + musicQuotaDays: user.musicQuotaDays, globalMovieQuotaDays: defaultQuotas.movie.quotaDays, globalMovieQuotaLimit: defaultQuotas.movie.quotaLimit, globalTvQuotaDays: defaultQuotas.tv.quotaDays, globalTvQuotaLimit: defaultQuotas.tv.quotaLimit, + globalMusicQuotaDays: defaultQuotas.music.quotaDays, + globalMusicQuotaLimit: defaultQuotas.music.quotaLimit, watchlistSyncMovies: user.settings?.watchlistSyncMovies, watchlistSyncTv: user.settings?.watchlistSyncTv, }); @@ -107,6 +111,8 @@ userSettingsRoutes.post< user.movieQuotaLimit = req.body.movieQuotaLimit; user.tvQuotaDays = req.body.tvQuotaDays; user.tvQuotaLimit = req.body.tvQuotaLimit; + user.musicQuotaDays = req.body.musicQuotaDays; + user.musicQuotaLimit = req.body.musicQuotaLimit; } if (!user.settings) { diff --git a/src/components/Layout/UserDropdown/MiniQuotaDisplay/index.tsx b/src/components/Layout/UserDropdown/MiniQuotaDisplay/index.tsx index abc08dd18c..b6695d0f34 100644 --- a/src/components/Layout/UserDropdown/MiniQuotaDisplay/index.tsx +++ b/src/components/Layout/UserDropdown/MiniQuotaDisplay/index.tsx @@ -8,6 +8,7 @@ import useSWR from 'swr'; const messages = defineMessages({ movierequests: 'Movie Requests', seriesrequests: 'Series Requests', + musicrequests: 'Music Requests', }); type MiniQuotaDisplayProps = { @@ -84,6 +85,34 @@ const MiniQuotaDisplay = ({ userId }: MiniQuotaDisplayProps) => { )} +
+
+ {intl.formatMessage(messages.musicrequests)} +
+
+ {data?.music.limit ?? 0 > 0 ? ( + <> + + + {data?.music.remaining} / {data?.music.limit} + + + ) : ( + <> + + Unlimited + + )} +
+
)} diff --git a/src/components/UserProfile/UserSettings/UserGeneralSettings/index.tsx b/src/components/UserProfile/UserSettings/UserGeneralSettings/index.tsx index 842ea7af26..98ceabb035 100644 --- a/src/components/UserProfile/UserSettings/UserGeneralSettings/index.tsx +++ b/src/components/UserProfile/UserSettings/UserGeneralSettings/index.tsx @@ -42,6 +42,7 @@ const messages = defineMessages({ originallanguageTip: 'Filter content by original language', movierequestlimit: 'Movie Request Limit', seriesrequestlimit: 'Series Request Limit', + musicrequestlimit: 'Music Request Limit', enableOverride: 'Override Global Limit', applanguage: 'Display Language', languageDefault: 'Default ({language})', @@ -63,6 +64,7 @@ const UserGeneralSettings = () => { const { locale, setLocale } = useLocale(); const [movieQuotaEnabled, setMovieQuotaEnabled] = useState(false); const [tvQuotaEnabled, setTvQuotaEnabled] = useState(false); + const [musicQuotaEnabled, setMusicQuotaEnabled] = useState(false); const router = useRouter(); const { user, @@ -94,6 +96,9 @@ const UserGeneralSettings = () => { setTvQuotaEnabled( data?.tvQuotaLimit != undefined && data?.tvQuotaDays != undefined ); + setMusicQuotaEnabled( + data?.musicQuotaLimit != undefined && data?.musicQuotaDays != undefined + ); }, [data]); if (!data && !error) { @@ -128,6 +133,8 @@ const UserGeneralSettings = () => { movieQuotaDays: data?.movieQuotaDays, tvQuotaLimit: data?.tvQuotaLimit, tvQuotaDays: data?.tvQuotaDays, + musicQuotaLimit: data?.musicQuotaLimit, + musicQuotaDays: data?.musicQuotaDays, watchlistSyncMovies: data?.watchlistSyncMovies, watchlistSyncTv: data?.watchlistSyncTv, }} @@ -417,6 +424,46 @@ const UserGeneralSettings = () => { +
+ +
+
+
+ setMusicQuotaEnabled((s) => !s)} + /> + + {intl.formatMessage(messages.enableOverride)} + +
+ +
+
+
)} {hasPermission( diff --git a/src/components/UserProfile/index.tsx b/src/components/UserProfile/index.tsx index 2b3c7c1217..9a542d5c7f 100644 --- a/src/components/UserProfile/index.tsx +++ b/src/components/UserProfile/index.tsx @@ -33,6 +33,7 @@ const messages = defineMessages({ pastdays: '{type} (past {days} days)', movierequests: 'Movie Requests', seriesrequest: 'Series Requests', + musicrequests: 'Music Requests', recentlywatched: 'Recently Watched', plexwatchlist: 'Plex Watchlist', emptywatchlist: @@ -147,22 +148,6 @@ const UserProfile = () => { )) && (
-
-
- {intl.formatMessage(messages.totalrequests)} -
-
- - {intl.formatNumber(user.requestCount)} - -
-
{ )}
+
+
+ {quota.music.limit + ? intl.formatMessage(messages.pastdays, { + type: intl.formatMessage(messages.musicrequests), + days: quota?.music.days, + }) + : intl.formatMessage(messages.musicrequests)} +
+
+ {quota.music.limit ? ( + <> + +
+ {intl.formatMessage(messages.requestsperdays, { + limit: ( + + {intl.formatMessage(messages.limit, { + remaining: quota.music.remaining, + limit: quota.music.limit, + })} + + ), + })} +
+ + ) : ( + + {intl.formatMessage(messages.unlimited)} + + )} +
+
+
+
+ {intl.formatMessage(messages.totalrequests)} +
+
+ + {intl.formatNumber(user.requestCount)} + +
+
)}