-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy patherror.vue
More file actions
176 lines (161 loc) · 3.57 KB
/
error.vue
File metadata and controls
176 lines (161 loc) · 3.57 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<template>
<div class="layout_blank" :id="id">
<div class="content">
<div id="error">
<h1>
<no-ssr>
<TextGlitch :text="header" :steps=10 />
</no-ssr>
</h1>
<h3 v-html="subHeader"></h3>
<img :src="errorImage" :alt="header" class="error_img" />
<p v-html="copy"></p>
</div>
</div>
<footer>
<a href="/">
<img class="error_footer_logo" src="/Logo-Horizontal.svg" alt="Human Connection" style="max-width: 150px;" />
</a>
</footer>
</div>
</template>
<script>
import Raven from 'raven-js'
import VueTextGlitch from 'vue-text-glitch'
export default {
props: ['error'],
layout: 'blank',
components: {
'TextGlitch': VueTextGlitch
},
middleware: [
'maintenance'
],
head () {
return {
title: `Error ${this.statusCode}: ${this.header}`
}
},
mounted () {
if (this.$env.NODE_ENV === 'development') {
console.error(this.error.message)
}
// show sentry error dialog if something happened
if (Raven.lastEventId()) {
Raven.showReportDialog()
}
},
computed: {
errorImage () {
return `/assets/svg/errors/error${this.statusCode}.svg`
},
statusCode () {
let code = 500
const possibleErrors = [403, 404, 500, 503]
if (possibleErrors.indexOf(this.error.statusCode) >= 0) {
code = this.error.statusCode
}
return parseInt(code)
},
header () {
return this.$t(`component.error.header${parseInt(this.statusCode)}`, 'Error')
},
subHeader () {
return this.$t(`component.error.subHeader${parseInt(this.error.statusCode || 500)}`, this.error.message)
},
copy () {
return this.$t(`component.error.copy${parseInt(this.statusCode)}`)
},
id () {
return `page-name-${this.$route.name}`
}
}
}
</script>
<style lang="scss" scoped>
@import "assets/styles/_utilities";
$backgroundColor: #F5F5F5;
#error {
margin-top: -50px;
display: flex;
flex-direction: column;
// background-color: $backdrop-color;
text-align: center;
padding: 1.2rem;
h1 {
margin-bottom: 0;
font-weight: bold;
font-size: 2.5em;
}
h3 {
margin-top: 0;
}
.error_img {
min-height: 150px;
max-height: 260px;
padding: 3rem 2rem;
object-fit: contain;
}
}
footer {
padding: 1rem;
background-color: darken($backgroundColor, 5%);
position: fixed;
bottom: 0px;
left: 0;
text-align: center;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.button {
margin-top: 20px;
margin-bottom: 20px;
}
@media (max-height: 550px) {
h1 {
font-size: 1.5em;
}
#error {
transform: scale(0.8);
}
#error .error_img {
max-height: 25vh;
padding: 1rem;
}
footer {
padding: 0.2rem;
height: 55px;
.error_footer_logo {
height: 25px;
}
}
}
// FIX UNTIL NUXT FIXES ITS LAYOUT ISSUES
.layout_blank {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100vw;
height: 100vh;
z-index: 9998;
overflow: scroll;
background-color: $backgroundColor;
margin: 0;
& > .content {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
transition: opacity 150ms;
opacity: 1;
margin: 0;
}
}
.hidden {
opacity: 0;
}
</style>