mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 16:05:47 +01:00
🚨 Fix warnings
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Center, Group, Loader, Stack } from '@mantine/core';
|
import { Group, Stack } from '@mantine/core';
|
||||||
import { useEffect, useMemo, useRef } from 'react';
|
import { useEffect, useMemo, useRef } from 'react';
|
||||||
import { useConfigContext } from '../../../config/provider';
|
import { useConfigContext } from '../../../config/provider';
|
||||||
import { useResize } from '../../../hooks/use-resize';
|
import { useResize } from '../../../hooks/use-resize';
|
||||||
@@ -6,9 +6,9 @@ import { useScreenLargerThan } from '../../../hooks/useScreenLargerThan';
|
|||||||
import { CategoryType } from '../../../types/category';
|
import { CategoryType } from '../../../types/category';
|
||||||
import { WrapperType } from '../../../types/wrapper';
|
import { WrapperType } from '../../../types/wrapper';
|
||||||
import { DashboardCategory } from '../Wrappers/Category/Category';
|
import { DashboardCategory } from '../Wrappers/Category/Category';
|
||||||
import { useGridstackStore } from '../Wrappers/gridstack/store';
|
|
||||||
import { DashboardSidebar } from '../Wrappers/Sidebar/Sidebar';
|
import { DashboardSidebar } from '../Wrappers/Sidebar/Sidebar';
|
||||||
import { DashboardWrapper } from '../Wrappers/Wrapper/Wrapper';
|
import { DashboardWrapper } from '../Wrappers/Wrapper/Wrapper';
|
||||||
|
import { useGridstackStore } from '../Wrappers/gridstack/store';
|
||||||
|
|
||||||
export const DashboardView = () => {
|
export const DashboardView = () => {
|
||||||
const wrappers = useWrapperItems();
|
const wrappers = useWrapperItems();
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ const Get = async (request: NextApiRequest, response: NextApiResponse) => {
|
|||||||
['overseerr', 'jellyseerr'].includes(app.integration?.type ?? '')
|
['overseerr', 'jellyseerr'].includes(app.integration?.type ?? '')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Consola.log(`Retrieving media requests from ${apps.length} apps`);
|
||||||
|
|
||||||
const promises = apps.map((app): Promise<MediaRequest[]> => {
|
const promises = apps.map((app): Promise<MediaRequest[]> => {
|
||||||
const apiKey = app.integration?.properties.find((prop) => prop.field === 'apiKey')?.value ?? '';
|
const apiKey = app.integration?.properties.find((prop) => prop.field === 'apiKey')?.value ?? '';
|
||||||
const headers: HeadersInit = { 'X-Api-Key': apiKey };
|
const headers: HeadersInit = { 'X-Api-Key': apiKey };
|
||||||
@@ -39,8 +41,8 @@ const Get = async (request: NextApiRequest, response: NextApiResponse) => {
|
|||||||
type: item.type,
|
type: item.type,
|
||||||
name: genericItem.name,
|
name: genericItem.name,
|
||||||
userName: item.requestedBy.displayName,
|
userName: item.requestedBy.displayName,
|
||||||
userLink: constructAvatarUrl(app, item),
|
userProfilePicture: constructAvatarUrl(app, item),
|
||||||
userProfilePicture: `${app.url}${item.requestedBy.avatar}`,
|
userLink: `${app.url}/users/${item.requestedBy.id}`,
|
||||||
airDate: genericItem.airDate,
|
airDate: genericItem.airDate,
|
||||||
status: item.status,
|
status: item.status,
|
||||||
backdropPath: `https://image.tmdb.org/t/p/original/${genericItem.backdropPath}`,
|
backdropPath: `https://image.tmdb.org/t/p/original/${genericItem.backdropPath}`,
|
||||||
@@ -64,11 +66,14 @@ const Get = async (request: NextApiRequest, response: NextApiResponse) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const constructAvatarUrl = (app: ConfigAppType, item: OverseerrResponseItem) => {
|
const constructAvatarUrl = (app: ConfigAppType, item: OverseerrResponseItem) => {
|
||||||
if (item.requestedBy.avatar.startsWith('http://') || item.requestedBy.avatar.startsWith('https://')) {
|
const isAbsolute =
|
||||||
|
item.requestedBy.avatar.startsWith('http://') || item.requestedBy.avatar.startsWith('https://');
|
||||||
|
|
||||||
|
if (isAbsolute) {
|
||||||
return item.requestedBy.avatar;
|
return item.requestedBy.avatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${app.url}/users/${item.requestedBy.id}`;
|
return `${app.url}/${item.requestedBy.avatar}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const retrieveDetailsForItem = async (
|
const retrieveDetailsForItem = async (
|
||||||
|
|||||||
@@ -82,7 +82,14 @@ function MediaRequestListTile({ widget }: MediaRequestListWidgetProps) {
|
|||||||
</Stack>
|
</Stack>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex gap="xs">
|
<Flex gap="xs">
|
||||||
<Image src={item.userProfilePicture} width={25} height={25} alt="requester avatar" />
|
<Image
|
||||||
|
src={item.userProfilePicture}
|
||||||
|
width={25}
|
||||||
|
height={25}
|
||||||
|
alt="requester avatar"
|
||||||
|
radius="xl"
|
||||||
|
withPlaceholder
|
||||||
|
/>
|
||||||
<Text
|
<Text
|
||||||
component="a"
|
component="a"
|
||||||
href={item.userLink}
|
href={item.userLink}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { Card, Center, Flex, Stack, Text } from '@mantine/core';
|
import { Card, Center, Flex, Stack, Text } from '@mantine/core';
|
||||||
import { IconChartBar } from '@tabler/icons';
|
import { IconChartBar } from '@tabler/icons';
|
||||||
|
import { useTranslation } from 'next-i18next';
|
||||||
import { defineWidget } from '../helper';
|
import { defineWidget } from '../helper';
|
||||||
import { WidgetLoading } from '../loading';
|
import { WidgetLoading } from '../loading';
|
||||||
import { IWidget } from '../widgets';
|
import { IWidget } from '../widgets';
|
||||||
import { useMediaRequestQuery } from './media-request-query';
|
import { useMediaRequestQuery } from './media-request-query';
|
||||||
import { MediaRequestStatus } from './media-request-types';
|
import { MediaRequestStatus } from './media-request-types';
|
||||||
import { useTranslation } from 'next-i18next';
|
|
||||||
|
|
||||||
const definition = defineWidget({
|
const definition = defineWidget({
|
||||||
id: 'media-requests-stats',
|
id: 'media-requests-stats',
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ export const useMediaRequestQuery = () => useQuery({
|
|||||||
const response = await fetch('/api/modules/media-requests');
|
const response = await fetch('/api/modules/media-requests');
|
||||||
return (await response.json()) as MediaRequest[];
|
return (await response.json()) as MediaRequest[];
|
||||||
},
|
},
|
||||||
|
refetchInterval: 3 * 60 * 1000,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user