mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-16 18:26:20 +01:00
✨ Add common troubleshooting prompt on button
This commit is contained in:
@@ -13,7 +13,18 @@
|
|||||||
},
|
},
|
||||||
"internalAddress": {
|
"internalAddress": {
|
||||||
"label": "Internal address",
|
"label": "Internal address",
|
||||||
"description": "Internal IP-address of the app."
|
"description": "Internal IP-address of the app.",
|
||||||
|
"troubleshoot": {
|
||||||
|
"label": "Common Troubleshooting",
|
||||||
|
"header": "This is a list of commonly made mistake and troubleshooting:",
|
||||||
|
"lines": {
|
||||||
|
"nothingAfterPort": "You should, in most if not all cases, not input anything after the port, even the '/admin' for pihole.",
|
||||||
|
"protocolCheck": "Always make sure that the URL is preceded by http or https, and to make sure you are using the right one.",
|
||||||
|
"iframe": "When it comes to iframes, those should always be using the same protocol (http/s) as Homarr.",
|
||||||
|
"clearCache": "Some informations are registered in cache, so an integration might not work unless you clear the cache in Homarr's general options."
|
||||||
|
},
|
||||||
|
"footer": "For more troubleshooting, reach out on our {{discord}}."
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"externalAddress": {
|
"externalAddress": {
|
||||||
"label": "External address",
|
"label": "External address",
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { Stack, Tabs, Text, TextInput } from '@mantine/core';
|
import { Anchor, Button, Card, Collapse, Group, Stack, Tabs, Text, TextInput } from '@mantine/core';
|
||||||
import { UseFormReturnType } from '@mantine/form';
|
import { UseFormReturnType } from '@mantine/form';
|
||||||
import { IconClick, IconCursorText, IconLink } from '@tabler/icons-react';
|
import { useDisclosure } from '@mantine/hooks';
|
||||||
|
import { IconAlertCircle, IconClick, IconCursorText, IconLink } from '@tabler/icons-react';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
|
|
||||||
import { AppType } from '~/types/app';
|
import { AppType } from '~/types/app';
|
||||||
|
|
||||||
import { EditAppModalTab } from '../type';
|
import { EditAppModalTab } from '../type';
|
||||||
|
|
||||||
interface GeneralTabProps {
|
interface GeneralTabProps {
|
||||||
@@ -13,6 +14,16 @@ interface GeneralTabProps {
|
|||||||
|
|
||||||
export const GeneralTab = ({ form, openTab }: GeneralTabProps) => {
|
export const GeneralTab = ({ form, openTab }: GeneralTabProps) => {
|
||||||
const { t } = useTranslation('layout/modals/add-app');
|
const { t } = useTranslation('layout/modals/add-app');
|
||||||
|
|
||||||
|
const [opened, { toggle }] = useDisclosure(false);
|
||||||
|
|
||||||
|
const commonMistakes = [
|
||||||
|
t('general.internalAddress.troubleshoot.lines.nothingAfterPort'),
|
||||||
|
t('general.internalAddress.troubleshoot.lines.protocolCheck'),
|
||||||
|
t('general.internalAddress.troubleshoot.lines.iframe'),
|
||||||
|
t('general.internalAddress.troubleshoot.lines.clearCache'),
|
||||||
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tabs.Panel value="general" pt="sm">
|
<Tabs.Panel value="general" pt="sm">
|
||||||
<Stack spacing="xs">
|
<Stack spacing="xs">
|
||||||
@@ -46,12 +57,39 @@ export const GeneralTab = ({ form, openTab }: GeneralTabProps) => {
|
|||||||
{...form.getInputProps('behaviour.externalUrl')}
|
{...form.getInputProps('behaviour.externalUrl')}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Group position="right" mt={22}>
|
||||||
|
<Button rightIcon={<IconAlertCircle />} onClick={toggle}>
|
||||||
|
{t('general.internalAddress.troubleshoot.label')}
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
|
||||||
|
<Collapse in={opened}>
|
||||||
|
<Card withBorder>
|
||||||
|
<Text>{t('general.internalAddress.troubleshoot.header')}</Text>
|
||||||
|
{commonMistakes.map((value: string, key: number) => {
|
||||||
|
return (
|
||||||
|
<Group key={key} display="flex" style={{ alignItems: 'start' }}>
|
||||||
|
<Text>•</Text>
|
||||||
|
<Text style={{ flex: '1' }}>{value}</Text>
|
||||||
|
</Group>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
<Text>
|
||||||
|
{t('general.internalAddress.troubleshoot.footer').split('{{discord}}')[0]}
|
||||||
|
<Anchor href="https://discord.gg/aCsmEV5RgA" target="_blank">
|
||||||
|
Discord
|
||||||
|
</Anchor>
|
||||||
|
{t('general.internalAddress.troubleshoot.footer').split('{{discord}}')[1]}
|
||||||
|
</Text>
|
||||||
|
</Card>
|
||||||
|
</Collapse>
|
||||||
|
|
||||||
{!form.values.behaviour.externalUrl.startsWith('https://') &&
|
{!form.values.behaviour.externalUrl.startsWith('https://') &&
|
||||||
!form.values.behaviour.externalUrl.startsWith('http://') && (
|
!form.values.behaviour.externalUrl.startsWith('http://') && (
|
||||||
<Text color="red" mt="sm" size="sm">
|
<Text color="red" mt="sm" size="sm">
|
||||||
{t('behaviour.customProtocolWarning')}
|
{t('behaviour.customProtocolWarning')}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Tabs.Panel>
|
</Tabs.Panel>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user