Skip to content

Commit

Permalink
fix: use first avatar and affilation shown in dropdown, if available,…
Browse files Browse the repository at this point in the history
… on found person in RSD

fix: scale small image options
  • Loading branch information
dmijatovic committed Sep 16, 2024
1 parent aca47c6 commit c66a1c8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions frontend/components/person/AggregatedPersonModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,13 @@ export default function AggregatedPersonModal({
)

function isSaveDisabled() {
// if not valid -> save disabled
if (isValid === false) return true
// if valid and new entry (id===null) -> save enabled
if (formData.id === null) return false
// if valid and edit (id!=null) but not dirty/touched -> save disabled
if (isDirty === false) return true
// else -> save enabled
return false
}
}
4 changes: 2 additions & 2 deletions frontend/components/person/AvatarOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export default function AvatarOptions(props: AvatarOptionsProps) {
<img
src={image}
alt="avatar"
className="w-[2.5rem] h-[2.5rem] rounded-full"
className="w-[2.5rem] h-[2.5rem] rounded-full object-cover"
/>
</IconButton>
)
Expand All @@ -121,7 +121,7 @@ export default function AvatarOptions(props: AvatarOptionsProps) {
title="No image"
onClick={onNoAvatar}
>
<span className="w-[2.5rem] h-[2.5rem]">
<span className="w-[2.5rem] h-[2.5rem] rounded-full object-cover">
{getDisplayInitials({given_names, family_names})}
</span>
</IconButton>
Expand Down
4 changes: 4 additions & 0 deletions frontend/components/projects/edit/team/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ export default function ProjectTeam() {
if (person && project?.id) {
// extract person props as much as possible (use null if not found)
const member:Person = getPropsFromObject(person, PersonProps, true)
// use first avatar (if exists)
member.avatar_id = person.avatar_options[0] ?? null
// use affiliation (if exists)
member.affiliation = person.affiliation_options[0] ?? null
// flag contact person to false
member.is_contact_person = false
// add position
Expand Down
4 changes: 4 additions & 0 deletions frontend/components/software/edit/contributors/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ export default function SoftwareContributors() {
if (person && software?.id) {
// extract person props as much as possible (use null if not found)
const contributor:Person = getPropsFromObject(person, PersonProps, true)
// use first avatar (if exists)
contributor.avatar_id = person.avatar_options[0] ?? null
// use affiliation (if exists)
contributor.affiliation = person.affiliation_options[0] ?? null
// flag contact person to false
contributor.is_contact_person = false
// add position
Expand Down

0 comments on commit c66a1c8

Please sign in to comment.