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: Update users page to looks like others#1850

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/update-user-page
May 27, 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
23 changes: 23 additions & 0 deletionssite/src/components/AvatarData/AvatarData.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
import { Story } from "@storybook/react"
import React from "react"
import { AvatarData, AvatarDataProps } from "./AvatarData"

export default {
title: "components/AvatarData",
component: AvatarData,
}

const Template: Story<AvatarDataProps> = (args: AvatarDataProps) => <AvatarData {...args} />

export const Example = Template.bind({})
Example.args = {
title: "coder",
subtitle: "coder@coder.com",
}

export const WithLink = Template.bind({})
WithLink.args = {
title: "coder",
subtitle: "coder@coder.com",
link: "/users/coder",
}
67 changes: 67 additions & 0 deletionssite/src/components/AvatarData/AvatarData.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
importAvatarfrom"@material-ui/core/Avatar"
importLinkfrom"@material-ui/core/Link"
import{makeStyles}from"@material-ui/core/styles"
importReactfrom"react"
import{LinkasRouterLink}from"react-router-dom"
import{combineClasses}from"../../util/combineClasses"
import{firstLetter}from"../../util/firstLetter"

exportinterfaceAvatarDataProps{
title:string
subtitle:string
link?:string
}

exportconstAvatarData:React.FC<AvatarDataProps>=({ title, subtitle, link})=>{
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I didn't find a better name for it 😓

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Seems fine!

BrunoQuaresma reacted with thumbs up emoji
conststyles=useStyles()

return(
<divclassName={styles.root}>
<Avatarvariant="square"className={styles.avatar}>
{firstLetter(title)}
</Avatar>

{link ?(
<Linkcomponent={RouterLink}to={link}className={combineClasses([styles.info,styles.link])}>
<b>{title}</b>
<span>{subtitle}</span>
</Link>
) :(
<divclassName={styles.info}>
<b>{title}</b>
<span>{subtitle}</span>
</div>
)}
</div>
)
}

constuseStyles=makeStyles((theme)=>({
root:{
display:"flex",
alignItems:"center",
},
avatar:{
borderRadius:2,
marginRight:theme.spacing(1),
width:24,
height:24,
fontSize:16,
},
info:{
display:"flex",
flexDirection:"column",
color:theme.palette.text.primary,

"& span":{
fontSize:12,
color:theme.palette.text.secondary,
},
},
link:{
textDecoration:"none",
"&:hover":{
textDecoration:"underline",
},
},
}))
28 changes: 0 additions & 28 deletionssite/src/components/Header/Header.test.tsx
View file
Open in desktop

This file was deleted.

118 changes: 0 additions & 118 deletionssite/src/components/Header/Header.tsx
View file
Open in desktop

This file was deleted.

35 changes: 0 additions & 35 deletionssite/src/components/HeaderButton/HeaderButton.tsx
View file
Open in desktop

This file was deleted.

5 changes: 5 additions & 0 deletionssite/src/components/RoleSelect/RoleSelect.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -55,5 +55,10 @@ const useStyles = makeStyles((theme: Theme) => ({
// Set a fixed width for the select. It avoids selects having different sizes
// depending on how many roles they have selected.
width: theme.spacing(25),
"& .MuiSelect-root": {
// Adjusting padding because it does not have label
paddingTop: theme.spacing(1.5),
paddingBottom: theme.spacing(1.5),
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Added these because the select when there is no label is very BIG.

},
},
}))
4 changes: 2 additions & 2 deletionssite/src/components/UsersTable/UsersTable.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,11 +6,11 @@ import TableHead from "@material-ui/core/TableHead"
import TableRow from "@material-ui/core/TableRow"
import React from "react"
import * as TypesGen from "../../api/typesGenerated"
import { AvatarData } from "../AvatarData/AvatarData"
import { EmptyState } from "../EmptyState/EmptyState"
import { RoleSelect } from "../RoleSelect/RoleSelect"
import { TableLoader } from "../TableLoader/TableLoader"
import { TableRowMenu } from "../TableRowMenu/TableRowMenu"
import { UserCell } from "../UserCell/UserCell"

export const Language = {
pageTitle: "Users",
Expand DownExpand Up@@ -60,7 +60,7 @@ export const UsersTable: React.FC<UsersTableProps> = ({
users.map((u) => (
<TableRow key={u.id}>
<TableCell>
<UserCell Avatar={{ username:u.username }} primaryText={u.username} caption={u.email} />{" "}
<AvatarData title={u.username} subtitle={u.email} />
</TableCell>
<TableCell>
{canEditUsers ? (
Expand Down
38 changes: 6 additions & 32 deletionssite/src/pages/TemplatesPage/TemplatesPageView.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
import Avatar from "@material-ui/core/Avatar"
import Box from "@material-ui/core/Box"
import Link from "@material-ui/core/Link"
import { makeStyles } from "@material-ui/core/styles"
import Table from "@material-ui/core/Table"
Expand All@@ -12,10 +10,10 @@ import relativeTime from "dayjs/plugin/relativeTime"
import React from "react"
import { Link as RouterLink } from "react-router-dom"
import * as TypesGen from "../../api/typesGenerated"
import { AvatarData } from "../../components/AvatarData/AvatarData"
import { Margins } from "../../components/Margins/Margins"
import { Stack } from "../../components/Stack/Stack"
import { TableLoader } from "../../components/TableLoader/TableLoader"
import { firstLetter } from "../../util/firstLetter"

dayjs.extend(relativeTime)

Expand DownExpand Up@@ -73,15 +71,11 @@ export const TemplatesPageView: React.FC<TemplatesPageViewProps> = (props) => {
{props.templates?.map((template) => (
<TableRow key={template.id}>
<TableCell>
<Box alignItems="center" display="flex">
<Avatar variant="square" className={styles.templateAvatar}>
{firstLetter(template.name)}
</Avatar>
<Link component={RouterLink} to={`/templates/${template.name}`} className={styles.templateLink}>
<b>{template.name}</b>
<span>{template.description}</span>
</Link>
</Box>
<AvatarData
title={template.name}
subtitle={template.description}
link={`/templates/${template.name}`}
/>
</TableCell>

<TableCell>{Language.developerCount(template.workspace_owner_count)}</TableCell>
Expand DownExpand Up@@ -114,24 +108,4 @@ const useStyles = makeStyles((theme) => ({
lineHeight: `${theme.spacing(3)}px`,
},
},
templateAvatar: {
borderRadius: 2,
marginRight: theme.spacing(1),
width: 24,
height: 24,
fontSize: 16,
},
templateLink: {
display: "flex",
flexDirection: "column",
color: theme.palette.text.primary,
textDecoration: "none",
"&:hover": {
textDecoration: "underline",
},
"& span": {
fontSize: 12,
color: theme.palette.text.secondary,
},
},
}))
Loading

[8]ページ先頭

©2009-2025 Movatter.jp