Spaces:
Running
Running
Upload from GitHub Actions: Merge pull request #8 from datenlabor-bmz/jn-dev
Browse files
frontend/src/components/ModelTable.js
CHANGED
|
@@ -50,10 +50,10 @@ const ModelTable = ({ data, selectedLanguages = [], allLanguages = [] }) => {
|
|
| 50 |
}
|
| 51 |
|
| 52 |
const SliderWithLabel = ({ value, onChange, min, max }) => {
|
| 53 |
-
const p = 10
|
| 54 |
-
const start = value === null ? min : Math.log(value[0]) / Math.log(p)
|
| 55 |
-
const stop = value === null ? max : Math.log(value[1]) / Math.log(p)
|
| 56 |
-
const [_value, _setValue] = useState([start, stop])
|
| 57 |
useEffect(() => {
|
| 58 |
const timer = setTimeout(() => {
|
| 59 |
onChange({
|
|
@@ -61,11 +61,11 @@ const ModelTable = ({ data, selectedLanguages = [], allLanguages = [] }) => {
|
|
| 61 |
// set to "no filter" when (almost) the whole range is selected
|
| 62 |
_value[0] <= min + 0.1 && _value[1] >= max - 0.1
|
| 63 |
? null
|
| 64 |
-
: [p ** _value[0], p ** _value[1]]
|
| 65 |
-
})
|
| 66 |
-
}, 1000)
|
| 67 |
-
return () => clearTimeout(timer)
|
| 68 |
-
}, [_value, onChange, min, max])
|
| 69 |
return (
|
| 70 |
<div style={{ minWidth: '20rem' }}>
|
| 71 |
<div>{formatSize(p ** _value[0])}</div>
|
|
@@ -147,7 +147,11 @@ const ModelTable = ({ data, selectedLanguages = [], allLanguages = [] }) => {
|
|
| 147 |
}
|
| 148 |
|
| 149 |
const costBodyTemplate = rowData => {
|
| 150 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
}
|
| 152 |
|
| 153 |
const getHeaderText = () => {
|
|
|
|
| 50 |
}
|
| 51 |
|
| 52 |
const SliderWithLabel = ({ value, onChange, min, max }) => {
|
| 53 |
+
const p = 10;
|
| 54 |
+
const start = value === null || value[0] === null ? min : Math.log(value[0]) / Math.log(p);
|
| 55 |
+
const stop = value === null || value[1] === null ? max : Math.log(value[1]) / Math.log(p);
|
| 56 |
+
const [_value, _setValue] = useState([start, stop]);
|
| 57 |
useEffect(() => {
|
| 58 |
const timer = setTimeout(() => {
|
| 59 |
onChange({
|
|
|
|
| 61 |
// set to "no filter" when (almost) the whole range is selected
|
| 62 |
_value[0] <= min + 0.1 && _value[1] >= max - 0.1
|
| 63 |
? null
|
| 64 |
+
: [p ** _value[0], p ** _value[1]],
|
| 65 |
+
});
|
| 66 |
+
}, 1000);
|
| 67 |
+
return () => clearTimeout(timer);
|
| 68 |
+
}, [_value, onChange, min, max]);
|
| 69 |
return (
|
| 70 |
<div style={{ minWidth: '20rem' }}>
|
| 71 |
<div>{formatSize(p ** _value[0])}</div>
|
|
|
|
| 147 |
}
|
| 148 |
|
| 149 |
const costBodyTemplate = rowData => {
|
| 150 |
+
return (
|
| 151 |
+
<div style={{ textAlign: 'center' }}>
|
| 152 |
+
{rowData.cost === null ? 'n/a' : `$${rowData.cost.toFixed(2)}`}
|
| 153 |
+
</div>
|
| 154 |
+
)
|
| 155 |
}
|
| 156 |
|
| 157 |
const getHeaderText = () => {
|