Merge branch 'dev' into feat/overseerr-widget
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Badge, Card, Center, Flex, Group, Image, Stack, Text } from '@mantine/core';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { IconGitPullRequest } from '@tabler/icons';
|
||||
import { defineWidget } from '../helper';
|
||||
import { WidgetLoading } from '../loading';
|
||||
@@ -26,6 +27,7 @@ interface MediaRequestListWidgetProps {
|
||||
}
|
||||
|
||||
function MediaRequestListTile({ widget }: MediaRequestListWidgetProps) {
|
||||
const { t } = useTranslation('modules/media-requests-list');
|
||||
const { data, isFetching } = useMediaRequestQuery();
|
||||
|
||||
if (!data || isFetching) {
|
||||
@@ -35,7 +37,7 @@ function MediaRequestListTile({ widget }: MediaRequestListWidgetProps) {
|
||||
if (data.length === 0) {
|
||||
return (
|
||||
<Center h="100%">
|
||||
<Text>There are no requests. Ensure that you've configured your apps correctly.</Text>
|
||||
<Text>{t('noRequests')}</Text>
|
||||
</Center>
|
||||
);
|
||||
}
|
||||
@@ -47,9 +49,9 @@ function MediaRequestListTile({ widget }: MediaRequestListWidgetProps) {
|
||||
return (
|
||||
<Stack>
|
||||
{countPendingApproval > 0 ? (
|
||||
<Text>There are {countPendingApproval} requests waiting for an approval.</Text>
|
||||
<Text>{t('pending', { countPendingApproval })}</Text>
|
||||
) : (
|
||||
<Text>There are currently no pending approvals. You're good to go!</Text>
|
||||
<Text>{t('nonePending')}</Text>
|
||||
)}
|
||||
{data.map((item) => (
|
||||
<Card pos="relative" withBorder>
|
||||
@@ -108,13 +110,14 @@ function MediaRequestListTile({ widget }: MediaRequestListWidgetProps) {
|
||||
}
|
||||
|
||||
const MediaRequestStatusBadge = ({ status }: { status: MediaRequestStatus }) => {
|
||||
const { t } = useTranslation('modules/media-requests-list');
|
||||
switch (status) {
|
||||
case MediaRequestStatus.Approved:
|
||||
return <Badge color="green">Approved</Badge>;
|
||||
return <Badge color="green">{t('state.approved')}</Badge>;
|
||||
case MediaRequestStatus.Declined:
|
||||
return <Badge color="red">Declined</Badge>;
|
||||
return <Badge color="red">{t('state.declined')}</Badge>;
|
||||
case MediaRequestStatus.PendingApproval:
|
||||
return <Badge color="orange">Pending approval</Badge>;
|
||||
return <Badge color="orange">{t('state.pendingApproval')}</Badge>;
|
||||
default:
|
||||
return <></>;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { WidgetLoading } from '../loading';
|
||||
import { IWidget } from '../widgets';
|
||||
import { useMediaRequestQuery } from './media-request-query';
|
||||
import { MediaRequestStatus } from './media-request-types';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
const definition = defineWidget({
|
||||
id: 'media-requests-stats',
|
||||
@@ -26,6 +27,7 @@ interface MediaRequestStatsWidgetProps {
|
||||
}
|
||||
|
||||
function MediaRequestStatsTile({ widget }: MediaRequestStatsWidgetProps) {
|
||||
const { t } = useTranslation('modules/media-requests-stats');
|
||||
const { data, isFetching } = useMediaRequestQuery();
|
||||
|
||||
if (!data || isFetching) {
|
||||
@@ -41,7 +43,7 @@ function MediaRequestStatsTile({ widget }: MediaRequestStatsWidgetProps) {
|
||||
{data.filter((x) => x.status === MediaRequestStatus.PendingApproval).length}
|
||||
</Text>
|
||||
<Text color="dimmed" align="center" size="xs">
|
||||
Pending approvals
|
||||
{t('stats.pending')}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Center>
|
||||
@@ -51,7 +53,7 @@ function MediaRequestStatsTile({ widget }: MediaRequestStatsWidgetProps) {
|
||||
<Stack spacing={0} align="center">
|
||||
<Text align="center">{data.filter((x) => x.type === 'tv').length}</Text>
|
||||
<Text color="dimmed" align="center" size="xs">
|
||||
TV requests
|
||||
{t('stats.tvRequests')}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Center>
|
||||
@@ -61,7 +63,7 @@ function MediaRequestStatsTile({ widget }: MediaRequestStatsWidgetProps) {
|
||||
<Stack spacing={0} align="center">
|
||||
<Text align="center">{data.filter((x) => x.type === 'movie').length}</Text>
|
||||
<Text color="dimmed" align="center" size="xs">
|
||||
Movie requests
|
||||
{t('stats.movieRequests')}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Center>
|
||||
|
||||
Reference in New Issue
Block a user