Skip to content

Commit

Permalink
pkp/pkp-lib#101651 Added story updates, and remove obsolete tests
Browse files Browse the repository at this point in the history
  • Loading branch information
taslangraham committed Dec 23, 2024
1 parent 59ed2c7 commit 402f21e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 95 deletions.
33 changes: 6 additions & 27 deletions src/components/InitialsAvatar/InitialsAvatar.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,29 @@ export default {
};

export const Default = {
args: {givenName: 'Ramiro', familyName: 'Vaca'},
};

export const GivenNameOnly = {
args: {givenName: 'Daniel'},
args: {initials: 'RV'},
};

export const IsSecondary = {
args: {givenName: 'David', familyName: 'Buskins', isSecondary: true},
args: {initials: 'DB', isSecondary: true},
};

export const IsWarnable = {
args: {givenName: 'Aisla', familyName: 'McCrae', isWarnable: true},
args: {initials: 'AG', isWarnable: true},
};

export const IsDisabled = {
args: {
givenName: 'Adela',
familyName: 'Gallego',
initials: 'AG',
isSecondary: true,
isDisabled: true,
},
};

export const UndefinedName = {
export const UndefinedInitials = {
args: {},
};

export const SmallIcon = {
args: {givenName: 'Paul', familyName: 'Hudson', shrink: true},
};

export const PreferredInitialsOnly = {
args: {
preferredInitials: 'TG',
userId: 136,
},
};

export const GivenNameWithFamilyNameAndPreferredInitials = {
args: {
preferredInitials: 'TG',
givenName: 'Adela',
familyName: 'Gallego',
userId: 136,
},
args: {initials: 'PH', shrink: true},
};
24 changes: 1 addition & 23 deletions src/components/UserAvatar/UserAvatar.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,7 @@ export default {

export const Default = {
args: {
userFullName: 'Nama Sampan-Nirmal Lengkap',
userId: 136,
},
};

export const Arabic = {
args: {
userFullName: 'خالد محمود الفارسي',
userId: 136,
},
};

export const PreferredInitialsOnly = {
args: {
preferredInitials: 'TG',
userId: 136,
},
};

export const UserFullNameAndPreferredInitials = {
args: {
preferredInitials: 'TG',
userFullName: 'Nama Sampan-Nirmal Lengkap',
initials: 'NL',
userId: 136,
},
};
15 changes: 0 additions & 15 deletions src/composables/useParticipant.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,7 @@ export function useParticipant() {
];
}

function getUserAvatarInitialsFromName(fullName) {
const fullNameParts = fullName.split(' ');

return fullNameParts
.map((part) => {
const partTrimmed = part.trim();
if (partTrimmed.length) {
return partTrimmed[0].toUpperCase();
}
return '';
})
.join('')
.substring(0, 3);
}
return {
getUserAvatarInitialsFromName,
getEditorRoleIds,
};
}
29 changes: 0 additions & 29 deletions src/composables/useParticipant.test.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<UserAvatar
size-variant="small"
:user-id="reviewAssignment.id"
:initials="reviewAssignment.reviewerInitials"
:initials="String(reviewAssignment.reviewerInitials)"
/>
</template>
<ReviewActivityIndicatorPopover
Expand Down

0 comments on commit 402f21e

Please sign in to comment.