-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into production
- Loading branch information
Showing
16 changed files
with
312 additions
and
235 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...ents/BillingDetails/MyBillingTeamDetails/components/AddMembersDrawer/AddMembersDrawer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React, { useState } from "react"; | ||
import { IoMdClose } from "@react-icons/all-files/io/IoMdClose"; | ||
import { Col, Drawer, Row } from "antd"; | ||
import { AddMembersTable } from "./components/AddMembersTable/AddMembersTable"; | ||
import "./addMembersDrawer.scss"; | ||
|
||
interface AppMembersDrawerProps { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
} | ||
|
||
export const AppMembersDrawer: React.FC<AppMembersDrawerProps> = ({ isOpen, onClose }) => { | ||
const [searchValue, setSearchValue] = useState(""); | ||
|
||
return ( | ||
<Drawer | ||
placement="right" | ||
onClose={onClose} | ||
open={isOpen} | ||
width={640} | ||
closeIcon={null} | ||
mask={false} | ||
className="billing-team-members-drawer" | ||
> | ||
<Row className="billing-team-members-drawer-header w-full" justify="space-between" align="middle"> | ||
<Col className="billing-team-members-drawer-header_title">Add members in billing team</Col> | ||
<Col> | ||
<IoMdClose onClick={onClose} /> | ||
</Col> | ||
</Row> | ||
<Col className="billing-team-members-drawer-body"> | ||
<AddMembersTable searchValue={searchValue} setSearchValue={setSearchValue} /> | ||
</Col> | ||
</Drawer> | ||
); | ||
}; |
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
...ingTeamDetails/components/AddMembersDrawer/components/AddMembersTable/AddMembersTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { useMemo } from "react"; | ||
import { OrgMembersTable } from "features/settings/components/OrgMembers/components/OrgMembersTable/OrgMembersTable"; | ||
import { useSelector } from "react-redux"; | ||
import { getUserAuthDetails } from "store/selectors"; | ||
import { AddMembersTableActions } from "./components/AddMembersTableActions/AddMembersTableActions"; | ||
import { useFetchOrgMembers } from "features/settings/components/OrgMembers/hooks/useFetchOrganizationMembers"; | ||
|
||
interface AddMembersTableProps { | ||
searchValue: string; | ||
setSearchValue: (value: string) => void; | ||
} | ||
|
||
export const AddMembersTable: React.FC<AddMembersTableProps> = ({ searchValue, setSearchValue }) => { | ||
const user = useSelector(getUserAuthDetails); | ||
const { isLoading, organizationMembers } = useFetchOrgMembers(); | ||
|
||
const searchedMembers = useMemo(() => { | ||
if (!organizationMembers) return []; | ||
return organizationMembers?.filter((member: any) => { | ||
return member?.email?.includes(searchValue) && member?.email !== user?.details?.profile?.email; | ||
}); | ||
}, [organizationMembers, searchValue, user?.details?.profile?.email]); | ||
|
||
return ( | ||
<OrgMembersTable | ||
isLoading={isLoading} | ||
searchValue={searchValue} | ||
setSearchValue={setSearchValue} | ||
members={searchedMembers} | ||
actions={(member) => <AddMembersTableActions member={member} />} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import React, { useEffect, useState } from "react"; | ||
import { Col, Drawer, Row } from "antd"; | ||
import { Col } from "antd"; | ||
import { TeamPlanDetails } from "./components/TeamPlanDetails"; | ||
import { BillingTeamMembers } from "./components/BillingTeamMembers"; | ||
import { BillingInvoiceTable } from "./components/BillingInvoiceTable"; | ||
|
@@ -11,9 +11,7 @@ import { BillingTeamRoles } from "../../../types"; | |
import { isCompanyEmail } from "utils/FormattingHelper"; | ||
import { trackBillingTeamViewed } from "features/settings/analytics"; | ||
import { BillingInformation } from "./components/BillingInformation"; | ||
import { OrgMembersTable } from "features/settings/components/OrgMembersTable"; | ||
import { IoMdClose } from "@react-icons/all-files/io/IoMdClose"; | ||
import "./index.scss"; | ||
import { AppMembersDrawer } from "./components/AddMembersDrawer/AddMembersDrawer"; | ||
|
||
export const MyBillingTeamDetails: React.FC = () => { | ||
const { billingId } = useParams(); | ||
|
@@ -68,34 +66,7 @@ export const MyBillingTeamDetails: React.FC = () => { | |
</Col> | ||
)} | ||
|
||
<Drawer | ||
placement="right" | ||
onClose={() => setIsMembersDrawerOpen(false)} | ||
open={isMembersDrawerOpen} | ||
width={640} | ||
closeIcon={null} | ||
mask={false} | ||
className="billing-team-members-drawer" | ||
> | ||
<Row className="billing-team-members-drawer-header w-full" justify="space-between" align="middle"> | ||
<Col className="billing-team-members-drawer-header_title">Add members in billing team</Col> | ||
<Col> | ||
<IoMdClose onClick={() => setIsMembersDrawerOpen(false)} /> | ||
</Col> | ||
</Row> | ||
<Col className="billing-team-members-drawer-body"> | ||
<OrgMembersTable source="add_members_section" /> | ||
</Col> | ||
<Row className="mt-8 billing-team-members-drawer-help" justify="space-between" align="middle"> | ||
<Col> | ||
Couldn't find member?{" "} | ||
<a className="external-link" href="mailto:[email protected]"> | ||
Contact us | ||
</a> | ||
, and we'll assist you in adding your team members. | ||
</Col> | ||
</Row> | ||
</Drawer> | ||
<AppMembersDrawer isOpen={isMembersDrawerOpen} onClose={() => setIsMembersDrawerOpen(false)} /> | ||
</div> | ||
</div> | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
app/src/features/settings/components/OrgMembers/OrgMembers.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { useMemo, useState } from "react"; | ||
import { Col } from "antd"; | ||
import { useSelector } from "react-redux"; | ||
import { getUserAuthDetails } from "store/selectors"; | ||
import { OrgMembersTable } from "./components/OrgMembersTable/OrgMembersTable"; | ||
import { getDomainFromEmail } from "utils/FormattingHelper"; | ||
import { capitalize } from "lodash"; | ||
import { useFetchOrgMembers } from "./hooks/useFetchOrganizationMembers"; | ||
import "./orgMembers.scss"; | ||
|
||
export const OrgMembersView = () => { | ||
const user = useSelector(getUserAuthDetails); | ||
const domain = getDomainFromEmail(user?.details?.profile?.email)?.split(".")[0]; | ||
const { isLoading, organizationMembers } = useFetchOrgMembers(); | ||
const [searchValue, setSearchValue] = useState(""); | ||
|
||
const searchedMembers = useMemo(() => { | ||
if (!organizationMembers) return []; | ||
return organizationMembers?.filter((member: any) => { | ||
return member?.email?.includes(searchValue) && member?.email !== user?.details?.profile?.email; | ||
}); | ||
}, [organizationMembers, searchValue, user?.details?.profile?.email]); | ||
|
||
return ( | ||
<Col className="org-members-table-container"> | ||
<Col className="org-members-table-wrapper"> | ||
<Col className="my-billing-team-title" style={{ alignSelf: "start" }}> | ||
{capitalize(domain)} Members | ||
</Col> | ||
<div className="mt-16"> | ||
<OrgMembersTable | ||
isLoading={isLoading} | ||
members={searchedMembers} | ||
searchValue={searchValue} | ||
setSearchValue={setSearchValue} | ||
/> | ||
</div> | ||
</Col> | ||
</Col> | ||
); | ||
}; |
107 changes: 107 additions & 0 deletions
107
...rc/features/settings/components/OrgMembers/components/OrgMembersTable/OrgMembersTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import React, { ReactNode, useMemo } from "react"; | ||
import { Col, Empty, Input, Row, Table, TableProps } from "antd"; | ||
import { SearchOutlined } from "@ant-design/icons"; | ||
import { OrgMember } from "../../types"; | ||
import "./orgMembersTable.scss"; | ||
|
||
interface OrgMembersTableProps { | ||
isLoading: boolean; | ||
searchValue: string; | ||
members: OrgMember[]; | ||
setSearchValue: (value: string) => void; | ||
actions?: (member: OrgMember) => ReactNode; | ||
} | ||
|
||
export const OrgMembersTable: React.FC<OrgMembersTableProps> = ({ | ||
searchValue, | ||
setSearchValue, | ||
members, | ||
actions, | ||
isLoading, | ||
}) => { | ||
const columns: TableProps<OrgMember>["columns"] = useMemo( | ||
() => [ | ||
{ | ||
title: "Member", | ||
key: "member", | ||
width: 350, | ||
render: (_: any, member) => { | ||
return ( | ||
<Row align="middle" gutter={8}> | ||
<Col> | ||
<img | ||
className="org-member-avatar" | ||
src={ | ||
member?.photoURL.length | ||
? member?.photoURL | ||
: "https://www.gravatar.com/avatar/00000000000000000000000000000000?d=mp&f=y" | ||
} | ||
alt={member?.email} | ||
/> | ||
</Col> | ||
<Col className="org-member-email">{member?.email}</Col> | ||
</Row> | ||
); | ||
}, | ||
defaultSortOrder: "ascend", | ||
showSorterTooltip: false, | ||
sorter: { | ||
compare: (a, b) => a.email.localeCompare(b.email), | ||
}, | ||
}, | ||
{ | ||
title: "", | ||
key: "action", | ||
render: (_: any, member) => { | ||
return actions?.(member); | ||
}, | ||
}, | ||
], | ||
|
||
[actions] | ||
); | ||
|
||
return ( | ||
<Col> | ||
<Col className="org-member-table"> | ||
<Col className="org-member-table-header"> | ||
<Input | ||
value={searchValue} | ||
onChange={(e) => setSearchValue(e.target.value)} | ||
placeholder="Search members" | ||
className="org-member-table-header-input" | ||
suffix={<SearchOutlined />} | ||
/> | ||
</Col> | ||
<Table | ||
className="billing-table" | ||
dataSource={members} | ||
columns={columns} | ||
pagination={false} | ||
scroll={{ y: "74vh" }} | ||
loading={isLoading} | ||
locale={{ | ||
emptyText: ( | ||
<Empty | ||
image={Empty.PRESENTED_IMAGE_SIMPLE} | ||
description={ | ||
!members.length ? ( | ||
<> | ||
Couldn't find member?{" "} | ||
<a className="external-link" href="mailto:[email protected]"> | ||
Contact us | ||
</a>{" "} | ||
and we'll assist you in adding your team members. | ||
</> | ||
) : ( | ||
"No member found" | ||
) | ||
} | ||
/> | ||
), | ||
}} | ||
/> | ||
</Col> | ||
</Col> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.