Files
flipper/desktop/plugins/public/cpu/TemperatureTable.tsx
Pascal Hartig 69c7876be9 Enforce react/jsx-boolean-value
Summary: yarn fix results.

Reviewed By: nikoant

Differential Revision: D28329714

fbshipit-source-id: 564aa24bcdb4bc6cdea67dfad10a077a9c817a2d
2021-05-11 10:14:05 -07:00

77 lines
1.5 KiB
TypeScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import {Component, Text, SearchableTable} from 'flipper';
import React from 'react';
const ColumnSizes = {
thermal_zone: 'flex',
temperature: 'flex',
path: 'flex',
};
const Columns = {
thermal_zone: {
value: 'Thermal Zone',
resizable: true,
},
temperature: {
value: 'Temperature',
resizable: true,
},
path: {
value: 'Path',
resizable: true,
},
};
type TemperatureTableProps = {
temperatureMap: any;
};
export default class TemperatureTable extends Component<TemperatureTableProps> {
buildRow = (tz: string, tempInfo: any) => {
return {
columns: {
thermal_zone: {value: <Text>{tz}</Text>},
temperature: {
value: <Text>{tempInfo.temp.toString()}</Text>,
},
path: {
value: <Text>{tempInfo.path}</Text>,
},
},
key: tz,
};
};
buildRows = () => {
const rows = [];
for (const tz of Object.keys(this.props.temperatureMap).sort()) {
rows.push(this.buildRow(tz, this.props.temperatureMap[tz]));
}
return rows;
};
render() {
return (
<SearchableTable
multiline
autoHeight
floating={false}
zebra
columnSizes={ColumnSizes}
columns={Columns}
rows={this.buildRows()}
grow
/>
);
}
}