mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-18 03:41:44 +03:00
8fc8c5e3ed
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate):
37 lines
895 B
TypeScript
37 lines
895 B
TypeScript
import { UUID } from "crypto";
|
|
|
|
import { MessageInfoBox } from "@/lib/components/ui/MessageInfoBox/MessageInfoBox";
|
|
|
|
import { BrainUser } from "./components/BrainUser/BrainUser";
|
|
import { useBrainUsers } from "./hooks/useBrainUsers";
|
|
|
|
type BrainUsersProps = {
|
|
brainId: UUID;
|
|
};
|
|
export const BrainUsers = ({ brainId }: BrainUsersProps): JSX.Element => {
|
|
const { brainUsers, fetchBrainUsers } = useBrainUsers(brainId);
|
|
|
|
if (brainUsers.length === 0) {
|
|
return (
|
|
<MessageInfoBox
|
|
type="info"
|
|
content="You're the only user to have access to this brain."
|
|
/>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<>
|
|
{brainUsers.map((subscription) => (
|
|
<BrainUser
|
|
key={subscription.email}
|
|
email={subscription.email}
|
|
role={subscription.role}
|
|
brainId={brainId}
|
|
fetchBrainUsers={fetchBrainUsers}
|
|
/>
|
|
))}
|
|
</>
|
|
);
|
|
};
|