-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy patherror.vue
106 lines (86 loc) · 2.91 KB
/
error.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<script setup>
/** Services */
import { fetchHead } from "@/services/api/main"
import amp from "@/services/amp"
/** Components */
import ModalsManager from "@/components/modals/ModalsManager.vue"
import CommandMenu from "@/components/cmd/CommandMenu.vue"
/** UI */
import Button from "@/components/ui/Button.vue"
/** Store */
import { useAppStore } from "@/store/app"
const appStore = useAppStore()
const router = useRouter()
const error = useError()
onMounted(async () => {
const runtimeConfig = useRuntimeConfig()
amp.init(runtimeConfig.public.AMP)
const data = await fetchHead()
if (data) appStore.head = data
})
const handleBack = () => {
router.back()
}
const getGithubIssueLink = computed(() => {
let link = `https://github.com/celenium-io/celenium-interface/issues/new?labels=bug&title=[${error.value.statusCode}] ${
error.value.statusMessage || error.value.message
}`
if (error.value.statusCode === 500) link += `&body=Link: ${error.value.url}. ${error.value.statusMessage}`
return link
})
</script>
<template>
<CommandMenu :show="appStore.showCmd" />
<NuxtLayout>
<Flex v-if="error" direction="column" align="center" gap="24" wide :class="$style.wrapper">
<Icon name="search" size="24" color="tertiary" />
<Flex direction="column" align="center" gap="12">
<Text v-if="error?.statusCode == 404" size="16" weight="500" color="secondary">
{{ error?.statusMessage }}
</Text>
<Text v-else size="16" weight="500" color="secondary"> Unknown Error </Text>
<Text
v-if="error?.statusCode == 404"
size="13"
weight="500"
height="160"
color="tertiary"
align="center"
style="max-width: 340px"
>
It looks like this is an error and such a page does not exist. If there used to be a page at this address and it has
disappeared - please inform us.
</Text>
<Text v-else size="13" weight="500" height="140" color="tertiary" style="max-width: 340px"> Something went wrong </Text>
</Flex>
<Flex align="center" gap="12">
<Button v-if="error?.statusCode == 404" @click="handleBack" type="secondary" size="small" style="width: fit-content">
<Icon name="arrow-back" size="12" color="secondary" />
Go Back
</Button>
<Button v-else link="/" type="secondary" size="small" style="width: fit-content">
<Icon name="arrow-back" size="12" color="secondary" />
Back to Explorer
</Button>
<Text size="12" weight="500" color="tertiary">or</Text>
<Button :link="getGithubIssueLink" target="_blank" type="secondary" size="small" style="width: fit-content">
<Icon name="github" size="12" color="secondary" />
Create Issue
</Button>
</Flex>
</Flex>
<div id="tooltip" />
<div id="modal" />
<div id="dropdown" />
<div id="popover" />
<ModalsManager />
<Notifications />
</NuxtLayout>
</template>
<style module>
.wrapper {
max-width: calc(var(--base-width) + 48px);
padding: 0 24px;
margin-top: 120px;
}
</style>