Skip to content

refactor: Remove user roles from dropdown #4419

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ describe("UserDropdownContent", () => {
expect(screen.getByText(Language.signOutLabel)).toBeDefined()
})

it("displays the user's roles", () => {
render(<UserDropdownContent user={MockUser} onSignOut={jest.fn()} onPopoverClose={jest.fn()} />)

expect(screen.getByText(MockOwnerRole.display_name)).toBeDefined()
})

it("has the correct link for the account item", () => {
render(<UserDropdownContent user={MockUser} onSignOut={jest.fn()} onPopoverClose={jest.fn()} />)

Expand Down
23 changes: 0 additions & 23 deletions site/src/components/UserDropdownContent/UserDropdownContent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Chip from "@material-ui/core/Chip"
import Divider from "@material-ui/core/Divider"
import ListItemIcon from "@material-ui/core/ListItemIcon"
import ListItemText from "@material-ui/core/ListItemText"
Expand All @@ -9,7 +8,6 @@ import AccountIcon from "@material-ui/icons/AccountCircleOutlined"
import { FC } from "react"
import { Link } from "react-router-dom"
import * as TypesGen from "../../api/typesGenerated"
import { Role } from "../../api/typesGenerated"
import { navHeight } from "../../theme/constants"
import { DocsIcon } from "../Icons/DocsIcon"
import { LogoutIcon } from "../Icons/LogoutIcon"
Expand Down Expand Up @@ -46,13 +44,6 @@ export const UserDropdownContent: FC<UserDropdownContentProps> = ({
</div>
<Typography className={styles.userName}>{user.username}</Typography>
<Typography className={styles.userEmail}>{user.email}</Typography>
<ul className={styles.chipContainer}>
{user.roles.map((role: Role) => (
<li key={role.name} className={styles.chipStyles}>
<Chip classes={{ root: styles.chipRoot }} label={role.display_name} />
</li>
))}
</ul>
</div>

<Divider />
Expand Down Expand Up @@ -123,20 +114,6 @@ const useStyles = makeStyles((theme) => ({
letterSpacing: 0.2,
color: theme.palette.text.secondary,
},
chipContainer: {
display: "flex",
justifyContent: "center",
flexWrap: "wrap",
listStyle: "none",
margin: "0",
padding: `${theme.spacing(1.5)}px ${theme.spacing(2.75)}px`,
},
chipStyles: {
margin: theme.spacing(0.5),
},
chipRoot: {
backgroundColor: theme.palette.secondary.dark,
},
link: {
textDecoration: "none",
color: "inherit",
Expand Down