-
Notifications
You must be signed in to change notification settings - Fork 17
/
EmptyContent.vue
111 lines (108 loc) · 2.49 KB
/
EmptyContent.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
107
108
109
110
111
<template>
<div class="empty-content">
<div class="empty-content--wrapper">
<div class="empty-content--icon">
<img :src="flowSvg" alt="flow">
</div>
<div class="empty-content--title">
{{ emptyContentMessage }}
</div>
<div v-if="showConnectButton" class="empty-content--connect-button">
<OAuthConnectButton :request-url="requestUrl" />
</div>
</div>
</div>
</template>
<script>
import { generateUrl } from '@nextcloud/router'
import { translate as t } from '@nextcloud/l10n'
import OAuthConnectButton from '../OAuthConnectButton'
export default {
name: 'EmptyContent',
components: { OAuthConnectButton },
props: {
state: {
type: String,
required: true,
default: 'ok',
},
requestUrl: {
type: String,
required: true,
},
errorMessage: {
type: String,
default: '',
},
},
data() {
return {
settingsUrl: generateUrl('/settings/user/connected-accounts'),
}
},
computed: {
flowSvg() {
return require('../../../img/flow.svg')
},
showConnectButton() {
return ['error', 'no-token'].includes(this.state)
},
emptyContentMessage() {
if (this.state === 'no-token') {
return t('integration_openproject', 'No OpenProject account connected')
} else if (this.state === 'connection-error') {
return t('integration_openproject', 'Error connecting to OpenProject')
} else if (this.state === 'failed-fetching-workpackages') {
return t('integration_openproject', 'Could not fetch work packages from OpenProject')
} else if (this.state === 'error') {
return t('integration_openproject', 'Unexpected Error')
} else if (this.state === 'ok') {
return t('integration_openproject', 'No workspaces linked yet, search for work package to add!')
}
return 'invalid state'
},
},
}
</script>
<style scoped lang="scss">
.empty-content {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
&--wrapper {
height: fit-content;
}
&--icon {
padding: 1vh 0;
display: flex;
align-items: center;
justify-content: center;
img {
height: 50px;
width: 50px;
}
}
&--title {
text-align: center;
font-size: 1.2rem;
line-height: 1.4rem;
font-weight: 600;
padding-top: 4px;
color: #333333;
}
&--subtitle {
font-size: .875rem;
font-weight: 400;
color: #6d6d6d;
line-height: 1rem;
padding: 8px 0;
}
&--connect-button {
padding: 1vh 0;
display: flex;
align-items: center;
justify-content: center;
}
}
</style>