From 4e0a923bb248d87d6ad9ff27cddfcdc7b9ca001b Mon Sep 17 00:00:00 2001 From: ToMattBan Date: Fri, 13 Sep 2024 11:56:47 -0300 Subject: [PATCH 1/5] fix(small brazilian-portuguese typo): fixing a really small typo --- src/i18n/locale/pt_BR.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/locale/pt_BR.json b/src/i18n/locale/pt_BR.json index ca8f07a31..f79367552 100644 --- a/src/i18n/locale/pt_BR.json +++ b/src/i18n/locale/pt_BR.json @@ -238,7 +238,7 @@ "i18n.requested": "Solicitado", "i18n.retry": "Tentar Novamente", "i18n.failed": "Falhou", - "components.TvDetails.watchtrailer": "Assisitir Trailer", + "components.TvDetails.watchtrailer": "Assistir Trailer", "components.TvDetails.firstAirDate": "Primeira Exibição", "components.Settings.Notifications.validationChatIdRequired": "Você deve prover um ID de Chat válido", "components.Settings.Notifications.validationBotAPIRequired": "Você deve prover uma chave de autorização do Bot", From 43d204c52e3d2bc45f0e4b88dd059464b12c8010 Mon Sep 17 00:00:00 2001 From: ToMattBan Date: Fri, 13 Sep 2024 11:58:07 -0300 Subject: [PATCH 2/5] feat(component): allow users to request new seasons When a new season of a show already available launches, the users can't ask for the new season as the request more button doesn't appear, this commit aims to fix this #962 --- src/components/RequestButton/index.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/components/RequestButton/index.tsx b/src/components/RequestButton/index.tsx index cf27e55da..871c38d4e 100644 --- a/src/components/RequestButton/index.tsx +++ b/src/components/RequestButton/index.tsx @@ -292,6 +292,23 @@ const RequestButton = ({ }, svg: , }); + } else if ( + mediaType === 'tv' && + hasPermission([Permission.REQUEST, Permission.REQUEST_TV], { + type: 'or', + }) && + media && + media.status === MediaStatus.PARTIALLY_AVAILABLE + ) { + buttons.push({ + id: 'request-more', + text: intl.formatMessage(messages.requestmore), + action: () => { + setEditRequest(false); + setShowRequestModal(true); + }, + svg: , + }); } else if ( mediaType === 'tv' && (!activeRequest || activeRequest.requestedBy.id !== user?.id) && From ddf581ae82c8c44aa74fae81692a96729f27fb53 Mon Sep 17 00:00:00 2001 From: ToMattBan Date: Fri, 13 Sep 2024 13:12:21 -0300 Subject: [PATCH 3/5] fix: reverting changes handled by weblate --- src/i18n/locale/pt_BR.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/locale/pt_BR.json b/src/i18n/locale/pt_BR.json index f79367552..ca8f07a31 100644 --- a/src/i18n/locale/pt_BR.json +++ b/src/i18n/locale/pt_BR.json @@ -238,7 +238,7 @@ "i18n.requested": "Solicitado", "i18n.retry": "Tentar Novamente", "i18n.failed": "Falhou", - "components.TvDetails.watchtrailer": "Assistir Trailer", + "components.TvDetails.watchtrailer": "Assisitir Trailer", "components.TvDetails.firstAirDate": "Primeira Exibição", "components.Settings.Notifications.validationChatIdRequired": "Você deve prover um ID de Chat válido", "components.Settings.Notifications.validationBotAPIRequired": "Você deve prover uma chave de autorização do Bot", From 3383675c63272277f9d9f350300943ac12f881d5 Mon Sep 17 00:00:00 2001 From: ToMattBan Date: Sun, 29 Dec 2024 17:54:22 -0300 Subject: [PATCH 4/5] Fix: Removing duplicates on request button --- src/components/RequestButton/index.tsx | 39 ++++++++------------------ 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/src/components/RequestButton/index.tsx b/src/components/RequestButton/index.tsx index 23302276d..f994e937a 100644 --- a/src/components/RequestButton/index.tsx +++ b/src/components/RequestButton/index.tsx @@ -78,14 +78,14 @@ const RequestButton = ({ const activeRequest = useMemo(() => { return activeRequests && activeRequests.length > 0 ? activeRequests.find((request) => request.requestedBy.id === user?.id) ?? - activeRequests[0] + activeRequests[0] : undefined; }, [activeRequests, user]); const active4kRequest = useMemo(() => { return active4kRequests && active4kRequests.length > 0 ? active4kRequests.find( - (request) => request.requestedBy.id === user?.id - ) ?? active4kRequests[0] + (request) => request.requestedBy.id === user?.id + ) ?? active4kRequests[0] : undefined; }, [active4kRequests, user]); @@ -292,23 +292,6 @@ const RequestButton = ({ }, svg: , }); - } else if ( - mediaType === 'tv' && - hasPermission([Permission.REQUEST, Permission.REQUEST_TV], { - type: 'or', - }) && - media && - media.status === MediaStatus.PARTIALLY_AVAILABLE - ) { - buttons.push({ - id: 'request-more', - text: intl.formatMessage(messages.requestmore), - action: () => { - setEditRequest(false); - setShowRequestModal(true); - }, - svg: , - }); } else if ( mediaType === 'tv' && (!activeRequest || activeRequest.requestedBy.id !== user?.id) && @@ -421,14 +404,14 @@ const RequestButton = ({ > {others && others.length > 0 ? others.map((button) => ( - - {button.svg} - {button.text} - - )) + + {button.svg} + {button.text} + + )) : null} From ce64e4350ae731d4e9ae1c32fe4f77582d6b62a3 Mon Sep 17 00:00:00 2001 From: ToMattBan Date: Mon, 30 Dec 2024 13:13:43 -0300 Subject: [PATCH 5/5] fix: allow user to request new seasons of a already provided show --- src/components/RequestButton/index.tsx | 28 +++++++--------- src/components/TvDetails/index.tsx | 44 -------------------------- 2 files changed, 12 insertions(+), 60 deletions(-) diff --git a/src/components/RequestButton/index.tsx b/src/components/RequestButton/index.tsx index f994e937a..374162442 100644 --- a/src/components/RequestButton/index.tsx +++ b/src/components/RequestButton/index.tsx @@ -56,8 +56,6 @@ const RequestButton = ({ onUpdate, media, mediaType, - isShowComplete = false, - is4kShowComplete = false, }: RequestButtonProps) => { const intl = useIntl(); const settings = useSettings(); @@ -78,14 +76,14 @@ const RequestButton = ({ const activeRequest = useMemo(() => { return activeRequests && activeRequests.length > 0 ? activeRequests.find((request) => request.requestedBy.id === user?.id) ?? - activeRequests[0] + activeRequests[0] : undefined; }, [activeRequests, user]); const active4kRequest = useMemo(() => { return active4kRequests && active4kRequests.length > 0 ? active4kRequests.find( - (request) => request.requestedBy.id === user?.id - ) ?? active4kRequests[0] + (request) => request.requestedBy.id === user?.id + ) ?? active4kRequests[0] : undefined; }, [active4kRequests, user]); @@ -300,8 +298,7 @@ const RequestButton = ({ }) && media && media.status !== MediaStatus.AVAILABLE && - media.status !== MediaStatus.BLACKLISTED && - !isShowComplete + media.status !== MediaStatus.BLACKLISTED ) { buttons.push({ id: 'request-more', @@ -347,7 +344,6 @@ const RequestButton = ({ media && media.status4k !== MediaStatus.AVAILABLE && media.status !== MediaStatus.BLACKLISTED && - !is4kShowComplete && settings.currentSettings.series4kEnabled ) { buttons.push({ @@ -404,14 +400,14 @@ const RequestButton = ({ > {others && others.length > 0 ? others.map((button) => ( - - {button.svg} - {button.text} - - )) + + {button.svg} + {button.text} + + )) : null} diff --git a/src/components/TvDetails/index.tsx b/src/components/TvDetails/index.tsx index 770285952..75f7c70d8 100644 --- a/src/components/TvDetails/index.tsx +++ b/src/components/TvDetails/index.tsx @@ -272,48 +272,6 @@ const TvDetails = ({ tv }: TvDetailsProps) => { ); } - const getAllRequestedSeasons = (is4k: boolean): number[] => { - const requestedSeasons = (data?.mediaInfo?.requests ?? []) - .filter( - (request) => - request.is4k === is4k && - request.status !== MediaRequestStatus.DECLINED - ) - .reduce((requestedSeasons, request) => { - return [ - ...requestedSeasons, - ...request.seasons.map((sr) => sr.seasonNumber), - ]; - }, [] as number[]); - - const availableSeasons = (data?.mediaInfo?.seasons ?? []) - .filter( - (season) => - (season[is4k ? 'status4k' : 'status'] === MediaStatus.AVAILABLE || - season[is4k ? 'status4k' : 'status'] === - MediaStatus.PARTIALLY_AVAILABLE || - season[is4k ? 'status4k' : 'status'] === MediaStatus.PROCESSING) && - !requestedSeasons.includes(season.seasonNumber) - ) - .map((season) => season.seasonNumber); - - return [...requestedSeasons, ...availableSeasons]; - }; - - const showHasSpecials = data.seasons.some( - (season) => - season.seasonNumber === 0 && - settings.currentSettings.partialRequestsEnabled - ); - - const isComplete = - (showHasSpecials ? seasonCount + 1 : seasonCount) <= - getAllRequestedSeasons(false).length; - - const is4kComplete = - (showHasSpecials ? seasonCount + 1 : seasonCount) <= - getAllRequestedSeasons(true).length; - const streamingRegion = user?.settings?.streamingRegion ? user.settings.streamingRegion : settings.currentSettings.streamingRegion @@ -680,8 +638,6 @@ const TvDetails = ({ tv }: TvDetailsProps) => { onUpdate={() => revalidate()} tmdbId={data?.id} media={data?.mediaInfo} - isShowComplete={isComplete} - is4kShowComplete={is4kComplete} /> {(data.mediaInfo?.status === MediaStatus.AVAILABLE || data.mediaInfo?.status === MediaStatus.PARTIALLY_AVAILABLE ||