2022-12-11 19:32:51 +01:00
|
|
|
import { Tabs, Text, TextInput } from '@mantine/core';
|
2022-12-04 21:19:40 +01:00
|
|
|
import { UseFormReturnType } from '@mantine/form';
|
|
|
|
|
import { IconCursorText, IconLink } from '@tabler/icons';
|
|
|
|
|
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-04 21:19:40 +01:00
|
|
|
const { t } = useTranslation('');
|
|
|
|
|
return (
|
|
|
|
|
<Tabs.Panel value="general" pt="lg">
|
|
|
|
|
<TextInput
|
|
|
|
|
icon={<IconCursorText size={16} />}
|
2022-12-18 22:27:01 +01:00
|
|
|
label="App name"
|
|
|
|
|
description="Used for displaying the app on the dashboard"
|
|
|
|
|
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-04 21:19:40 +01:00
|
|
|
{...form.getInputProps('name')}
|
|
|
|
|
/>
|
|
|
|
|
<TextInput
|
|
|
|
|
icon={<IconLink size={16} />}
|
2022-12-18 22:27:01 +01:00
|
|
|
label="App url"
|
2022-12-06 20:48:35 +01:00
|
|
|
description={
|
2022-12-11 00:03:28 +09:00
|
|
|
<Text>
|
2022-12-18 22:27:01 +01:00
|
|
|
URL that will be opened when clicking on the app. Can be overwritten using
|
2022-12-11 00:03:28 +09:00
|
|
|
<Text
|
|
|
|
|
onClick={() => openTab('behaviour')}
|
|
|
|
|
variant="link"
|
|
|
|
|
span
|
|
|
|
|
style={{
|
|
|
|
|
cursor: 'pointer',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{' '}
|
|
|
|
|
on click URL{' '}
|
2022-12-06 20:48:35 +01:00
|
|
|
</Text>
|
2022-12-11 00:03:28 +09:00
|
|
|
when using external URLs to enhance security.
|
|
|
|
|
</Text>
|
2022-12-06 20:48:35 +01:00
|
|
|
}
|
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-04 21:19:40 +01:00
|
|
|
{...form.getInputProps('url')}
|
|
|
|
|
/>
|
|
|
|
|
</Tabs.Panel>
|
|
|
|
|
);
|
|
|
|
|
};
|