Component.tsx
1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import * as React from "react";
import { Link } from "react-router-dom";
import { List, ListItem } from "material-ui/List";
import Avatar from "material-ui/Avatar";
require("./styles.scss");
interface Props {
user: any;
history: any;
}
class UserPage extends React.Component<Props> {
public render() {
const { user, history } = this.props;
console.log(this.props);
return (
<div className="my-page">
<h2>내 페이지</h2>
<h3>드론 목록</h3>
<List>
{user.drones.map(drone => (
<ListItem
key={drone.id}
primaryText={`${drone.name} (${drone.model.name})`}
leftAvatar={
<Avatar src={`/assets/img/${drone.model.name}.jpg`} />
}
/>
))}
</List>
<h3>허가서 목록</h3>
<List>
{user.contracts.map(contract => (
<ListItem
key={contract.id}
primaryText={`${contract.reason} (${contract.drone.name})`}
leftAvatar={
<Avatar src={`/assets/img/${contract.drone.model.name}.jpg`} />
}
onClick={() => history.push(`/contract/${contract.id}`)}
/>
))}
</List>
<h3>구매한 데이터셋</h3>
<ul>
{user.datasets.map(dataset => (
<li key={dataset.id}>
<h4>데이터</h4>
<p>{dataset.comment}</p>
<h4>촬영한 드론</h4>
<p>{dataset.producer.name}({dataset.producer.model.name})</p>
</li>
))}
</ul>
</div>
);
}
}
export default UserPage;