Skip to content

Commit

Permalink
lint fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulch07 committed Jan 29, 2025
1 parent 6ba53c3 commit 735641e
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 65 deletions.
7 changes: 3 additions & 4 deletions src/components/OrgListCard/OrgListCard.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,11 @@ const props: InterfaceOrgListCardPropsPG = {
id: 'xyz',
name: 'Dogs Care',
avatarURL: 'https://api.dicebear.com/5.x/initials/svg?seed=John%20Doe',
description: "Dog care center",
description: 'Dog care center',
members: {
edges: [
]
edges: [],
},
addressLine1: "Texas, USA"
addressLine1: 'Texas, USA',
},
};

Expand Down
12 changes: 4 additions & 8 deletions src/components/OrgListCard/OrgListCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export interface InterfaceOrgListCardPropsPG {
*/
function orgListCard(props: InterfaceOrgListCardPropsPG): JSX.Element {
// Destructure data from props
const { id, avatarURL, addressLine1, name, description, members } = props.data;
const { id, avatarURL, addressLine1, name, description, members } =
props.data;

// Query to check if the organization is a sample organization
const { data } = useQuery(IS_SAMPLE_ORGANIZATION_QUERY, {
Expand All @@ -63,7 +64,6 @@ function orgListCard(props: InterfaceOrgListCardPropsPG): JSX.Element {
// Handle click event to navigate to the organization dashboard
function handleClick(): void {
// const url = '/orgdash/' + id;

// Dont change the below two lines
// navigate(url);
}
Expand Down Expand Up @@ -97,17 +97,13 @@ function orgListCard(props: InterfaceOrgListCardPropsPG): JSX.Element {
</Tooltip>
{/* Description of the organization */}
<div className={`${styles.orgdesc} fw-semibold`}>
<TruncatedText
text={description || ''}
/>
<TruncatedText text={description || ''} />
</div>

{/* Display the organization address if available */}
{addressLine1 && (
<div className={styles.address}>
<TruncatedText
text={`${addressLine1}`}
/>
<TruncatedText text={`${addressLine1}`} />
</div>
)}
{/* Display the number of admins and members */}
Expand Down
8 changes: 4 additions & 4 deletions src/components/ProfileDropdown/ProfileDropdown.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('ProfileDropdown Component', () => {
});

test('renders Super admin', () => {
setItem('role', "API Administrator");
setItem('role', 'API Administrator');
render(
<MockedProvider mocks={MOCKS} addTypename={false}>
<BrowserRouter>
Expand All @@ -110,7 +110,7 @@ describe('ProfileDropdown Component', () => {
expect(screen.getByText('API Administrator')).toBeInTheDocument();
});
test('renders Admin', () => {
setItem('role', "administrator");
setItem('role', 'administrator');
render(
<MockedProvider mocks={MOCKS} addTypename={false}>
<BrowserRouter>
Expand Down Expand Up @@ -141,7 +141,7 @@ describe('ProfileDropdown Component', () => {

describe('Member screen routing testing', () => {
test('member screen', async () => {
setItem('role', "regular")
setItem('role', 'regular');

render(
<MockedProvider mocks={MOCKS} addTypename={false}>
Expand All @@ -166,7 +166,7 @@ describe('ProfileDropdown Component', () => {
});

test('navigates to /user/settings for a user', async () => {
setItem('role', "regular");
setItem('role', 'regular');

render(
<MockedProvider mocks={MOCKS} addTypename={false}>
Expand Down
4 changes: 2 additions & 2 deletions src/screens/LoginPage/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ const loginPage = (): JSX.Element => {
setItem('IsLoggedIn', 'TRUE');
setItem('name', user.name);
setItem('email', user.emailAddress);
setItem('role', user.role)
setItem('UserImage', user.avatraURL|| "")
setItem('role', user.role);
setItem('UserImage', user.avatraURL || '');
// setItem('FirstName', user.firstName);
// setItem('LastName', user.lastName);
// setItem('UserImage', user.avatarURL);
Expand Down
4 changes: 2 additions & 2 deletions src/screens/OrgList/OrgList.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ describe('Organisations Page testing as SuperAdmin', () => {
test('Should render no organisation warning alert when there are no organization', async () => {
window.location.assign('/');
setItem('id', '123');
setItem('role', "administrator");
setItem('role', 'administrator');

render(
<MockedProvider addTypename={false} link={link2}>
Expand All @@ -168,7 +168,7 @@ describe('Organisations Page testing as SuperAdmin', () => {

test('Testing Organization data is not present', async () => {
setItem('id', '123');
setItem('role', "administrator");
setItem('role', 'administrator');

render(
<MockedProvider addTypename={false} link={link2}>
Expand Down
15 changes: 10 additions & 5 deletions src/screens/OrgList/OrgList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { errorHandler } from 'utils/errorHandler';
import type {
InterfaceCurrentUserTypePG,
InterfaceOrgConnectionInfoType,
InterfaceOrgConnectionTypePG
InterfaceOrgConnectionTypePG,
} from 'utils/interfaces';
import useLocalStorage from 'utils/useLocalstorage';
import styles from '../../style/app.module.css';
Expand Down Expand Up @@ -158,7 +158,6 @@ function orgList(): JSX.Element {
notifyOnNetworkStatusChange: true,
});


const orgsData = UsersOrgsData?.user.organizationsWhereMember;

// To clear the search field and form fields on unmount
Expand Down Expand Up @@ -308,13 +307,19 @@ function orgList(): JSX.Element {
skip: orgsData?.edges?.length || 0,
},
updateQuery: (
prev: { organizationsConnection: InterfaceOrgConnectionTypePG[] } | undefined,
prev:
| { organizationsConnection: InterfaceOrgConnectionTypePG[] }
| undefined,
{
fetchMoreResult,
}: {
fetchMoreResult: { organizationsConnection: InterfaceOrgConnectionTypePG[] } | undefined;
fetchMoreResult:
| { organizationsConnection: InterfaceOrgConnectionTypePG[] }
| undefined;
},
): { organizationsConnection: InterfaceOrgConnectionTypePG[] } | undefined => {
):
| { organizationsConnection: InterfaceOrgConnectionTypePG[] }
| undefined => {
setIsLoadingMore(false);
if (!fetchMoreResult) return prev;
if (fetchMoreResult.organizationsConnection.length < perPageResult) {
Expand Down
74 changes: 36 additions & 38 deletions src/screens/OrgList/OrgListMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,49 +34,47 @@ const organizations: InterfaceOrgConnectionInfoTypePG[] = [
id: 'xyz',
name: 'Dogs Care',
avatarURL: 'https://api.dicebear.com/5.x/initials/svg?seed=John%20Doe',
description: "Dog care center",
description: 'Dog care center',
members: {
edges: [

]
edges: [],
},
addressLine1: "Texas, USA"
addressLine1: 'Texas, USA',
},
];

for (let x = 0; x < 1; x++) {
organizations.push({
_id: 'a' + x,
image: '',
name: 'name',
creator: {
_id: '123',
firstName: 'firstName',
lastName: 'lastName',
},
admins: [
{
_id: x + '1',
},
],
members: [
{
_id: x + '2',
},
],
createdAt: new Date().toISOString(),
address: {
city: 'Kingston',
countryCode: 'JM',
dependentLocality: 'Sample Dependent Locality',
line1: '123 Jamaica Street',
line2: 'Apartment 456',
postalCode: 'JM12345',
sortingCode: 'ABC-123',
state: 'Kingston Parish',
},
});
}
// for (let x = 0; x < 1; x++) {
// organizations.push({
// _id: 'a' + x,
// image: '',
// name: 'name',
// creator: {
// _id: '123',
// firstName: 'firstName',
// lastName: 'lastName',
// },
// admins: [
// {
// _id: x + '1',
// },
// ],
// members: [
// {
// _id: x + '2',
// },
// ],
// createdAt: new Date().toISOString(),
// address: {
// city: 'Kingston',
// countryCode: 'JM',
// dependentLocality: 'Sample Dependent Locality',
// line1: '123 Jamaica Street',
// line2: 'Apartment 456',
// postalCode: 'JM12345',
// sortingCode: 'ABC-123',
// state: 'Kingston Parish',
// },
// });
// }

// MOCKS FOR SUPERADMIN
const MOCKS = [
Expand Down
6 changes: 4 additions & 2 deletions src/screens/OrgList/OrganizationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { Modal, Form, Row, Col, Button } from 'react-bootstrap';
import convertToBase64 from 'utils/convertToBase64';
import type { ChangeEvent } from 'react';
import styles from '../../style/app.module.css';
import type { InterfaceAddress, InterfaceCurrentUserTypePG } from 'utils/interfaces';
import type {
InterfaceAddress,
InterfaceCurrentUserTypePG,
} from 'utils/interfaces';
import { countryOptions } from 'utils/formEnumFields';
import useLocalStorage from 'utils/useLocalstorage';

Expand Down Expand Up @@ -39,7 +42,6 @@ interface InterfaceFormStateType {
image: string;
}


/**
* Represents the properties of the OrganizationModal component.
*/
Expand Down

0 comments on commit 735641e

Please sign in to comment.