Skip to content

Commit 0e91b6c

Browse files
committed
[UI] Run Wizard. Styles was fixed
1 parent 9772aa7 commit 0e91b6c

3 files changed

Lines changed: 31 additions & 3 deletions

File tree

frontend/src/pages/Offers/List/helpers.ts renamed to frontend/src/pages/Offers/List/helpers.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
import React from 'react';
2+
13
import { RequestParam } from '../../../libs/filters';
24

5+
import styles from './styles.module.scss';
6+
37
const rangeSeparator = '..';
48

59
export function convertMiBToGB(mib: number) {
@@ -46,6 +50,20 @@ export const renderRange = (range: { min?: number; max?: number }) => {
4650
return range.min?.toString() ?? range.max?.toString();
4751
};
4852

53+
export const renderRangeJSX = (range: { min?: number; max?: number }) => {
54+
if (typeof range.min === 'number' && typeof range.max === 'number' && range.max != range.min) {
55+
return (
56+
<>
57+
{round(range.min)}
58+
<span className={styles.greyText}>{rangeSeparator}</span>
59+
{round(range.max)}
60+
</>
61+
);
62+
}
63+
64+
return range.min?.toString() ?? range.max?.toString();
65+
};
66+
4967
export const rangeToObject = (range: RequestParam): { min?: number; max?: number } | undefined => {
5068
if (!range) return;
5169

frontend/src/pages/Offers/List/index.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useGetGpusListQuery } from 'services/gpu';
88

99
import { useEmptyMessages } from './hooks/useEmptyMessages';
1010
import { useFilters } from './hooks/useFilters';
11-
import { convertMiBToGB, rangeToObject, renderRange, round } from './helpers';
11+
import { convertMiBToGB, rangeToObject, renderRange, renderRangeJSX, round } from './helpers';
1212

1313
import styles from './styles.module.scss';
1414

@@ -133,13 +133,19 @@ export const OfferList: React.FC<OfferListProps> = ({ withSearchParams, onChange
133133
{
134134
id: 'memory_mib',
135135
// header: t('offer.memory_mib'),
136-
content: (gpu: IGpu) => `${round(convertMiBToGB(gpu.memory_mib))}GB:${renderRange(gpu.count)}`,
136+
content: (gpu: IGpu) => (
137+
<div>
138+
{round(convertMiBToGB(gpu.memory_mib))}GB
139+
<span className={styles.greyText}>:</span>
140+
{renderRange(gpu.count)}
141+
</div>
142+
),
137143
width: 50,
138144
},
139145
{
140146
id: 'price',
141147
// header: t('offer.price'),
142-
content: (gpu: IGpu) => <span className={styles.greenText}>${renderRange(gpu.price) ?? '-'}</span>,
148+
content: (gpu: IGpu) => <span className={styles.greenText}>${renderRangeJSX(gpu.price) ?? '-'}</span>,
143149
width: 50,
144150
},
145151
// {

frontend/src/pages/Offers/List/styles.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
}
1818
}
1919

20+
.greyText {
21+
color: awsui.$color-text-status-inactive;
22+
}
23+
2024
.greenText {
2125
color: awsui.$color-text-status-success;
2226
}

0 commit comments

Comments
 (0)