feat: remove unused appshelf components

This commit is contained in:
Manuel Ruwe
2022-12-08 22:17:33 +01:00
parent afbf2d2d2f
commit b6bf6cc86b
12 changed files with 152 additions and 581 deletions

View File

@@ -16,9 +16,11 @@ import Dockerode from 'dockerode';
import { useTranslation } from 'next-i18next';
import { useState } from 'react';
import { TFunction } from 'react-i18next';
import { AddAppShelfItemForm } from '../../components/AppShelf/AddAppShelfItem';
import { v4 as uuidv4 } from 'uuid';
import { tryMatchService } from '../../tools/addToHomarr';
import { openContextModalGeneric } from '../../tools/mantineModalManagerExtensions';
import { useConfig } from '../../tools/state';
import { ServiceType } from '../../types/service';
let t: TFunction<'modules/docker', undefined>;
@@ -160,21 +162,40 @@ export default function ContainerActionBar({ selected, reload }: ContainerAction
radius="md"
disabled={selected.length === 0 || selected.length > 1}
onClick={() => {
openModal({
size: 'xl',
modalId: selected.at(0)!.Id,
radius: 'md',
title: t('actionBar.addService.title'),
zIndex: 500,
children: (
<AddAppShelfItemForm
setConfig={setConfig}
config={config}
setOpened={() => closeModal(selected.at(0)!.Id)}
message={t('actionBar.addService.message')}
{...tryMatchService(selected.at(0)!)}
/>
),
const containerUrl = `http://localhost:${selected[0].Ports[0].PublicPort}`;
openContextModalGeneric<{ service: ServiceType }>({
modal: 'editService',
innerProps: {
service: {
id: uuidv4(),
name: selected[0].Names[0],
url: containerUrl,
appearance: {
iconUrl: '/imgs/logo/logo.png', // TODO: find icon automatically
},
network: {
enabledStatusChecker: false,
okStatus: [],
},
behaviour: {
isOpeningNewTab: true,
onClickUrl: '',
},
area: {
type: 'wrapper', // TODO: Set the wrapper automatically
},
shape: {
location: {
x: 0,
y: 0,
},
size: {
height: 1,
width: 1,
},
},
},
},
});
}}
>

View File

@@ -20,7 +20,6 @@ import { NormalizedTorrent } from '@ctrl/shared-torrent';
import { useTranslation } from 'next-i18next';
import { IModule } from '../ModuleTypes';
import { useConfig } from '../../tools/state';
import { AddItemShelfButton } from '../../components/AppShelf/AddAppShelfItem';
import { useSetSafeInterval } from '../../tools/hooks/useSetSafeInterval';
import { humanFileSize } from '../../tools/humanFileSize';
@@ -93,7 +92,6 @@ export default function TorrentsComponent() {
<Title order={3}>{t('card.errors.noDownloadClients.title')}</Title>
<Group>
<Text>{t('card.errors.noDownloadClients.text')}</Text>
<AddItemShelfButton />
</Group>
</Stack>
);

View File

@@ -8,7 +8,6 @@ import { useTranslation } from 'next-i18next';
import { Datum, ResponsiveLine } from '@nivo/line';
import { useListState } from '@mantine/hooks';
import { showNotification } from '@mantine/notifications';
import { AddItemShelfButton } from '../../components/AppShelf/AddAppShelfItem';
import { useConfig } from '../../tools/state';
import { humanFileSize } from '../../tools/humanFileSize';
import { IModule } from '../ModuleTypes';
@@ -84,11 +83,6 @@ export default function TotalDownloadsComponent() {
<Group>
<Title order={4}>{t('card.errors.noDownloadClients.title')}</Title>
<div>
<AddItemShelfButton
style={{
float: 'inline-end',
}}
/>
{t('card.errors.noDownloadClients.text')}
</div>
</Group>

View File

@@ -22,7 +22,6 @@ import { UsenetHistoryList } from './UsenetHistoryList';
import { useGetServiceByType } from '../../tools/hooks/useGetServiceByType';
import { useGetUsenetInfo, usePauseUsenetQueue, useResumeUsenetQueue } from '../../tools/hooks/api';
import { humanFileSize } from '../../tools/humanFileSize';
import { AddItemShelfButton } from '../../components/AppShelf/AddAppShelfItem';
dayjs.extend(duration);
@@ -49,7 +48,6 @@ export const UsenetComponent: FunctionComponent = () => {
<Title order={3}>{t('card.errors.noDownloadClients.title')}</Title>
<Group>
<Text>{t('card.errors.noDownloadClients.text')}</Text>
<AddItemShelfButton />
</Group>
</Stack>
);