use support URL for non-local

This commit is contained in:
Mary Hipp 2024-05-22 10:54:54 -04:00 committed by psychedelicious
parent 6259ac0bec
commit dd1d5bdb25

View File

@ -1,4 +1,5 @@
import { Button, Flex, Heading, Link, Text } from '@invoke-ai/ui-library'; import { Button, Flex, Heading, Link, Text } from '@invoke-ai/ui-library';
import { useAppSelector } from 'app/store/storeHooks';
import { toast } from 'features/toast/toast'; import { toast } from 'features/toast/toast';
import newGithubIssueUrl from 'new-github-issue-url'; import newGithubIssueUrl from 'new-github-issue-url';
import { memo, useCallback, useMemo } from 'react'; import { memo, useCallback, useMemo } from 'react';
@ -13,6 +14,7 @@ type Props = {
const AppErrorBoundaryFallback = ({ error, resetErrorBoundary }: Props) => { const AppErrorBoundaryFallback = ({ error, resetErrorBoundary }: Props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const isLocal = useAppSelector((s) => s.config.isLocal);
const handleCopy = useCallback(() => { const handleCopy = useCallback(() => {
const text = JSON.stringify(serializeError(error), null, 2); const text = JSON.stringify(serializeError(error), null, 2);
@ -23,16 +25,19 @@ const AppErrorBoundaryFallback = ({ error, resetErrorBoundary }: Props) => {
}); });
}, [error, t]); }, [error, t]);
const url = useMemo( const url = useMemo(() => {
() => if (isLocal) {
newGithubIssueUrl({ return newGithubIssueUrl({
user: 'invoke-ai', user: 'invoke-ai',
repo: 'InvokeAI', repo: 'InvokeAI',
template: 'BUG_REPORT.yml', template: 'BUG_REPORT.yml',
title: `[bug]: ${error.name}: ${error.message}`, title: `[bug]: ${error.name}: ${error.message}`,
}), });
[error.message, error.name] } else {
); return 'https://support.invoke.ai/support/tickets/new';
}
}, [error.message, error.name, isLocal]);
return ( return (
<Flex layerStyle="body" w="100vw" h="100vh" alignItems="center" justifyContent="center" p={4}> <Flex layerStyle="body" w="100vw" h="100vh" alignItems="center" justifyContent="center" p={4}>
<Flex layerStyle="first" flexDir="column" borderRadius="base" justifyContent="center" gap={8} p={16}> <Flex layerStyle="first" flexDir="column" borderRadius="base" justifyContent="center" gap={8} p={16}>