-
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathDeviceSummary.tsx
More file actions
73 lines (68 loc) · 1.75 KB
/
DeviceSummary.tsx
File metadata and controls
73 lines (68 loc) · 1.75 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
62
63
64
65
66
67
68
69
70
71
72
73
import { UsbOutlined } from "@ant-design/icons";
import { Skeleton, Space, Typography } from "antd";
import React from "react";
import { Centered } from "renderer/shared/layouts";
import { useQuery } from "@apollo/client";
import gql from "gql";
import { Device } from "./types";
const DeviceDetails: React.FC<{ device?: Device; loading?: boolean }> = ({
device,
loading,
}) => (
<Space direction="vertical" size="large" style={{ width: "100%" }}>
<Centered>
<UsbOutlined
style={{
fontSize: "60px",
marginBottom: "8px",
}}
/>
</Centered>
{loading ? (
<Skeleton title paragraph={{ rows: 2 }} active />
) : (
<Centered>
<Typography.Title style={{ textAlign: "center" }} level={5}>
{device?.productName ?? "-"}
</Typography.Title>
<div>
<Typography.Text style={{ textAlign: "center" }} type="secondary">
{device?.serialNumber ?? "-"}
</Typography.Text>
</div>
<div>
<Typography.Text style={{ textAlign: "center" }} type="secondary">
{device?.vendorId ?? "-"}:{device?.productId ?? "-"}
</Typography.Text>
</div>
</Centered>
)}
</Space>
);
const DeviceSummary: React.FC<{ deviceId: string }> = ({ deviceId }) => {
const { loading, data } = useQuery(
gql(`
query DeviceInfo($deviceId: ID!) {
flashableDevice(id: $deviceId) {
id
productName
serialNumber
vendorId
productId
}
}
`),
{
variables: {
deviceId,
},
}
);
return (
<DeviceDetails
loading={loading}
device={data?.flashableDevice ?? undefined}
/>
);
};
export default DeviceSummary;