Skip to content

Commit 48a04cd

Browse files
authored
style of the sharing table; link to the group/{group_id} page (#967)
* style of the sharing table; link to the group/{group_id} page * precommits
1 parent 656d364 commit 48a04cd

File tree

4 files changed

+31
-22
lines changed

4 files changed

+31
-22
lines changed

frontend/src/components/sharing/GroupAndRoleSubTable.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React from "react";
22
import TableContainer from "@mui/material/TableContainer";
33
import Table from "@mui/material/Table";
4-
import TableHead from "@mui/material/TableHead";
5-
import TableRow from "@mui/material/TableRow";
6-
import TableCell from "@mui/material/TableCell";
74
import TableBody from "@mui/material/TableBody";
85
import { GroupAndRoleSubTableEntry } from "./GroupAndRoleSubTableEntry";
96
import { GroupOut } from "../../openapi/v2";
7+
import { TableRow } from "@mui/material";
8+
import TableCell from "@mui/material/TableCell";
9+
import TableHead from "@mui/material/TableHead";
1010

1111
type GroupAndRoleSubTableProps = {
1212
group: GroupOut;
@@ -20,15 +20,17 @@ export function GroupAndRoleSubTable(props: GroupAndRoleSubTableProps) {
2020
<Table
2121
sx={{
2222
minWidth: 650,
23-
backgroundColor: "#EEEEEE",
23+
fontSize: "0.8rem",
2424
}}
25-
aria-label="simple table"
25+
size="small"
26+
aria-label="group and roles table"
2627
>
2728
<TableHead>
2829
<TableRow>
2930
<TableCell />
30-
<TableCell align="right">Name</TableCell>
31-
<TableCell align="right">Email</TableCell>
31+
<TableCell>Member Name</TableCell>
32+
<TableCell align="right">Member Email</TableCell>
33+
<TableCell align="right" />
3234
<TableCell align="right" />
3335
</TableRow>
3436
</TableHead>

frontend/src/components/sharing/GroupAndRoleSubTableEntry.tsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from "react";
22
import TableRow from "@mui/material/TableRow";
33
import TableCell from "@mui/material/TableCell";
44
import { UserOut } from "../../openapi/v2";
5-
import { Button } from "@mui/material";
5+
import { Link } from "@mui/material";
66
import { theme } from "../../theme";
77
import Gravatar from "react-gravatar";
88
import PersonIcon from "@mui/icons-material/Person";
@@ -14,6 +14,8 @@ type GroupAndRoleSubTableEntryProps = {
1414
const iconStyle = {
1515
verticalAlign: "middle",
1616
color: theme.palette.primary.main,
17+
width: "20px",
18+
marginRight: "0.5em",
1719
};
1820

1921
export function GroupAndRoleSubTableEntry(
@@ -24,30 +26,38 @@ export function GroupAndRoleSubTableEntry(
2426
return (
2527
<TableRow
2628
key={user.id}
27-
sx={{ "&:last-child td, &:last-child th": { border: 0 } }}
29+
sx={{
30+
"&:last-child td, &:last-child th": {
31+
border: 0,
32+
},
33+
paddingLeft: 0,
34+
}}
2835
>
2936
<TableCell />
30-
<TableCell align="right">
37+
<TableCell align="left">
3138
{user.email ? (
3239
<Gravatar
3340
email={user.email}
3441
rating="g"
3542
style={{
36-
width: "32px",
37-
height: "32px",
43+
width: "20px",
44+
height: "20px",
3845
borderRadius: "50%",
3946
verticalAlign: "middle",
47+
marginRight: "0.5em",
4048
}}
4149
/>
4250
) : (
4351
<PersonIcon sx={iconStyle} />
4452
)}
45-
<Button>
53+
{/*TODO once personal profile page is ready link to it*/}
54+
<Link sx={{ textDecoration: "None" }}>
4655
{user.first_name} {user.last_name}
47-
</Button>
56+
</Link>
4857
</TableCell>
4958
<TableCell align="right">{user.email}</TableCell>
5059
<TableCell align="right" />
60+
<TableCell align="right" />
5161
</TableRow>
5262
);
5363
}

frontend/src/components/sharing/GroupAndRoleTable.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from "react";
22
import { RootState } from "../../types/data";
3-
import { useDispatch, useSelector } from "react-redux";
4-
import { useParams } from "react-router-dom";
3+
import { useSelector } from "react-redux";
54
import TableContainer from "@mui/material/TableContainer";
65
import Table from "@mui/material/Table";
76
import TableHead from "@mui/material/TableHead";
@@ -11,10 +10,6 @@ import TableBody from "@mui/material/TableBody";
1110
import { GroupAndRoleTableEntry } from "./GroupAndRoleTableEntry";
1211

1312
export const GroupAndRoleTable = (): JSX.Element => {
14-
const { datasetId } = useParams<{ datasetId?: string }>();
15-
16-
const dispatch = useDispatch();
17-
1813
const datasetRolesList = useSelector(
1914
(state: RootState) => state.dataset.roles
2015
);

frontend/src/components/sharing/GroupAndRoleTableEntry.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
removeDatasetGroupRole,
3333
setDatasetGroupRole,
3434
} from "../../actions/dataset";
35-
import { useParams } from "react-router-dom";
35+
import { Link as RouterLink, useParams } from "react-router-dom";
3636
import { GroupAndRoleSubTable } from "./GroupAndRoleSubTable";
3737

3838
type GroupAndRoleTableEntryProps = {
@@ -133,7 +133,9 @@ export function GroupAndRoleTableEntry(props: GroupAndRoleTableEntryProps) {
133133
</TableCell>
134134
<TableCell>
135135
<GroupIcon sx={iconStyle} />
136-
<Button>{group_role.group.name}</Button>
136+
<Button component={RouterLink} to={`/groups/${group_role.group.id}`}>
137+
{group_role.group.name}
138+
</Button>
137139
</TableCell>
138140
<TableCell align="right">
139141
{group_role.group.users ? group_role.group.users.length : 0} members

0 commit comments

Comments
 (0)