Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
BrunoQuaresma merged 4 commits intomainfrombq/remove-roles-from-user-dropdown
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes fromall 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
4 changes: 2 additions & 2 deletionssite/src/components/BorderedMenu/BorderedMenu.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,11 +34,11 @@ const useStyles = makeStyles((theme) => ({

"&[data-variant='user-dropdown'] $paperRoot": {
paddingBottom: theme.spacing(1),
width: 292,
minWidth: 292,
},
},
paperRoot: {
width: "292px",
minWidth: 292,
border: `2px solid ${theme.palette.secondary.dark}`,
borderRadius: theme.shape.borderRadius,
boxShadow: theme.shadows[6],
Expand Down
5 changes: 2 additions & 3 deletionssite/src/components/UserDropdown/UsersDropdown.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -85,11 +85,10 @@ export const useStyles = makeStyles((theme) => ({

menuItem: {
height: navHeight,
padding:`${theme.spacing(1.5)}px 0px ${theme.spacing(1.5)}px ${theme.spacing(2.75)}px`,
padding: theme.spacing(1.5, 0),

"&:hover": {
backgroundColor: theme.palette.action.hover,
transition: "background-color 0.3s ease",
backgroundColor: "transparent",
},
},
}))
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
import { screen } from "@testing-library/react"
import {MockOwnerRole,MockUser } from "../../testHelpers/entities"
import { MockUser } from "../../testHelpers/entities"
import { render } from "../../testHelpers/renderHelpers"
import { Language, UserDropdownContent } from "./UserDropdownContent"

Expand All@@ -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
View file
Open in desktop
Original file line numberDiff line numberDiff 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 DownExpand 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 DownExpand Up@@ -94,7 +85,7 @@ export const UserDropdownContent: FC<UserDropdownContentProps> = ({

const useStyles = makeStyles((theme) => ({
root: {
paddingTop: theme.spacing(3),
padding: theme.spacing(3, 2),
textAlign: "center",
},
avatarContainer: {
Expand All@@ -116,27 +107,13 @@ const useStyles = makeStyles((theme) => ({
},
userName: {
fontSize: 16,
marginBottom: theme.spacing(0.5),
marginTop: theme.spacing(1),
},
userEmail: {
fontSize: 14,
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

[8]ページ先頭

©2009-2025 Movatter.jp