Files
Homarr/src/components/Dashboard/Modals/EditAppModal/Tabs/IntegrationTab/IntegrationTab.tsx

39 lines
1.4 KiB
TypeScript
Raw Normal View History

2022-12-04 21:19:40 +01:00
import { Alert, Divider, Tabs, Text } from '@mantine/core';
import { UseFormReturnType } from '@mantine/form';
import { IconAlertTriangle } from '@tabler/icons-react';
2022-12-20 11:34:07 +09:00
import { Trans, useTranslation } from 'next-i18next';
2023-07-21 18:08:40 +09:00
2023-09-03 16:23:40 +02:00
import { AppType } from '~/types/app';
2022-12-04 21:19:40 +01:00
import { IntegrationSelector } from './Components/InputElements/IntegrationSelector';
import { IntegrationOptionsRenderer } from './Components/IntegrationOptionsRenderer/IntegrationOptionsRenderer';
interface IntegrationTabProps {
form: UseFormReturnType<AppType, (values: AppType) => AppType>;
2022-12-04 21:19:40 +01:00
}
export const IntegrationTab = ({ form }: IntegrationTabProps) => {
2022-12-20 11:34:07 +09:00
const { t } = useTranslation('layout/modals/add-app');
2022-12-17 00:28:46 +09:00
const hasIntegrationSelected = form.values.integration?.type;
2022-12-04 21:19:40 +01:00
return (
<Tabs.Panel value="integration" pt="lg">
<IntegrationSelector form={form} />
{hasIntegrationSelected && (
<>
2022-12-20 11:45:33 +09:00
<Divider label={t('integration.type.label')} labelPosition="center" mt="xl" mb="md" />
<Text size="sm" color="dimmed" mb="lg">
2022-12-20 11:34:07 +09:00
{t('integration.secrets.description')}
</Text>
2022-12-04 21:19:40 +01:00
<IntegrationOptionsRenderer form={form} />
<Alert icon={<IconAlertTriangle />} color="yellow">
<Text>
<Trans i18nKey="layout/modals/add-app:integration.secrets.warning" />
2022-12-04 21:19:40 +01:00
</Text>
</Alert>
</>
)}
</Tabs.Panel>
);
};