quivr/frontend/app/studio/[brainId]/BrainManagementTabs/components/PeopleTab/BrainUsers/BrainUsers.tsx
Antoine Dewez 8fc8c5e3ed
fix(frontend): revamp quivr studio (#2274)
# 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):
2024-02-28 16:42:14 -08:00

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}
/>
))}
</>
);
};