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
|
<!--
- SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<section>
<HeaderBar :is-heading="true" :readable="t('settings', 'Details')" />
<div class="details">
<div class="details__groups">
<Account :size="20" />
<div class="details__groups-info">
<p>{{ t('settings', 'You are a member of the following groups:') }}</p>
<p class="details__groups-list">
{{ groups.join(', ') }}
</p>
</div>
</div>
<div class="details__quota">
<CircleSlice :size="20" />
<div class="details__quota-info">
<p class="details__quota-text" v-html="quotaText" />
<NcProgressBar size="medium"
:value="usageRelative"
:error="usageRelative > 80" />
</div>
</div>
</div>
</section>
</template>
<script>
import { loadState } from '@nextcloud/initial-state'
import NcProgressBar from '@nextcloud/vue/dist/Components/NcProgressBar.js'
import Account from 'vue-material-design-icons/Account.vue'
import CircleSlice from 'vue-material-design-icons/CircleSlice3.vue'
import HeaderBar from './shared/HeaderBar.vue'
/** SYNC to be kept in sync with `lib/public/Files/FileInfo.php` */
const SPACE_UNLIMITED = -3
const { groups, quota, totalSpace, usage, usageRelative } = loadState('settings', 'personalInfoParameters', {})
export default {
name: 'DetailsSection',
components: {
Account,
CircleSlice,
HeaderBar,
NcProgressBar,
},
data() {
return {
groups,
usageRelative,
}
},
computed: {
quotaText() {
if (quota === SPACE_UNLIMITED) {
return t('settings', 'You are using <strong>{usage}</strong>', { usage })
}
return t(
'settings',
'You are using <strong>{usage}</strong> of <strong>{totalSpace}</strong> (<strong>{usageRelative}%</strong>)',
{ usage, totalSpace, usageRelative },
)
},
},
}
</script>
<style lang="scss" scoped>
.details {
display: flex;
flex-direction: column;
margin-block: 10px;
margin-inline: 0 32px;
gap: 16px 0;
color: var(--color-text-maxcontrast);
&__groups,
&__quota {
display: flex;
gap: 0 10px;
&-info {
display: flex;
flex-direction: column;
width: 100%;
gap: 4px 0;
}
&-list {
font-weight: bold;
}
&:deep(.material-design-icon) {
align-self: flex-start;
margin-top: 2px;
}
}
}
</style>
|