* feat(#473): add positions metrics data provider * feat(#473) add positions stats * feat(#473) add positions stats * feat(#473): add positions stats * feat(#473): add positions stats * feat(#473): position metrics, test and refactoring * feat(#473): add unit tests to positions table * feat(#473): fix spelling, order positions by updated at desc * feat(#473): protect from division by 0 * feat(#473): fix trading positions e2e tests * feat(#473): fix e2e data mocks * feat(#473): post code review clean up * feat(#993): dependencies handling in data provider * feat(#993): fix e2e tests data mocks * feat(#993): remove position metrics mocks, add market data market id * feat(#993): add missing mocks, fix combine function * feat(#993): set loading initially to true, add unit tests * feat(#993): cleanup, add comments * feat(#993): remove undefined from client type * feat(#993): cosmetic changes * feat(#840): update positions tab * feat:(#993): pass informaton about update callback cause * feat(#840): update positions tab * feat(#840): update positions tab * feat(#840): update positions tab * chore: skip handles 5000 markets e2e test * feat(#840): update positions tab * feat(#840): rename assetDecimals to decimals * feat(#840): close position * feat(#993): notify about update * feat(#840): add use close position hook * feat(#840): do not show 0 volume positions, make liquidation price minimum 0 * feat(#840): post code review fixes and improvments * feat: fix fill-table spec
24 lines
802 B
TypeScript
24 lines
802 B
TypeScript
export const positiveClassNames = 'text-vega-green-dark dark:text-vega-green';
|
|
export const negativeClassNames = 'text-vega-red-dark dark:text-vega-red';
|
|
|
|
const isPositive = ({ value }: { value: string | bigint | number }) =>
|
|
value && ((typeof value === 'string' && !value.startsWith('-')) || value > 0);
|
|
|
|
const isNegative = ({ value }: { value: string | bigint | number }) =>
|
|
value && ((typeof value === 'string' && value.startsWith('-')) || value < 0);
|
|
|
|
export const signedNumberCssClass = (value: string | bigint | number) => {
|
|
if (isPositive({ value })) {
|
|
return positiveClassNames;
|
|
}
|
|
if (isNegative({ value })) {
|
|
return negativeClassNames;
|
|
}
|
|
return '';
|
|
};
|
|
|
|
export const signedNumberCssClassRules = {
|
|
[positiveClassNames]: isPositive,
|
|
[negativeClassNames]: isNegative,
|
|
};
|