mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-29 21:51:59 +02:00
FormattedError
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { Banner, Button, InlineCode } from '@yaakapp-internal/ui';
|
||||
import type { ErrorInfo, ReactNode } from 'react';
|
||||
import { Component, useEffect } from 'react';
|
||||
import { showDialog } from '../lib/dialog';
|
||||
import { Banner, InlineCode } from '@yaakapp-internal/ui';
|
||||
import { Button } from './core/Button';
|
||||
import RouteError from './RouteError';
|
||||
|
||||
interface ErrorBoundaryProps {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { linter } from '@codemirror/lint';
|
||||
import type { EditorView } from '@codemirror/view';
|
||||
import { jsoncLanguage } from '@shopify/lang-jsonc';
|
||||
import type { GrpcRequest } from '@yaakapp-internal/models';
|
||||
import { InlineCode, VStack } from '@yaakapp-internal/ui';
|
||||
import { FormattedError, InlineCode, VStack } from '@yaakapp-internal/ui';
|
||||
import classNames from 'classnames';
|
||||
import {
|
||||
handleRefresh,
|
||||
@@ -19,7 +19,6 @@ import { pluralizeCount } from '../lib/pluralize';
|
||||
import { Button } from './core/Button';
|
||||
import type { EditorProps } from './core/Editor/Editor';
|
||||
import { Editor } from './core/Editor/LazyEditor';
|
||||
import { FormattedError } from './core/FormattedError';
|
||||
import { GrpcProtoSelectionDialog } from './GrpcProtoSelectionDialog';
|
||||
|
||||
type Props = Pick<EditorProps, 'heightMode' | 'onChange' | 'className' | 'forceUpdateKey'> & {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { Heading, VStack } from '@yaakapp-internal/ui';
|
||||
import { Button } from './core/Button';
|
||||
import { Button, FormattedError, Heading, VStack } from '@yaakapp-internal/ui';
|
||||
import { DetailsBanner } from './core/DetailsBanner';
|
||||
import { FormattedError } from './core/FormattedError';
|
||||
|
||||
export default function RouteError({ error }: { error: unknown }) {
|
||||
console.log('Error', error);
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import classNames from 'classnames';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
interface Props {
|
||||
children: ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function FormattedError({ children, className }: Props) {
|
||||
return (
|
||||
<pre
|
||||
className={classNames(
|
||||
className,
|
||||
'cursor-text select-auto',
|
||||
'[&_*]:cursor-text [&_*]:select-auto',
|
||||
'font-mono text-sm w-full bg-surface-highlight p-3 rounded',
|
||||
'whitespace-pre-wrap border border-danger border-dashed overflow-x-auto',
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</pre>
|
||||
);
|
||||
}
|
||||
@@ -11,8 +11,7 @@ import type { DropdownItem } from '../core/Dropdown';
|
||||
import { Dropdown } from '../core/Dropdown';
|
||||
import type { EditorProps } from '../core/Editor/Editor';
|
||||
import { Editor } from '../core/Editor/LazyEditor';
|
||||
import { FormattedError } from '../core/FormattedError';
|
||||
import { Banner, Icon } from '@yaakapp-internal/ui';
|
||||
import { Banner, FormattedError, Icon } from '@yaakapp-internal/ui';
|
||||
import { Separator } from '../core/Separator';
|
||||
import { tryFormatGraphql } from '../../lib/formatters';
|
||||
import { showGraphQLDocExplorerAtom } from './graphqlAtoms';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { BatchUpsertResult } from '@yaakapp-internal/models';
|
||||
import { VStack } from '@yaakapp-internal/ui';
|
||||
import { FormattedError, VStack } from '@yaakapp-internal/ui';
|
||||
import { Button } from '../components/core/Button';
|
||||
import { FormattedError } from '../components/core/FormattedError';
|
||||
import { ImportDataDialog } from '../components/ImportDataDialog';
|
||||
import { activeWorkspaceAtom } from '../hooks/useActiveWorkspace';
|
||||
import { createFastMutation } from '../hooks/useFastMutation';
|
||||
|
||||
Reference in New Issue
Block a user