-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Refactor: remaining components with profileavatar - 1 #6226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 3 commits
a69977e
2783918
4f6431b
1722632
ec818ba
2900e3a
f9c18e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,7 @@ | |
| * Success or error messages are displayed using toast notifications based on the result of the mutation. | ||
| */ | ||
| import type { ChangeEvent } from 'react'; | ||
| import { Button, Form, Modal } from 'react-bootstrap'; | ||
| import { Button, Form } from 'react-bootstrap'; | ||
| import type { | ||
| InterfaceCreateVolunteerGroup, | ||
| InterfaceVolunteerGroupInfo, | ||
|
|
@@ -56,8 +56,9 @@ import { | |
| import { PiUserListBold } from 'react-icons/pi'; | ||
| import { TbListDetails } from 'react-icons/tb'; | ||
| import { USER_VOLUNTEER_MEMBERSHIP } from 'GraphQl/Queries/EventVolunteerQueries'; | ||
| import Avatar from 'components/Avatar/Avatar'; | ||
| import { FaXmark } from 'react-icons/fa6'; | ||
| import { ProfileAvatarDisplay } from 'shared-components/ProfileAvatarDisplay/ProfileAvatarDisplay'; | ||
| import BaseModal from 'shared-components/BaseModal/BaseModal'; | ||
|
|
||
| export interface InterfaceGroupModal { | ||
| isOpen: boolean; | ||
|
|
@@ -187,19 +188,14 @@ const GroupModal: React.FC<InterfaceGroupModal> = ({ | |
| ); | ||
|
|
||
| return ( | ||
| <Modal className={styles.groupModal} onHide={hide} show={isOpen}> | ||
| <Modal.Header> | ||
| <p className={styles.titlemodal}>{t('manageGroup')}</p> | ||
| <Button | ||
| variant="danger" | ||
| onClick={hide} | ||
| className={styles.modalCloseBtn} | ||
| data-testid="modalCloseBtn" | ||
| > | ||
| <i className="fa fa-times"></i> | ||
| </Button> | ||
| </Modal.Header> | ||
| <Modal.Body> | ||
| <BaseModal | ||
| className={styles.groupModal} | ||
| show={isOpen} | ||
| onHide={hide} | ||
| title={t('manageGroup')} | ||
| data-testid="groupModal" | ||
| > | ||
| <> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Remove unnecessary fragment wrapper. The ♻️ Proposed refactor <BaseModal
className={styles.groupModal}
show={isOpen}
onHide={hide}
title={t('manageGroup')}
dataTestId="groupModal"
>
- <>
<div
className={`btn-group ${styles.toggleGroup} mt-0 px-3 mb-4 w-100`}
role="group"
>
{/* ...rest of content... */}
</div>
- </>
</BaseModal>Also applies to: 393-393 🤖 Prompt for AI Agents |
||
| <div | ||
| className={`btn-group ${styles.toggleGroup} mt-0 px-3 mb-4 w-100`} | ||
| role="group" | ||
|
|
@@ -349,24 +345,14 @@ const GroupModal: React.FC<InterfaceGroupModal> = ({ | |
| className="d-flex gap-1 align-items-center" | ||
| data-testid="userName" | ||
| > | ||
| {avatarURL ? ( | ||
| <img | ||
| src={avatarURL} | ||
| alt={t('volunteerAlt')} | ||
| data-testid={`image${id + 1}`} | ||
| className={styles.TableImage} | ||
| /> | ||
| ) : ( | ||
| <div className={styles.avatarContainer}> | ||
| <Avatar | ||
| key={id + '1'} | ||
| containerStyle={styles.imageContainer} | ||
| avatarStyle={styles.TableImage} | ||
| name={name} | ||
| alt={name} | ||
| /> | ||
| </div> | ||
| )} | ||
| <ProfileAvatarDisplay | ||
| key={id + '1'} | ||
| imageUrl={avatarURL} | ||
| fallbackName={t('volunteerAlt')} | ||
| data-testid={`image${id + 1}`} | ||
| className={styles.TableImage} | ||
| /> | ||
|
|
||
| {name} | ||
| </TableCell> | ||
| <TableCell component="th" scope="row"> | ||
|
|
@@ -404,8 +390,8 @@ const GroupModal: React.FC<InterfaceGroupModal> = ({ | |
| )} | ||
| </div> | ||
| )} | ||
| </Modal.Body> | ||
| </Modal> | ||
| </> | ||
| </BaseModal> | ||
| ); | ||
| }; | ||
| export default GroupModal; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Fix incorrect prop name:
data-testid→dataTestId.Line 196 uses
data-testidbutBaseModalexpectsdataTestId(camelCase) per its interface definition. This will cause a TypeScript error.🔧 Proposed fix
<BaseModal className={styles.groupModal} show={isOpen} onHide={hide} title={t('manageGroup')} - data-testid="groupModal" + dataTestId="groupModal" >📝 Committable suggestion
🤖 Prompt for AI Agents