diff --git a/frontend/app/components/onboarding/DataIdentityCard.vue b/frontend/app/components/onboarding/DataIdentityCard.vue index 4a58c78..df9342e 100644 --- a/frontend/app/components/onboarding/DataIdentityCard.vue +++ b/frontend/app/components/onboarding/DataIdentityCard.vue @@ -63,6 +63,37 @@ function removeRow(index: number) { rows.value.splice(index, 1) commitAttributes() } + +// ── « C'est moi » — un collectif importé (seed, fichier) n'a aucun isMe : +// on se désigne parmi les personnes existantes, ou on s'ajoute. +const newMeName = ref('') + +function claimMe(personId: string) { + const current = store.current + if (!current || store.me) return + const person = current.people.find(p => p.id === personId && !p.archivedAt) + if (!person) return + person.isMe = true + store.stamp(person) + store.persist() +} + +function createMe() { + const current = store.current + const displayName = newMeName.value.trim() + if (!current || store.me || !displayName) return + const now = store.now() + current.people.push({ + id: store.newId(), + collectiveId: current.collective.id, + createdAt: now, + updatedAt: now, + displayName, + isMe: true, + }) + newMeName.value = '' + store.persist() +}