Skip to content

Commit

Permalink
[Pie widget] Removed unnecessary copies if not filterable (#815)
Browse files Browse the repository at this point in the history
  • Loading branch information
padawannn authored Dec 20, 2023
1 parent 2a8b791 commit df123bd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# CHANGELOG

## Not released
- [Pie widget] Removed unnecessary copies if not filterable [#815](https://github.com/CartoDB/carto-react/pull/815)

## 2.3

Expand Down
32 changes: 17 additions & 15 deletions packages/react-ui/src/widgets/PieWidgetUI/PieWidgetUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,21 +204,23 @@ function PieWidgetUI({

return (
<>
<OptionsBar container>
<Typography variant='caption' color='textSecondary'>
{selectedCategories.length
? intlConfig.formatMessage(
{ id: 'c4r.widgets.pie.selectedItems' },
{ items: selectedCategories.length }
)
: intlConfig.formatMessage({ id: 'c4r.widgets.pie.allSelected' })}
</Typography>
{selectedCategories.length > 0 && (
<Link variant='caption' onClick={handleClearSelectedCategories}>
{intlConfig.formatMessage({ id: 'c4r.widgets.pie.clear' })}
</Link>
)}
</OptionsBar>
{filterable && (
<OptionsBar container>
<Typography variant='caption' color='textSecondary'>
{selectedCategories.length
? intlConfig.formatMessage(
{ id: 'c4r.widgets.pie.selectedItems' },
{ items: selectedCategories.length }
)
: intlConfig.formatMessage({ id: 'c4r.widgets.pie.allSelected' })}
</Typography>
{selectedCategories.length > 0 && (
<Link variant='caption' onClick={handleClearSelectedCategories}>
{intlConfig.formatMessage({ id: 'c4r.widgets.pie.clear' })}
</Link>
)}
</OptionsBar>
)}

<ChartContent height={height} width={width}>
<PieCentralText data={processedData} selectedCategories={selectedCategories} />
Expand Down

0 comments on commit df123bd

Please sign in to comment.