Skip to content

Commit 0aa8cde

Browse files
committed
feat: improve signer status visualization with chips
- Replace indicator circle with NcChip component - Add status-based chip types (success, warning, secondary) - Add Material Design Icons for different statuses - Improve layout with flexbox for better alignment - Remove timestamp display in favor of status text Signed-off-by: Vitor Mattos <[email protected]>
1 parent c803e93 commit 0aa8cde

1 file changed

Lines changed: 60 additions & 35 deletions

File tree

src/Components/Signers/Signer.vue

Lines changed: 60 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,38 @@
1414
<NcAvatar :size="44" :display-name="signer.displayName" />
1515
</template>
1616
<template #subname>
17-
<Bullet v-for="method in identifyMethodsNames" :key="method" :name="method" />
17+
<div class="signer-subname">
18+
<Bullet v-for="method in identifyMethodsNames" :key="method" :name="method" />
19+
<NcChip :text="signer.statusText"
20+
:type="chipType"
21+
:icon-path="statusIconPath"
22+
:no-close="true"
23+
class="signer-status-chip" />
24+
</div>
1825
</template>
1926
<template #extra>
20-
<div v-if="showDragHandle" class="drag-handle-wrapper">
21-
<DragVertical :size="20"
22-
class="drag-handle"
23-
:title="t('libresign', 'Drag to reorder')" />
27+
<div v-if="showDragHandle" class="signer-extra">
28+
<div class="drag-handle-wrapper">
29+
<DragVertical :size="20"
30+
class="drag-handle"
31+
:title="t('libresign', 'Drag to reorder')" />
32+
</div>
2433
</div>
2534
</template>
2635
<template #actions>
2736
<slot name="actions" :closeActions="closeActions" />
2837
</template>
29-
<template #indicator>
30-
<CheckboxBlankCircle :size="16"
31-
:fill-color="statusColor"
32-
:title="statusText" />
33-
</template>
3438
</NcListItem>
3539
</template>
3640
<script>
37-
import CheckboxBlankCircle from 'vue-material-design-icons/CheckboxBlankCircle.vue'
41+
import { mdiCheckCircle, mdiClockOutline, mdiCircleOutline } from '@mdi/js'
3842
import DragVertical from 'vue-material-design-icons/DragVertical.vue'
3943
4044
import { emit } from '@nextcloud/event-bus'
4145
import { loadState } from '@nextcloud/initial-state'
42-
import Moment from '@nextcloud/moment'
4346
4447
import NcAvatar from '@nextcloud/vue/components/NcAvatar'
48+
import NcChip from '@nextcloud/vue/components/NcChip'
4549
import NcListItem from '@nextcloud/vue/components/NcListItem'
4650
4751
import Bullet from '../Bullet/Bullet.vue'
@@ -53,7 +57,7 @@ export default {
5357
components: {
5458
NcListItem,
5559
NcAvatar,
56-
CheckboxBlankCircle,
60+
NcChip,
5761
DragVertical,
5862
Bullet,
5963
},
@@ -75,7 +79,12 @@ export default {
7579
},
7680
setup() {
7781
const filesStore = useFilesStore()
78-
return { filesStore }
82+
return {
83+
filesStore,
84+
mdiCheckCircle,
85+
mdiClockOutline,
86+
mdiCircleOutline,
87+
}
7988
},
8089
data() {
8190
return {
@@ -123,29 +132,30 @@ export default {
123132
identifyMethodsNames() {
124133
return this.signer.identifyMethods.map(method => method.method)
125134
},
126-
statusColor() {
127-
if (this.signer.signed) {
128-
return '#008000'
129-
}
130-
// Pending
131-
if (this.signer.signRequestId) {
132-
return '#d67335'
133-
}
134-
// Draft, not saved
135-
return '#dbdbdb'
135+
signerStatus() {
136+
return this.signer.status
136137
},
137-
statusText() {
138-
if (this.signer.signed) {
139-
return t('libresign', 'signed at {date}', {
140-
date: Moment(this.signer.request_signed).format('LLL'),
141-
})
138+
chipType() {
139+
switch (this.signerStatus) {
140+
case 2: // SIGNED
141+
return 'success'
142+
case 1: // ABLE_TO_SIGN (pending)
143+
return 'warning'
144+
case 0: // DRAFT
145+
default:
146+
return 'secondary'
142147
}
143-
// Pending
144-
if (this.signer.signRequestId) {
145-
return t('libresign', 'pending')
148+
},
149+
statusIconPath() {
150+
switch (this.signerStatus) {
151+
case 2: // SIGNED
152+
return this.mdiCheckCircle
153+
case 1: // ABLE_TO_SIGN (pending)
154+
return this.mdiClockOutline
155+
case 0: // DRAFT
156+
default:
157+
return this.mdiCircleOutline
146158
}
147-
// Draft, not saved
148-
return t('libresign', 'draft')
149159
},
150160
},
151161
methods: {
@@ -171,10 +181,25 @@ export default {
171181
}
172182
</script>
173183
<style lang="scss" scoped>
184+
.signer-subname {
185+
display: flex;
186+
align-items: center;
187+
gap: 4px;
188+
flex-wrap: wrap;
189+
}
190+
191+
.signer-status-chip {
192+
flex-shrink: 0;
193+
}
194+
195+
.signer-extra {
196+
display: flex;
197+
align-items: center;
198+
}
199+
174200
.drag-handle-wrapper {
175201
display: flex;
176202
align-items: center;
177-
height: 100%;
178203
}
179204
180205
.drag-handle {

0 commit comments

Comments
 (0)