Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
feat: usage information in selection view (#942)
Browse files Browse the repository at this point in the history
* Added the count of Usages to Selection View

* Removed unused imports

* style: apply automatic fixes of linters

Co-authored-by: nvollroth <[email protected]>
Co-authored-by: jofaul <[email protected]>
  • Loading branch information
3 people authored Jul 8, 2022
1 parent 92c93dc commit c079b9a
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ export const ParameterView: React.FC<ParameterViewProps> = function ({ pythonPar
</Stack>
)}

{parameterUsages && (
<Stack spacing={4}>
<Heading as="h4" size="md">
Usages
</Heading>
<UsageSum parameterUsages={parameterUsages} />
</Stack>
)}

{parameterUsages && (
<Stack spacing={4}>
<Heading as="h4" size="md">
Expand Down Expand Up @@ -141,3 +150,13 @@ const isStringifiedLiteral = function (value: string): boolean {
}
return !Number.isNaN(Number.parseFloat(value));
};

const UsageSum: React.FC<CustomBarChartProps> = function ({ parameterUsages }) {
let usage = 0;

parameterUsages.forEach((value) => {
usage += value;
});

return <ChakraText paddingLeft={4}>{usage}</ChakraText>;
};

0 comments on commit c079b9a

Please sign in to comment.