|
| 1 | +<script lang="ts"> |
| 2 | + import { FlexWrapper, Icon, Space, Button, toast, LinkButton } from "@davidnet/svelte-ui"; |
| 3 | + import { browser } from "$app/environment"; |
| 4 | + import { tick } from "svelte"; |
| 5 | +
|
| 6 | + export let correlationID = "Unknown"; |
| 7 | + export let pageName = "Unknown"; |
| 8 | + export let errorMSG = "Unknown"; |
| 9 | +
|
| 10 | + async function copyToClipboard() { |
| 11 | + if (!browser) return; |
| 12 | +
|
| 13 | + try { |
| 14 | + const clipboardText = `DN_Account |
| 15 | +Page: ${pageName} |
| 16 | +Message: ${errorMSG} |
| 17 | +CorrelationID: ${correlationID} |
| 18 | +Date: ${new Date()}`; |
| 19 | +
|
| 20 | + await navigator.clipboard.writeText(clipboardText); |
| 21 | + await tick(); |
| 22 | + toast({ |
| 23 | + title: "Error copied!", |
| 24 | + icon: "content_copy", |
| 25 | + appearance: "success", |
| 26 | + position: "bottom-left", |
| 27 | + autoDismiss: 2000 |
| 28 | + }); |
| 29 | + } catch { |
| 30 | + toast({ |
| 31 | + title: "Copy failed!", |
| 32 | + desc: "We couldn't access your clipboard.", |
| 33 | + icon: "content_copy", |
| 34 | + appearance: "danger", |
| 35 | + position: "bottom-left", |
| 36 | + autoDismiss: 5000 |
| 37 | + }); |
| 38 | + } |
| 39 | + } |
| 40 | +</script> |
| 41 | + |
| 42 | +<h1 style="text-align: center; font-size: 1.8rem;">{pageName}</h1> |
| 43 | +<FlexWrapper height="100%" width="100%"> |
| 44 | + <Icon icon="crisis_alert" size="100px;" color="var(--token-color-text-warning)" /> |
| 45 | + <h1 style="text-align: center;">Error</h1> |
| 46 | + <p role="alert" aria-live="assertive" style="text-align: center;">{errorMSG}</p> |
| 47 | + <p style="font-weight: bold;">CorrelationID:</p> |
| 48 | + <span style="text-align:center; font-size: 0.8rem;">{correlationID}</span> |
| 49 | + <Space height="var(--token-space-6)" /> |
| 50 | + <Button |
| 51 | + onClick={() => { |
| 52 | + history.back(); |
| 53 | + }}>Navigate back</Button |
| 54 | + > |
| 55 | + <Space height="var(--token-space-4)" /> |
| 56 | + <Button |
| 57 | + appearance="primary" |
| 58 | + onClick={() => { |
| 59 | + window.location.reload(); |
| 60 | + }}>Reset</Button |
| 61 | + > |
| 62 | + <Space height="var(--token-space-4)" /> |
| 63 | + <Button onClick={copyToClipboard} appearance="discover">Copy Error</Button> |
| 64 | + <Space height="var(--token-space-4)" /> |
| 65 | + <LinkButton href="mailto:contact@davidnet.net">Need help?</LinkButton> |
| 66 | +</FlexWrapper> |
0 commit comments