Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
meetulr committed Oct 30, 2024
1 parent 9626c68 commit 9be6fa8
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 32 deletions.
3 changes: 2 additions & 1 deletion src/components/AddPeopleToTag/AddPeopleToTag.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
.scrollContainer {
max-height: 100px;
overflow-y: auto;
margin-bottom: 1rem;
margin-top: 0.5rem;
margin-bottom: 1.7rem;
}

.memberBadge {
Expand Down
2 changes: 1 addition & 1 deletion src/components/AddPeopleToTag/AddPeopleToTag.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const renderAddPeopleToTagModal = (
<I18nextProvider i18n={i18n}>
<Routes>
<Route
path="/orgtags/:orgId/managetag/:tagId"
path="/orgtags/:orgId/manageTag/:tagId"
element={<AddPeopleToTag {...props} />}
/>
</Routes>
Expand Down
2 changes: 1 addition & 1 deletion src/components/AddPeopleToTag/AddPeopleToTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const AddPeopleToTag: React.FC<InterfaceAddPeopleToTagProps> = ({
const userTagMembersToAssignTo =
userTagsMembersToAssignToData?.getUsersToAssignTo.usersToAssignTo.edges.map(
(edge) => edge.node,
);
) ?? /* istanbul ignore next */ [];

const handleAddOrRemoveMember = (member: InterfaceMemberData): void => {
setAssignToMembers((prevMembers) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/TagActions/TagActions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const renderTagActionsModal = (
<I18nextProvider i18n={i18n}>
<Routes>
<Route
path="/orgtags/:orgId/managetag/:tagId"
path="/orgtags/:orgId/manageTag/:tagId"
element={<TagActions {...props} />}
/>
</Routes>
Expand Down
7 changes: 4 additions & 3 deletions src/components/TagActions/TagActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ const TagActions: React.FC<InterfaceTagActionsProps> = ({
});
};

const userTagsList = orgUserTagsData?.organizations[0]?.userTags.edges.map(
(edge) => edge.node,
);
const userTagsList =
orgUserTagsData?.organizations[0]?.userTags.edges.map(
(edge) => edge.node,
) ?? /* istanbul ignore next */ [];

const [checkedTagId, setCheckedTagId] = useState<string | null>(null);
const [uncheckedTagId, setUncheckedTagId] = useState<string | null>(null);
Expand Down
6 changes: 3 additions & 3 deletions src/components/TagActions/TagNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ const TagNode: React.FC<InterfaceTagNodeProps> = ({
);
}

const subTagsList = subTagsData?.getChildTags.childTags.edges.map(
(edge) => edge.node,
);
const subTagsList =
subTagsData?.getChildTags.childTags.edges.map((edge) => edge.node) ??
/* istanbul ignore next */ [];

const handleTagClick = (): void => {
setExpanded(!expanded);
Expand Down
9 changes: 8 additions & 1 deletion src/screens/ManageTag/EditUserTagModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ const EditUserTagModal: React.FC<InterfaceEditUserTagModalProps> = ({
>
<Modal.Title className="text-white">{t('tagDetails')}</Modal.Title>
</Modal.Header>
<Form onSubmitCapture={handleEditUserTag}>
<Form
onSubmitCapture={(e: FormEvent<HTMLFormElement>): void => {
e.preventDefault();
if (newTagName.trim()) {
handleEditUserTag(e);
}
}}
>
<Modal.Body>
<Form.Label htmlFor="tagName">{t('tagName')}</Form.Label>
<Form.Control
Expand Down
2 changes: 1 addition & 1 deletion src/screens/ManageTag/ManageTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ function ManageTag(): JSX.Element {
const userTagAssignedMembers =
userTagAssignedMembersData?.getAssignedUsers.usersAssignedTo.edges.map(
(edge) => edge.node,
);
) ?? /* istanbul ignore next */ [];
const orgUserTagAncestors = orgUserTagAncestorsData?.getUserTagAncestors;

const redirectToSubTags = (tagId: string): void => {
Expand Down
7 changes: 5 additions & 2 deletions src/screens/ManageTag/RemoveUserTagModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,21 @@ const RemoveUserTagModal: React.FC<InterfaceRemoveUserTagModalProps> = ({
<Modal
size="sm"
id="removeUserTagModal"
aria-describedby="removeUserTagMessage"
show={removeUserTagModalIsOpen}
onHide={toggleRemoveUserTagModal}
backdrop="static"
keyboard={false}
centered
>
<Modal.Header closeButton className="bg-primary">
<Modal.Title className="text-white" id={`deleteActionItem`}>
<Modal.Title className="text-white" id="removeUserTag">
{t('removeUserTag')}
</Modal.Title>
</Modal.Header>
<Modal.Body>{t('removeUserTagMessage')}</Modal.Body>
<Modal.Body id="removeUserTagMessage">
{t('removeUserTagMessage')}
</Modal.Body>
<Modal.Footer>
<Button
type="button"
Expand Down
1 change: 1 addition & 0 deletions src/screens/OrganizationTags/OrganizationTags.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,5 @@

max-height: calc(100vh - 18rem);
overflow: auto;
position: sticky;
}
4 changes: 2 additions & 2 deletions src/screens/OrganizationTags/OrganizationTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ function OrganizationTags(): JSX.Element {
getRowClassName={() => `${styles.rowBackground}`}
autoHeight
rowHeight={65}
rows={userTagsList?.map((fund, index) => ({
rows={userTagsList?.map((userTag, index) => ({
id: index + 1,
...fund,
...userTag,
}))}
columns={columns}
isRowSelectable={() => false}
Expand Down
31 changes: 15 additions & 16 deletions src/screens/SubTags/SubTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ function SubTags(): JSX.Element {
);
}

const userTagsList = subTagsData?.getChildTags.childTags.edges.map(
(edge) => edge.node,
);
const subTagsList =
subTagsData?.getChildTags.childTags.edges.map((edge) => edge.node) ??
/* istanbul ignore next */ [];

const orgUserTagAncestors = orgUserTagAncestorsData?.getUserTagAncestors;

Expand Down Expand Up @@ -343,17 +343,16 @@ function SubTags(): JSX.Element {
>
{`${t('manageTag')} ${subTagsData?.getChildTags.name}`}
</Button>

<Button
variant="success"
onClick={showAddSubTagModal}
data-testid="addSubTagBtn"
className="ms-auto"
>
<i className={'fa fa-plus me-2'} />
{t('addChildTag')}
</Button>
</div>
<Button
variant="success"
onClick={showAddSubTagModal}
data-testid="addSubTagBtn"
className="ms-auto"
>
<i className={'fa fa-plus me-2'} />
{t('addChildTag')}
</Button>
</div>

<div className="mb-4">
Expand Down Expand Up @@ -392,7 +391,7 @@ function SubTags(): JSX.Element {
className={styles.subTagsScrollableDiv}
>
<InfiniteScroll
dataLength={userTagsList?.length ?? 0}
dataLength={subTagsList?.length ?? 0}
next={loadMoreSubTags}
hasMore={
subTagsData?.getChildTags.childTags.pageInfo.hasNextPage ??
Expand Down Expand Up @@ -422,9 +421,9 @@ function SubTags(): JSX.Element {
getRowClassName={() => `${styles.rowBackground}`}
autoHeight
rowHeight={65}
rows={userTagsList?.map((fund, index) => ({
rows={subTagsList?.map((subTag, index) => ({
id: index + 1,
...fund,
...subTag,
}))}
columns={columns}
isRowSelectable={() => false}
Expand Down
8 changes: 8 additions & 0 deletions src/utils/organizationTagsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ export const dataGridStyle = {
'& .MuiDataGrid-main': {
borderRadius: '0.1rem',
},
'& .MuiDataGrid-topContainer': {
position: 'fixed',
top: 259,
zIndex: 1,
},
'& .MuiDataGrid-virtualScrollerContent': {
marginTop: 6.5,
},
};

// the data chunk size for tag related queries
Expand Down

0 comments on commit 9be6fa8

Please sign in to comment.