refactor: Replace Bullet component with NcChip and fix signer reactivity

- Replace custom Bullet component with NcChip from @nextcloud/vue
- Remove unused Bullet component
- Fix reactivity issue by passing signerIndex instead of currentSigner
- Signer component now fetches data from store reactively using computed property
- This ensures changes in store are properly reflected in the UI

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
This commit is contained in:
Vitor Mattos 2025-12-11 16:20:12 -03:00
parent 69e77a2156
commit 3f061158fc
No known key found for this signature in database
GPG key ID: 6FECE2AD4809003A
3 changed files with 9 additions and 48 deletions

View file

@ -1,40 +0,0 @@
<!--
- SPDX-FileCopyrightText: 2024 LibreCode coop and LibreCode contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div class="bullet__wrapper">
<span class="bullet__name">
{{ name }}
</span>
</div>
</template>
<script>
export default {
name: 'Bullet',
props: {
name: {
type: String,
required: true,
},
},
}
</script>
<style lang="scss" scoped>
.bullet {
&__wrapper {
display: inline-block;
vertical-align: middle;
min-width: 0;
max-width: 100%;
}
&__name {
border-radius: 10px;
display: inline-flex;
max-width: 100%;
background-color: var(--color-background-dark);
padding-right: 8px;
padding-left: 8px;
}
}
</style>

View file

@ -15,7 +15,10 @@
</template>
<template #subname>
<div class="signer-subname">
<Bullet v-for="method in identifyMethodsNames" :key="method" :name="method" />
<NcChip v-for="method in identifyMethodsNames"
:key="method"
:text="method"
:no-close="true" />
<NcChip :text="signer.statusText"
:type="chipType"
:icon-path="statusIconPath"
@ -48,8 +51,6 @@ import NcAvatar from '@nextcloud/vue/components/NcAvatar'
import NcChip from '@nextcloud/vue/components/NcChip'
import NcListItem from '@nextcloud/vue/components/NcListItem'
import Bullet from '../Bullet/Bullet.vue'
import { useFilesStore } from '../../store/files.js'
export default {
@ -59,10 +60,9 @@ export default {
NcAvatar,
NcChip,
DragVertical,
Bullet,
},
props: {
currentSigner: {
signerIndex: {
type: Number,
required: true,
},
@ -94,7 +94,8 @@ export default {
},
computed: {
signer() {
return this.filesStore.getFile().signers[this.currentSigner]
const file = this.filesStore.getFile()
return file?.signers?.[this.signerIndex]
},
signerName() {
return this.signer.displayName

View file

@ -15,7 +15,7 @@
<transition-group name="signer-list" tag="div">
<Signer v-for="(signer, index) in sortableSigners"
:key="signer.identify || index"
:current-signer="index"
:signer-index="index"
:event="event"
:draggable="!signer.signed">
<template #actions="{closeActions}">
@ -27,7 +27,7 @@
<ul v-else>
<Signer v-for="(signer, index) in signers"
:key="signer.identify || index"
:current-signer="index"
:signer-index="index"
:event="event">
<template #actions="{closeActions}">
<slot name="actions" :signer="signer" :closeActions="closeActions" />