Skip to content

Commit

Permalink
Add error reporting to error modal (#777)
Browse files Browse the repository at this point in the history
* Add error reporting to error modal

* Update GitHub link for filing issue

* Fix GH workflow for dev tool app
  • Loading branch information
rygine authored Jan 10, 2025
1 parent b5c6209 commit a538d11
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/noop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- "!.github/workflows/content-types.yml"
- ".vscode/**"
- ".yarn/**"
- "apps/xmtp.chat/**"
- "*"
- "!.node-version"
- "!.nvmrc"
Expand Down
18 changes: 15 additions & 3 deletions apps/xmtp.chat/src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
Button,
Group,
Modal,
ScrollArea,
Stack,
Text,
Title,
} from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
Expand All @@ -14,6 +14,7 @@ import { useClient } from "../hooks/useClient";
import classes from "./App.module.css";
import { AppFooter } from "./AppFooter";
import { AppHeader } from "./AppHeader";
import { CodeWithCopy } from "./CodeWithCopy";
import { Main } from "./Main";
import { Navbar } from "./Navbar";

Expand Down Expand Up @@ -74,8 +75,19 @@ export const App: React.FC = () => {
centered>
<Stack gap="md">
<Title order={4}>Application error</Title>
<Text>{unhandledRejectionError}</Text>
<Group justify="flex-end">
<ScrollArea>
<CodeWithCopy
code={JSON.stringify(unhandledRejectionError, null, 2)}
/>
</ScrollArea>
<Group justify="space-between">
<Button
variant="default"
component="a"
href="https://github.com/xmtp/xmtp-js/issues/new/choose"
target="_blank">
Report issue
</Button>
<Button
onClick={() => {
setUnhandledRejectionError(null);
Expand Down
2 changes: 2 additions & 0 deletions apps/xmtp.chat/src/components/CodeWithCopy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const CodeWithCopy: React.FC<CodeWithCopyProps> = ({ code }) => {
return (
<Box pos="relative">
<Code
p="md"
pt="xl"
block
maw="calc(var(--modal-size) - calc(var(--mantine-spacing-md) * 2))">
{code}
Expand Down
2 changes: 1 addition & 1 deletion apps/xmtp.chat/src/components/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const Welcome = () => {
<Text>
Your feedback is incredibly important to the success of this tool. If
you find any bugs or have suggestions, please let us know by{" "}
<Anchor href="https://github.com/xmtp/xmtp-chat/issues">
<Anchor href="https://github.com/xmtp/xmtp-js/issues/new/choose">
filing an issue
</Anchor>{" "}
on GitHub.
Expand Down

0 comments on commit a538d11

Please sign in to comment.