Skip to content
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

Figma: People Page Violates The Figma Style Guide #3408

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/assets/css/app.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 37 additions & 42 deletions src/screens/OrganizationPeople/AddMember.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useLazyQuery, useMutation, useQuery } from '@apollo/client';
import { Check, Close, Search } from '@mui/icons-material';
import { Search } from '@mui/icons-material';
import EmailOutlinedIcon from '@mui/icons-material/EmailOutlined';
import Paper from '@mui/material/Paper';
import Table from '@mui/material/Table';
Expand All @@ -20,7 +20,7 @@
} from 'GraphQl/Queries/Queries';
import Loader from 'components/Loader/Loader';
import type { ChangeEvent } from 'react';
import React, { useEffect, useState } from 'react';
import React, { useCallback, useEffect, useState } from 'react';
import { Button, Form, InputGroup, Modal } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
import { Link, useParams } from 'react-router-dom';
Expand All @@ -36,8 +36,8 @@

const StyledTableCell = styled(TableCell)(() => ({
[`&.${tableCellClasses.head}`]: {
backgroundColor: 'var(--table-head-bg, blue)',
color: 'var(--table-header-color, black)',
backgroundColor: 'var(--grey-light)',
color: 'var(--black-color)',
},
[`&.${tableCellClasses.body}`]: {
fontSize: 14,
Expand Down Expand Up @@ -102,20 +102,26 @@
const toggleDialogModal = (): void =>
setAddUserModalIsOpen(!addUserModalisOpen);

const [createNewUserModalisOpen, setCreateNewUserModalIsOpen] =
useState(false);
function openCreateNewUserModal(): void {
setCreateNewUserModalIsOpen(true);
}

function closeCreateNewUserModal(): void {
setCreateNewUserModalIsOpen(false);
}
const toggleCreateNewUserModal = (): void =>
setCreateNewUserModalIsOpen(!addUserModalisOpen);

const [addMember] = useMutation(ADD_MEMBER_MUTATION);

function useModal(initialState = false): {
isOpen: boolean;
open: () => void;
close: () => void;
toggle: () => void;
} {
const [isOpen, setIsOpen] = useState(initialState);
const open = useCallback(() => setIsOpen(true), []);
const close = useCallback(() => setIsOpen(false), []);
const toggle = useCallback(() => setIsOpen((prev) => !prev), []);

Check warning on line 116 in src/screens/OrganizationPeople/AddMember.tsx

View check run for this annotation

Codecov / codecov/patch

src/screens/OrganizationPeople/AddMember.tsx#L113-L116

Added lines #L113 - L116 were not covered by tests

return { isOpen, open, close, toggle };

Check warning on line 118 in src/screens/OrganizationPeople/AddMember.tsx

View check run for this annotation

Codecov / codecov/patch

src/screens/OrganizationPeople/AddMember.tsx#L118

Added line #L118 was not covered by tests
}
const {
isOpen: createNewUserModalisOpen,
open: openCreateNewUserModal,
close: closeCreateNewUserModal,
} = useModal();

Check warning on line 124 in src/screens/OrganizationPeople/AddMember.tsx

View check run for this annotation

Codecov / codecov/patch

src/screens/OrganizationPeople/AddMember.tsx#L124

Added line #L124 was not covered by tests
const createMember = async (userId: string): Promise<void> => {
try {
await addMember({
Expand All @@ -133,7 +139,7 @@
}
};

const { orgId: currentUrl } = useParams();
const { orgId: currentUrl } = useParams<{ orgId: string }>();

Check warning on line 142 in src/screens/OrganizationPeople/AddMember.tsx

View check run for this annotation

Codecov / codecov/patch

src/screens/OrganizationPeople/AddMember.tsx#L142

Added line #L142 was not covered by tests

const [showPassword, setShowPassword] = useState<boolean>(false);
const [showConfirmPassword, setShowConfirmPassword] =
Expand Down Expand Up @@ -356,10 +362,10 @@
<TableRow>
<StyledTableCell>#</StyledTableCell>
<StyledTableCell align="center">
{translateAddMember('profile')}
{translateOrgPeople('profile')}
</StyledTableCell>
<StyledTableCell align="center">
{translateAddMember('user')}
{translateOrgPeople('user')}
</StyledTableCell>
<StyledTableCell align="center">
{translateAddMember('addMember')}
Expand Down Expand Up @@ -401,7 +407,7 @@
</StyledTableCell>
<StyledTableCell align="center">
<Link
className={`${styles.membername} ${styles.subtleBlueGrey}`}
className={`${styles.membername} ${styles.subtleBlueGrey} ${styles.blueText}`}
to={{
pathname: `/member/${currentUrl}`,
}}
Expand Down Expand Up @@ -440,19 +446,15 @@
<Modal
data-testid="addNewUserModal"
show={createNewUserModalisOpen}
onHide={toggleCreateNewUserModal}
onHide={closeCreateNewUserModal} // Use the close function directly
>
<Modal.Header
className={styles.createUserModalHeader}
data-testid="createUser"
>
<Modal.Header closeButton className={styles.createUserModalHeader}>
<Modal.Title>Create User</Modal.Title>
</Modal.Header>
<Modal.Body>
<div className="my-3">
<div className="row">
<div className="col-sm-6">
<h6>{translateOrgPeople('firstName')}</h6>
<InputGroup className="mt-2 mb-4">
<Form.Control
placeholder={translateOrgPeople('enterFirstName')}
Expand All @@ -464,7 +466,6 @@
</InputGroup>
</div>
<div className="col-sm-6">
<h6>{translateOrgPeople('lastName')}</h6>
<InputGroup className="mt-2 mb-4">
<Form.Control
placeholder={translateOrgPeople('enterLastName')}
Expand All @@ -476,7 +477,7 @@
</InputGroup>
</div>
</div>
<h6>{translateOrgPeople('emailAddress')}</h6>

<InputGroup className="mt-2 mb-4">
<Form.Control
placeholder={translateOrgPeople('enterEmail')}
Expand All @@ -492,7 +493,7 @@
<EmailOutlinedIcon className={`${styles.colorWhite}`} />
</InputGroup.Text>
</InputGroup>
<h6>{translateOrgPeople('password')}</h6>

<InputGroup className="mt-2 mb-4">
<Form.Control
placeholder={translateOrgPeople('enterPassword')}
Expand All @@ -514,7 +515,7 @@
)}
</InputGroup.Text>
</InputGroup>
<h6>{translateOrgPeople('confirmPassword')}</h6>

<InputGroup className="mt-2 mb-4">
<Form.Control
placeholder={translateOrgPeople('enterConfirmPassword')}
Expand All @@ -536,7 +537,7 @@
)}
</InputGroup.Text>
</InputGroup>
<h6>{translateOrgPeople('organization')}</h6>

<InputGroup className="mt-2 mb-4">
<Form.Control
className={styles.borderNone}
Expand All @@ -550,21 +551,15 @@
<Modal.Footer>
<div className={styles.createUserActionBtns}>
<Button
className={`${styles.removeButton}`}
variant="danger"
onClick={closeCreateNewUserModal}
data-testid="closeBtn"
>
<Close className={styles.closeButton} />
{translateOrgPeople('cancel')}
</Button>
<Button
className={`${styles.addButton}`}
className={`${styles.colorPrimary} ${styles.borderNone}`}
variant="success"
onClick={handleCreateUser}
data-testid="createBtn"
style={{
border: '1px solid var(--dropdown-border-color)',
width: '100%',
}}
>
<Check className={styles.searchIcon} />
{translateOrgPeople('create')}
</Button>
</div>
Expand Down
Loading
Loading