77 <p class =" m-0 text-xs font-bold" >
88 <NuxtLink
99 class="after:absolute after:inset-0 bg-none"
10- :to =" details . link "
10+ :to =" link "
1111 >
1212 {{ $t(`Demande de transfert`) }}
1313 </NuxtLink >
1414 </p >
15- <p class =" m-0 text-xs" >
16- {{ $t('de {source}', { source: details.sourceName }) }}
15+ <p class =" flex items-center gap-1 m-0 text-xs" >
16+ {{ $t('de') }}
17+ <AvatarWithName
18+ v-if =" notification .details .transfer_owner .class == ' User' "
19+ :user =" notification .details .transfer_owner "
20+ :with-link =" false "
21+ />
22+ <OrganizationOwner
23+ v-else
24+ :organization =" notification .details .transfer_owner as OrganizationReference "
25+ logo-size-class=" size - 3 "
26+ :logo-no-border =" true "
27+ name-size="xs"
28+ name-color="text-gray-plain"
29+ :with-link =" false "
30+ />
1731 </p >
18- <p class =" m-0 text-xs" >
19- {{ $t('à {recipient}', { recipient: details.recipientName }) }}
32+ <p class =" flex items-center gap-1 m-0 text-xs" >
33+ {{ $t('à') }}
34+ <AvatarWithName
35+ v-if =" notification .details .transfer_recipient .class == ' User' "
36+ :user =" notification .details .transfer_recipient "
37+ :with-link =" false "
38+ />
39+ <OrganizationOwner
40+ v-else
41+ :organization =" notification .details .transfer_recipient as OrganizationReference "
42+ logo-size-class=" size - 3 "
43+ :logo-no-border =" true "
44+ name-size="xs"
45+ name-color="text-gray-plain"
46+ :with-link =" false "
47+ />
2048 </p >
2149 </div >
2250 <div class =" flex-none flex m-0 gap-1.5" >
3260</template >
3361
3462<script setup lang="ts">
35- import { useFormatDate } from ' @datagouv/components-next'
63+ import { AvatarWithName , useFormatDate , type OrganizationReference } from ' @datagouv/components-next'
3664import { RiSendPlaneLine } from ' @remixicon/vue'
3765import type { DeepReadonly } from ' vue'
3866import type { TransferRequestNotification } from ' ~/types/notifications'
@@ -43,24 +71,18 @@ const props = defineProps<{
4371
4472const user = useMe ()
4573
46- const details = computed (() => {
74+ const link = computed (() => {
4775 const recipient = props .notification .details .transfer_recipient
48- const source = props .notification .details .transfer_owner
49- const sourceName = ' first_name' in source ? ` ${source .first_name } ${source .last_name } ` : source .name
5076 const subject = props .notification .details .transfer_subject
51- const subjectPath = ` ${subject .class .toLowerCase ()}s `
52- if (' first_name' in recipient ) {
53- return {
54- link: user .value .id === recipient .id ? ` /admin/me/${subjectPath } ` : ` /admin/users/${recipient .id }/${subjectPath } ` ,
55- recipientName: ` ${recipient .first_name } ${recipient .last_name } ` ,
56- sourceName ,
57- }
58- }
59- return {
60- link: ` /admin/organizations/${recipient .id }/${subjectPath } ` ,
61- recipientName: recipient .name ,
62- sourceName ,
77+ const subjectPath = {
78+ Dataset: ' datasets' ,
79+ Reuse: ' reuses' ,
80+ Dataservice: ' dataservices' ,
81+ }[subject .class ]
82+ if (recipient .class == ' User' ) {
83+ return user .value .id === recipient .id ? ` /admin/me/${subjectPath } ` : ` /admin/users/${recipient .id }/${subjectPath } `
6384 }
85+ return ` /admin/organizations/${recipient .id }/${subjectPath } `
6486})
6587
6688const { formatDate } = useFormatDate ()
0 commit comments