2022-12-20 11:34:07 +09:00
|
|
|
import { Tabs, TextInput } from '@mantine/core';
|
2022-12-04 21:19:40 +01:00
|
|
|
import { UseFormReturnType } from '@mantine/form';
|
2022-12-20 11:34:07 +09:00
|
|
|
import { IconClick, IconCursorText, IconLink } from '@tabler/icons';
|
2022-12-04 21:19:40 +01:00
|
|
|
import { useTranslation } from 'next-i18next';
|
2022-12-18 22:27:01 +01:00
|
|
|
import { AppType } from '../../../../../../types/app';
|
|
|
|
|
import { EditAppModalTab } from '../type';
|
2022-12-04 21:19:40 +01:00
|
|
|
|
|
|
|
|
interface GeneralTabProps {
|
2022-12-18 22:27:01 +01:00
|
|
|
form: UseFormReturnType<AppType, (values: AppType) => AppType>;
|
|
|
|
|
openTab: (tab: EditAppModalTab) => void;
|
2022-12-04 21:19:40 +01:00
|
|
|
}
|
|
|
|
|
|
2022-12-06 20:48:35 +01:00
|
|
|
export const GeneralTab = ({ form, openTab }: GeneralTabProps) => {
|
2022-12-20 11:34:07 +09:00
|
|
|
const { t } = useTranslation('layout/modals/add-app');
|
2022-12-04 21:19:40 +01:00
|
|
|
return (
|
2022-12-20 11:34:07 +09:00
|
|
|
<Tabs.Panel value="general" pt="sm">
|
2022-12-04 21:19:40 +01:00
|
|
|
<TextInput
|
|
|
|
|
icon={<IconCursorText size={16} />}
|
2022-12-20 11:34:07 +09:00
|
|
|
label={t('general.appname.label')}
|
|
|
|
|
description={t('general.appname.description')}
|
2022-12-18 22:27:01 +01:00
|
|
|
placeholder="My example app"
|
2022-12-04 21:19:40 +01:00
|
|
|
variant="default"
|
|
|
|
|
mb="md"
|
2022-12-06 20:48:35 +01:00
|
|
|
withAsterisk
|
2022-12-20 11:34:07 +09:00
|
|
|
required
|
2022-12-04 21:19:40 +01:00
|
|
|
{...form.getInputProps('name')}
|
|
|
|
|
/>
|
|
|
|
|
<TextInput
|
|
|
|
|
icon={<IconLink size={16} />}
|
2022-12-20 11:34:07 +09:00
|
|
|
label={t('general.internalAddress.label')}
|
|
|
|
|
description={t('general.internalAddress.description')}
|
2022-12-04 21:19:40 +01:00
|
|
|
placeholder="https://google.com"
|
|
|
|
|
variant="default"
|
2022-12-06 20:48:35 +01:00
|
|
|
withAsterisk
|
2022-12-20 11:34:07 +09:00
|
|
|
required
|
2022-12-04 21:19:40 +01:00
|
|
|
{...form.getInputProps('url')}
|
2022-12-20 11:34:07 +09:00
|
|
|
onChange={(e) => {
|
|
|
|
|
form.setFieldValue('behaviour.onClickUrl', e.target.value);
|
|
|
|
|
form.setFieldValue('url', e.target.value);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<TextInput
|
|
|
|
|
icon={<IconClick size={16} />}
|
|
|
|
|
label={t('general.externalAddress.label')}
|
|
|
|
|
description={t('general.externalAddress.description')}
|
|
|
|
|
placeholder="https://homarr.mywebsite.com/"
|
|
|
|
|
variant="default"
|
|
|
|
|
mb="md"
|
|
|
|
|
{...form.getInputProps('behaviour.onClickUrl')}
|
2022-12-04 21:19:40 +01:00
|
|
|
/>
|
|
|
|
|
</Tabs.Panel>
|
|
|
|
|
);
|
|
|
|
|
};
|