- Notifications
You must be signed in to change notification settings - Fork1.1k
chore: update table component and styles#16541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,6 @@ | ||
| import PersonAdd from "@mui/icons-material/PersonAdd"; | ||
| import LoadingButton from "@mui/lab/LoadingButton"; | ||
| import { getErrorMessage } from "api/errors"; | ||
| import type { | ||
| Group, | ||
| OrganizationMemberWithUserData, | ||
| @@ -28,6 +20,13 @@ import { | ||
| } from "components/MoreMenu/MoreMenu"; | ||
| import { SettingsHeader } from "components/SettingsHeader/SettingsHeader"; | ||
| import { Stack } from "components/Stack/Stack"; | ||
| import { | ||
| Table, | ||
| TableBody, | ||
| TableCell, | ||
| TableHeader, | ||
| TableRow, | ||
| } from "components/Table/Table"; | ||
| import { UserAutocomplete } from "components/UserAutocomplete/UserAutocomplete"; | ||
| import { UserGroupsCell } from "pages/UsersPage/UsersTable/UserGroupsCell"; | ||
| import { type FC, useState } from "react"; | ||
| @@ -80,83 +79,80 @@ export const OrganizationMembersPageView: FC< | ||
| onSubmit={addMember} | ||
| /> | ||
| )} | ||
| <Table> | ||
| <TableHeader> | ||
| <TableRow> | ||
| <TableCell width="33%">User</TableCell> | ||
| <TableCell width="33%"> | ||
| <Stack direction="row" spacing={1} alignItems="center"> | ||
| <span>Roles</span> | ||
| <TableColumnHelpTooltip variant="roles" /> | ||
| </Stack> | ||
| </TableCell> | ||
| <TableCell width="33%"> | ||
| <Stack direction="row" spacing={1} alignItems="center"> | ||
| <span>Groups</span> | ||
| <TableColumnHelpTooltip variant="groups" /> | ||
| </Stack> | ||
| </TableCell> | ||
| <TableCell width="1%" /> | ||
| </TableRow> | ||
| </TableHeader> | ||
| <TableBody> | ||
| {members?.map((member) => ( | ||
| <TableRow key={member.user_id} className="align-baseline"> | ||
| <TableCell> | ||
| <AvatarData | ||
| avatar={ | ||
| <Avatar | ||
| fallback={member.username} | ||
| src={member.avatar_url} | ||
| /> | ||
| } | ||
| title={member.name || member.username} | ||
| subtitle={member.email} | ||
| /> | ||
| </TableCell> | ||
| <UserRoleCell | ||
| inheritedRoles={member.global_roles} | ||
| roles={member.roles} | ||
| allAvailableRoles={allAvailableRoles} | ||
| oidcRoleSyncEnabled={false} | ||
| isLoading={isUpdatingMemberRoles} | ||
| canEditUsers={canEditMembers} | ||
| onEditRoles={async (roles) => { | ||
| try { | ||
| await updateMemberRoles(member, roles); | ||
| displaySuccess("Roles updated successfully."); | ||
| } catch (error) { | ||
| displayError( | ||
| getErrorMessage(error, "Failed to update roles."), | ||
| ); | ||
| } | ||
| }} | ||
| /> | ||
| <UserGroupsCell userGroups={member.groups} /> | ||
| <TableCell> | ||
| {member.user_id !== me.id && canEditMembers && ( | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. nit: I personally try to avoid conditional rendering with But I see ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Ya you will notice this this pattern everywhere the component is used. I think right now ternaries only get used if there is something to return in both the true and false case. | ||
| <MoreMenu> | ||
| <MoreMenuTrigger> | ||
| <ThreeDotsButton /> | ||
| </MoreMenuTrigger> | ||
| <MoreMenuContent> | ||
| <MoreMenuItem | ||
| danger | ||
| onClick={() => removeMember(member)} | ||
| > | ||
| Remove | ||
| </MoreMenuItem> | ||
| </MoreMenuContent> | ||
| </MoreMenu> | ||
| )} | ||
| </TableCell> | ||
| </TableRow> | ||
| ))} | ||
| </TableBody> | ||
| </Table> | ||
| </Stack> | ||
| </div> | ||
| ); | ||
| @@ -190,7 +186,7 @@ const AddOrganizationMember: FC<AddOrganizationMemberProps> = ({ | ||
| > | ||
| <Stack direction="row" alignItems="center" spacing={1}> | ||
| <UserAutocomplete | ||
| className="w-[300px]" | ||
| value={selectedUser} | ||
| onChange={(newValue) => { | ||
| setSelectedUser(newValue); | ||
| @@ -210,17 +206,3 @@ const AddOrganizationMember: FC<AddOrganizationMemberProps> = ({ | ||
| </form> | ||
| ); | ||
| }; | ||
Uh oh!
There was an error while loading.Please reload this page.