Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

[Fix] Optimised Top Bar component to take functional component (#803)

jagadeeswaran-zipstack1d65ac1046c7
diff --git a/frontend/src/components/settings/users/Users.jsx b/frontend/src/components/settings/users/Users.jsx
index 28db02ae0..0724f9555 100644
--- a/frontend/src/components/settings/users/Users.jsx
+++ b/frontend/src/components/settings/users/Users.jsx
@@ -179,26 +179,6 @@ function Users() {
// If an error occurs while setting custom posthog event, ignore it and continue
}
};
-
- const inviteUserButtons = () => {
- return (
- <>
- <CustomButton
- type="primary"
- icon={<PlusOutlined />}
- onClick={handleInviteUsers}
- >
- Invite User
- </CustomButton>
- <Button
- shape="circle"
- icon={<ReloadOutlined />}
- onClick={getAllUsers}
- className="user-reload-button"
- />
- </>
- );
- };
useEffect(() => {
getAllUsers();
}, []);
@@ -206,15 +186,29 @@ function Users() {
useEffect(() => {
setFilteredUserList(userList);
}, [userList]);
+
return (
<>
<TopBar
- CustomButtons={inviteUserButtons}
enableSearch={true}
title="Manage Users"
searchData={userList}
setFilteredUserList={setFilteredUserList}
- />
+ >
+ <CustomButton
+ type="primary"
+ icon={<PlusOutlined />}
+ onClick={handleInviteUsers}
+ >
+ Invite User
+ </CustomButton>
+ <Button
+ shape="circle"
+ icon={<ReloadOutlined />}
+ onClick={getAllUsers}
+ className="user-reload-button"
+ />
+ </TopBar>
<div className="user-bg-col">
<IslandLayout>
<div className="user-table">
diff --git a/frontend/src/components/widgets/top-bar/TopBar.jsx b/frontend/src/components/widgets/top-bar/TopBar.jsx
index ddda41a1c..fb41012d3 100644
--- a/frontend/src/components/widgets/top-bar/TopBar.jsx
+++ b/frontend/src/components/widgets/top-bar/TopBar.jsx
@@ -8,9 +8,9 @@ import { useNavigate } from "react-router-dom";
function TopBar({
title,
enableSearch,
- CustomButtons,
searchData,
setFilteredUserList,
+ children,
}) {
const navigate = useNavigate();
const onSearchDebounce = debounce(({ target: { value } }) => {
@@ -41,7 +41,7 @@ function TopBar({
{enableSearch && (
<Input placeholder="Search Users" onChange={onSearchDebounce} />
)}
- {CustomButtons && <CustomButtons />}
+ {children}
</div>
</Col>
</Row>
@@ -51,9 +51,9 @@ function TopBar({
TopBar.propTypes = {
title: PropTypes.string.isRequired,
enableSearch: PropTypes.bool.isRequired,
- CustomButtons: PropTypes.func,
searchData: PropTypes.array,
setFilteredUserList: PropTypes.func,
+ children: PropTypes.element,
};
export { TopBar };