Skip to content

Commit d0378af

Browse files
committed
Add third-party buttons at the team view
1 parent 7da1a87 commit d0378af

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

src/components/tables/table.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,9 @@ function Row({ columns, row, index, onRowClick, showRowNumber }) {
5050
onRowClick && onRowClick(row, index)
5151
}}
5252
>
53-
{columns.map(({ key }) => {
53+
{columns.map(({ key, render }) => {
5454
let item =
55-
typeof row[key] === 'function'
56-
? row[key](row, index, columns)
57-
: row[key]
55+
typeof render === 'function' ? render(row, index, columns) : row[key]
5856
if (showRowNumber && key === ' ') {
5957
item = index + 1
6058
}

src/pages/teams/[id]/members-table.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Pagination from '../../../components/pagination'
55
import { serverRuntimeConfig } from '../../../../next.config.js'
66
import * as R from 'ramda'
77
import SearchInput from '../../../components/tables/search-input'
8+
import Button from '../../../components/button'
89
const { DEFAULT_PAGE_SIZE } = serverRuntimeConfig
910

1011
function MembersTable({ rows: allRows, onRowClick }) {
@@ -19,6 +20,43 @@ function MembersTable({ rows: allRows, onRowClick }) {
1920
{ key: 'name', sortable: true },
2021
{ key: 'id', sortable: true },
2122
{ key: 'role', sortable: true },
23+
{
24+
key: '3rd party',
25+
render: ({ name }) => (
26+
<>
27+
<Button
28+
onClick={(e) => {
29+
e.stopPropagation()
30+
window.open(
31+
`https://www.openstreetmap.org/user/${name}`,
32+
'_blank'
33+
)
34+
}}
35+
>
36+
OSM Profile
37+
</Button>
38+
<Button
39+
onClick={(e) => {
40+
e.stopPropagation()
41+
window.open(`https://hdyc.neis-one.org/?${name}`, '_blank')
42+
}}
43+
>
44+
HDYC
45+
</Button>
46+
<Button
47+
onClick={(e) => {
48+
e.stopPropagation()
49+
window.open(
50+
`https://osmcha.org/?filters={"users":[{"label":"${name}","value":"${name}"}]}`,
51+
'_blank'
52+
)
53+
}}
54+
>
55+
OSM Profile
56+
</Button>
57+
</>
58+
),
59+
},
2260
]
2361

2462
let rows = R.sort(

0 commit comments

Comments
 (0)