33 - SPDX-License-Identifier: AGPL-3.0-or-later
44-->
55<template >
6- <div class =" enDot" >
7- <div :class =" statusText !== 'none' ? 'dot ' + statusToClass(status) : '' "
8- :title =" statusText !== 'none' ? statusText : ''" />
6+ <div v-if =" statusText !== 'none'"
7+ class =" status-chip"
8+ :class =" 'status-chip--' + statusToVariant(status)"
9+ :title =" statusText" >
10+ <div class =" status-chip__text" >{{ statusText }}</div >
11+ <NcIconSvgWrapper class =" status-chip__icon" :svg =" statusIcon" :size =" 20" />
912 </div >
1013</template >
1114
1215<script >
16+ import NcIconSvgWrapper from ' @nextcloud/vue/components/NcIconSvgWrapper'
17+ import { fileStatus } from ' ../../../helpers/fileStatus.js'
18+
1319export default {
1420 name: ' FileEntryStatus' ,
21+ components: {
22+ NcIconSvgWrapper,
23+ },
1524 props: {
1625 statusText: {
1726 type: String ,
@@ -23,63 +32,117 @@ export default {
2332 required: true ,
2433 default: 0 ,
2534 },
35+ signers: {
36+ type: Array ,
37+ default : () => [],
38+ },
39+ },
40+ computed: {
41+ statusIcon () {
42+ const statusInfo = fileStatus .find (item => item .id === this .status )
43+ return statusInfo? .icon || ' '
44+ },
2645 },
2746 methods: {
28- statusToClass (status ) {
47+ statusToVariant (status ) {
48+ // Status 0 can be "no signers" (error/red) or "draft" (gray)
49+ if (status === 0 ) {
50+ return this .signers .length === 0 ? ' error' : ' draft'
51+ }
2952 switch (Number (status)) {
30- case 0 :
31- return ' no-signers'
3253 case 1 :
54+ return ' available'
3355 case 2 :
34- return ' pending '
56+ return ' partial '
3557 case 3 :
3658 return ' signed'
3759 default :
38- return ' '
60+ return ' secondary '
3961 }
4062 },
4163 },
4264}
4365< / script>
4466
4567< style lang= " scss" scoped>
46- .enDot {
47- --dot-size : 10px ;
68+ .status - chip {
69+ -- chip- size: 24px ;
70+ -- chip- radius: 12px ;
4871
49- display : flex ;
50- flex-direction : row ;
51- align-content : center ;
52- margin : 5px ;
72+ display: inline- block;
73+ min- height: var (-- chip- size);
5374 max- width: 100 % ;
54- align-items : center ;
55- justify-content : center ;
56- cursor : inherit ;
75+ padding: 4px 12px ;
76+ border- radius: var (-- chip- radius);
77+ line- height: 1.3 ;
78+ text- align: center;
79+ white- space: pre- wrap;
80+ word- wrap: break - word;
81+ overflow- wrap: break - word;
82+ hyphens: auto;
83+ vertical- align: middle;
84+
85+ & __text {
86+ display: inline- block;
87+ max- width: 100 % ;
88+ white- space: pre- wrap;
89+ word- wrap: break - word;
90+ overflow- wrap: break - word;
91+ }
5792
58- .dot {
59- flex : 1 0 var (--dot-size );
60- height : var (--dot-size );
61- border-radius : 50% ;
62- margin-right : 10px ;
63- cursor : inherit ;
93+ & __icon {
94+ display: none;
6495 }
6596
66- .signed {
67- background : #008000 ;
97+ & -- error {
98+ background- color: var (-- color- error);
99+ color: var (-- color- error- text);
68100 }
69101
70- .no-signers {
71- background : #ff0000 ;
102+ & -- draft {
103+ background- color: #E0E0E0 ;
104+ color: #424242 ;
72105 }
73106
74- .pending {
75- background : #d67335
107+ & -- available {
108+ background- color: #FFF3CD ;
109+ color: #856404 ;
76110 }
77111
78- span {
79- font-size : 14px ;
80- font-weight : normal ;
81- text-align : center ;
82- cursor : inherit ;
112+ & -- partial {
113+ background- color: #FFF3CD ;
114+ color: #856404 ;
115+ }
116+
117+ & -- signed {
118+ background- color: #D4EDDA ;
119+ color: #155724 ;
120+ }
121+
122+ & -- secondary {
123+ background- color: var (-- color- primary- element- light);
124+ color: var (-- color- primary- element- light- text);
125+ }
126+
127+ // Mobile: show only icon
128+ @media (max - width : 768px ) {
129+ display: inline- flex;
130+ align- items: center;
131+ justify- content: center;
132+ min- width: var (-- chip- size);
133+ max- width: var (-- chip- size);
134+ width: var (-- chip- size);
135+ height: var (-- chip- size);
136+ padding: 0 ;
137+ background- color: transparent ! important;
138+
139+ & __text {
140+ display: none;
141+ }
142+
143+ & __icon {
144+ display: block;
145+ }
83146 }
84147}
85148< / style>
0 commit comments