Skip to content

Commit

Permalink
fix(20649): Always show numbers in Bivariate hex popup (#964)
Browse files Browse the repository at this point in the history
* fix(20649): Always show numbers in Bivariate hex popup

* chore: make values prop in MapHexTooltipProps non-optional
  • Loading branch information
albaranau authored Jan 22, 2025
1 parent d469784 commit 0e63b26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
12 changes: 5 additions & 7 deletions src/components/MapHexTooltip/MapHexTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type MapHexTooltipProps = {
axis: BivariateLegend['axis'];
cellIndex: number;
cellLabel: string;
values?: { x: string; y: string };
values: { x: string; y: string };
};

export const MapHexTooltip = ({
Expand All @@ -52,12 +52,10 @@ export const MapHexTooltip = ({
<span>{axis.y.label || formatBivariateAxisLabel(axis.y.quotients)}</span>
</div>

{values && (
<div className={s.column}>
<span>{values.x}</span>
<span>{values.y}</span>
</div>
)}
<div className={s.column}>
<span>{values.x}</span>
<span>{values.y}</span>
</div>

<div className={s.column}>
<span>{getXIndicatorLabelByindex(cellIndex)}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import {
import { invertClusters } from '~utils/bivariate';
import { getCellLabelByValue } from '~utils/bivariate/bivariateLegendUtils';
import { dispatchMetricsEvent } from '~core/metrics/dispatch';
import { configRepo } from '~core/config';
import { AppFeature } from '~core/app/types';
import { getMaxNumeratorZoomLevel } from '~utils/bivariate/getMaxZoomLevel';
import { styleConfigs } from '../stylesConfigs';
import { generatePopupContent } from '../MCDARenderer/popup';
Expand Down Expand Up @@ -55,8 +53,6 @@ const convertFillColorToRGBA = (fillColor: RGBAColor, withTransparency = true):
withTransparency ? ',' + fillColor.a : ''
})`;

const featureFlags = configRepo.get().features;

function calcValueByNumeratorDenominator(
cellValues: Exclude<GeoJsonProperties, null>,
numerator: string,
Expand Down Expand Up @@ -191,8 +187,6 @@ export class BivariateRenderer extends LogicalLayerDefaultRenderer {
/* Skip when color empty */
if (!isFeatureVisible(feature)) return true;
if (!feature.properties) return true;

const showValues = featureFlags[AppFeature.BIVARIATE_MANAGER];
const [xNumerator, xDenominator] = legend.axis.x.quotient;
const [yNumerator, yDenominator] = legend.axis.y.quotient;
const xValue = calcValueByNumeratorDenominator(
Expand Down Expand Up @@ -226,7 +220,7 @@ export class BivariateRenderer extends LogicalLayerDefaultRenderer {
cellLabel={cells[cellIndex].label}
cellIndex={cellIndex}
axis={legend.axis}
values={showValues ? { x: xValue, y: yValue } : undefined}
values={{ x: xValue, y: yValue }}
hexagonColor={rgba}
/>,
);
Expand Down

0 comments on commit 0e63b26

Please sign in to comment.