From 49f9fa0f1bfd68d5ac89ac67e0a38cff5b4ffb13 Mon Sep 17 00:00:00 2001 From: ajnart Date: Wed, 26 Jul 2023 13:03:08 +0900 Subject: [PATCH 1/8] =?UTF-8?q?=F0=9F=90=B3=20Add=20docker=20shortcuts=20i?= =?UTF-8?q?nside=20`package.json`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 49f0b7b82..8f71d3a97 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,9 @@ "test": "vitest", "test:ui": "vitest --ui", "test:run": "vitest run", - "test:coverage": "vitest run --coverage" + "test:coverage": "vitest run --coverage", + "docker:build": "docker build . -t homarr:dev", + "docker:start": "docker run --env-file ./.env -p 7575:7575 homarr:dev " }, "dependencies": { "@ctrl/deluge": "^4.1.0", @@ -155,7 +157,9 @@ "^[./]" ], "importOrderSeparation": true, - "plugins": ["@trivago/prettier-plugin-sort-imports"], + "plugins": [ + "@trivago/prettier-plugin-sort-imports" + ], "importOrderSortSpecifiers": true }, "eslintConfig": { @@ -217,4 +221,4 @@ ] } } -} +} \ No newline at end of file From 52f5e9af96f57b5f28e497e8c689376897bb55cb Mon Sep 17 00:00:00 2001 From: ajnart Date: Wed, 26 Jul 2023 13:16:37 +0900 Subject: [PATCH 2/8] =?UTF-8?q?=F0=9F=90=B3=20Edit=20docker=20shortcuts=20?= =?UTF-8?q?inside=20`package.json`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8f71d3a97..182c5840b 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "test:ui": "vitest --ui", "test:run": "vitest run", "test:coverage": "vitest run --coverage", - "docker:build": "docker build . -t homarr:dev", + "docker:build": "turbo build && docker build . -t homarr:dev", "docker:start": "docker run --env-file ./.env -p 7575:7575 homarr:dev " }, "dependencies": { From d4aa3e4e07caabefb455a9a6da25e1660cfdd695 Mon Sep 17 00:00:00 2001 From: ajnart Date: Wed, 26 Jul 2023 13:17:00 +0900 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=90=9B=20Fix=20edit=20mode=20password?= =?UTF-8?q?=20working=20with=20lowercase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/api/configs/tryPassword.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages/api/configs/tryPassword.tsx b/src/pages/api/configs/tryPassword.tsx index 1632985ab..6e6b98670 100644 --- a/src/pages/api/configs/tryPassword.tsx +++ b/src/pages/api/configs/tryPassword.tsx @@ -5,8 +5,12 @@ function Post(req: NextApiRequest, res: NextApiResponse) { const { tried, type = 'password' } = req.body; // If the type of password is "edit", we run this branch to check the edit password if (type === 'edit') { - if (tried === process.env.EDIT_MODE_PASSWORD) { - process.env.DISABLE_EDIT_MODE = process.env.DISABLE_EDIT_MODE === 'true' ? 'false' : 'true'; + if ((tried === process.env.EDIT_MODE_PASSWORD) !== undefined) { + if (process.env.DISABLE_EDIT_MODE?.toLowerCase() === 'true') { + process.env.DISABLE_EDIT_MODE = 'false'; + } else { + process.env.DISABLE_EDIT_MODE = 'true'; + } return res.status(200).json({ success: true, }); From 2b9de2405e918c498b34cb00e6f112eb47f5aff8 Mon Sep 17 00:00:00 2001 From: Tagaishi Date: Mon, 31 Jul 2023 00:20:23 +0200 Subject: [PATCH 4/8] =?UTF-8?q?=F0=9F=92=84=20Elements=20stretch=20to=20fi?= =?UTF-8?q?t=20whole=20widget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../media-requests/MediaRequestStatsTile.tsx | 82 +++++++++++-------- 1 file changed, 47 insertions(+), 35 deletions(-) diff --git a/src/widgets/media-requests/MediaRequestStatsTile.tsx b/src/widgets/media-requests/MediaRequestStatsTile.tsx index fd81d8f0a..63b9c5498 100644 --- a/src/widgets/media-requests/MediaRequestStatsTile.tsx +++ b/src/widgets/media-requests/MediaRequestStatsTile.tsx @@ -1,4 +1,4 @@ -import { Card, Center, Flex, Stack, Text } from '@mantine/core'; +import { Box, Card, createStyles, Flex, FlexProps, Stack, Text } from '@mantine/core'; import { IconChartBar } from '@tabler/icons-react'; import { useTranslation } from 'next-i18next'; @@ -11,14 +11,23 @@ import { MediaRequestStatus } from './media-request-types'; const definition = defineWidget({ id: 'media-requests-stats', icon: IconChartBar, - options: {}, - component: MediaRequestStatsTile, + options: { + direction: { + type: 'select', + defaultValue: 'row', + data: [ + { label: 'Horizontal', value: 'horizontal' }, + { label: 'Vertical', value: 'vertical' }, + ], + }, + }, gridstack: { minWidth: 1, - minHeight: 2, + minHeight: 1, maxWidth: 12, maxHeight: 12, }, + component: MediaRequestStatsTile, }); export type MediaRequestStatsWidget = IWidget<(typeof definition)['id'], typeof definition>; @@ -36,41 +45,44 @@ function MediaRequestStatsTile({ widget }: MediaRequestStatsWidgetProps) { } return ( - - -
- - - {data.filter((x) => x.status === MediaRequestStatus.PendingApproval).length} - - - {t('stats.pending')} - - -
+ + + + + {data.filter((x) => x.status === MediaRequestStatus.PendingApproval).length} + + + {t('stats.pending')} + + - -
- - {data.filter((x) => x.type === 'tv').length} - - {t('stats.tvRequests')} - - -
+ + + + {data.filter((x) => x.type === 'tv').length} + + + {t('stats.tvRequests')} + + - -
- - {data.filter((x) => x.type === 'movie').length} - - {t('stats.movieRequests')} - - -
+ + + + {data.filter((x) => x.type === 'movie').length} + + + {t('stats.movieRequests')} + +
); } -export default definition; +export default definition; \ No newline at end of file From 3b95b8d8c8e60ac27b86805698c03d73638fe67c Mon Sep 17 00:00:00 2001 From: Tagaishi Date: Mon, 31 Jul 2023 00:32:11 +0200 Subject: [PATCH 5/8] =?UTF-8?q?=F0=9F=A4=A1=20Forgot=20label=20+=20touch?= =?UTF-8?q?=20up?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/locales/en/modules/media-requests-stats.json | 5 ++++- src/widgets/media-requests/MediaRequestStatsTile.tsx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/public/locales/en/modules/media-requests-stats.json b/public/locales/en/modules/media-requests-stats.json index 3c7d10090..a06a52860 100644 --- a/public/locales/en/modules/media-requests-stats.json +++ b/public/locales/en/modules/media-requests-stats.json @@ -3,7 +3,10 @@ "name": "Media request stats", "description": "Statistics about your media requests", "settings": { - "title": "Media requests stats" + "title": "Media requests stats", + "direction": { + "label": "Direction of the layout." + } } }, "stats": { diff --git a/src/widgets/media-requests/MediaRequestStatsTile.tsx b/src/widgets/media-requests/MediaRequestStatsTile.tsx index 63b9c5498..12e64c1d1 100644 --- a/src/widgets/media-requests/MediaRequestStatsTile.tsx +++ b/src/widgets/media-requests/MediaRequestStatsTile.tsx @@ -14,7 +14,7 @@ const definition = defineWidget({ options: { direction: { type: 'select', - defaultValue: 'row', + defaultValue: 'horizontal', data: [ { label: 'Horizontal', value: 'horizontal' }, { label: 'Vertical', value: 'vertical' }, From 6c1909e627cb41657702f5eab25d2a7a79f56f4d Mon Sep 17 00:00:00 2001 From: Tagaishi Date: Mon, 31 Jul 2023 01:13:36 +0200 Subject: [PATCH 6/8] =?UTF-8?q?=F0=9F=8E=A8=20Common=20card=20component=20?= =?UTF-8?q?+=20flex=20direction=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../media-requests/MediaRequestStatsTile.tsx | 71 ++++++++++--------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/src/widgets/media-requests/MediaRequestStatsTile.tsx b/src/widgets/media-requests/MediaRequestStatsTile.tsx index 12e64c1d1..256d66978 100644 --- a/src/widgets/media-requests/MediaRequestStatsTile.tsx +++ b/src/widgets/media-requests/MediaRequestStatsTile.tsx @@ -7,6 +7,7 @@ import { WidgetLoading } from '../loading'; import { IWidget } from '../widgets'; import { useMediaRequestQuery } from './media-request-query'; import { MediaRequestStatus } from './media-request-types'; +import { string } from 'zod'; const definition = defineWidget({ id: 'media-requests-stats', @@ -14,10 +15,10 @@ const definition = defineWidget({ options: { direction: { type: 'select', - defaultValue: 'horizontal', + defaultValue: 'row' as 'row' | 'column', data: [ - { label: 'Horizontal', value: 'horizontal' }, - { label: 'Vertical', value: 'vertical' }, + { label: 'Horizontal', value: 'row' }, + { label: 'Vertical', value: 'column' }, ], }, }, @@ -49,40 +50,42 @@ function MediaRequestStatsTile({ widget }: MediaRequestStatsWidgetProps) { w="100%" h="100%" gap="md" - direction={ widget.properties.direction != 'vertical' ? 'row' : 'column' } + direction={ widget.properties.direction?? 'row' } > - - - - {data.filter((x) => x.status === MediaRequestStatus.PendingApproval).length} - - - {t('stats.pending')} - - - - - - - {data.filter((x) => x.type === 'tv').length} - - - {t('stats.tvRequests')} - - - - - - - {data.filter((x) => x.type === 'movie').length} - - - {t('stats.movieRequests')} - - - + x.status === MediaRequestStatus.PendingApproval).length} + label={t('stats.pending')} + /> + x.type === 'tv').length} + label={t('stats.tvRequests')} + /> + x.type === 'movie').length} + label={t('stats.movieRequests')} + />
); } +interface StatCardProps { + number: number; + label: string; +} + +const StatCard = ({ number, label }: StatCardProps) => { + return ( + + + + {number} + + + {label} + + + + ); +}; + export default definition; \ No newline at end of file From 837b5892703b257f637fc8edc5442d01432d3ab5 Mon Sep 17 00:00:00 2001 From: Tagaishi Date: Mon, 31 Jul 2023 01:15:40 +0200 Subject: [PATCH 7/8] =?UTF-8?q?=E2=9A=B0=EF=B8=8F=20removed=20unused=20imp?= =?UTF-8?q?orts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widgets/media-requests/MediaRequestStatsTile.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/widgets/media-requests/MediaRequestStatsTile.tsx b/src/widgets/media-requests/MediaRequestStatsTile.tsx index 256d66978..2af61d3e3 100644 --- a/src/widgets/media-requests/MediaRequestStatsTile.tsx +++ b/src/widgets/media-requests/MediaRequestStatsTile.tsx @@ -1,4 +1,4 @@ -import { Box, Card, createStyles, Flex, FlexProps, Stack, Text } from '@mantine/core'; +import { Card, Flex, Stack, Text } from '@mantine/core'; import { IconChartBar } from '@tabler/icons-react'; import { useTranslation } from 'next-i18next'; @@ -7,7 +7,6 @@ import { WidgetLoading } from '../loading'; import { IWidget } from '../widgets'; import { useMediaRequestQuery } from './media-request-query'; import { MediaRequestStatus } from './media-request-types'; -import { string } from 'zod'; const definition = defineWidget({ id: 'media-requests-stats', From d9c0d8d021812fd92b38315cccf285c5e68eba34 Mon Sep 17 00:00:00 2001 From: ajnart Date: Tue, 1 Aug 2023 18:38:13 +0900 Subject: [PATCH 8/8] Fix values for ``DOCKER_HOST`` --- src/server/api/routers/docker/DockerSingleton.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/server/api/routers/docker/DockerSingleton.ts b/src/server/api/routers/docker/DockerSingleton.ts index 9694059be..7ddc9cc6e 100644 --- a/src/server/api/routers/docker/DockerSingleton.ts +++ b/src/server/api/routers/docker/DockerSingleton.ts @@ -9,12 +9,7 @@ export default class DockerSingleton extends Docker { public static getInstance(): DockerSingleton { if (!DockerSingleton.dockerInstance) { - DockerSingleton.dockerInstance = new Docker({ - // If env variable DOCKER_HOST is not set, it will use the default socket - ...(process.env.DOCKER_HOST && { host: process.env.DOCKER_HOST }), - // Same thing for docker port - ...(process.env.DOCKER_PORT && { port: process.env.DOCKER_PORT }), - }); + DockerSingleton.dockerInstance = new Docker(); } return DockerSingleton.dockerInstance; }