Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LANDGRIF-1559] adds footer to analysis table #1193

Merged
merged 3 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions client/src/components/legend/item/component.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import classNames from 'classnames';
import { EyeIcon, EyeOffIcon, XIcon } from '@heroicons/react/solid';
import { useCallback } from 'react';
import { useSearchParams } from 'next/navigation';

import OpacityControl from './opacityControl';
import DragHandle from './dragHandle';
import { ComparisonToggle } from './comparisonModeToggle';
import InfoModal from './info-modal';

import Loading from 'components/loading';
import { useAppSelector } from 'store/hooks';
import { scenarios } from 'store/features/analysis';

import type { Dispatch } from 'react';
import type { InfoModalProps } from './info-modal';
Expand Down Expand Up @@ -45,7 +44,8 @@ export const LegendItem = ({
onToggle,
isActive,
}: LegendItemProps) => {
const { isComparisonEnabled } = useAppSelector(scenarios);
const searchParams = useSearchParams();
const isComparisonEnabled = Boolean(searchParams.get('compareScenarioId'));

const handleToggleActive = useCallback(() => {
onToggle(!isActive);
Expand Down
2 changes: 0 additions & 2 deletions client/src/containers/analysis-sidebar/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { pickBy } from 'lodash-es';
import { useAppSelector, useAppDispatch } from 'store/hooks';
import {
scenarios,
setComparisonEnabled,
setCurrentScenario,
setScenarioToCompare as setScenarioToCompareAction,
} from 'store/features/analysis/scenarios';
Expand Down Expand Up @@ -64,7 +63,6 @@ const ScenariosComponent: React.FC<{ scrollref?: MutableRefObject<HTMLDivElement
// TODO: deprecated, we'll keep only for retro-compatibility
dispatch(setCurrentScenario(id));
dispatch(setScenarioToCompareAction(null));
dispatch(setComparisonEnabled(false));
},
[dispatch, push, query],
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useMemo, useCallback } from 'react';
import classNames from 'classnames';
import { InformationCircleIcon } from '@heroicons/react/outline';
import { useSearchParams } from 'next/navigation';

import { useAppSelector, useAppDispatch } from 'store/hooks';
import { useScenario } from 'hooks/scenarios';
Expand All @@ -26,8 +27,11 @@ type AnalysisDynamicMetadataTypes = {
const AnalysisDynamicMetadata: FC<AnalysisDynamicMetadataTypes> = ({
className,
}: AnalysisDynamicMetadataTypes) => {
const searchParams = useSearchParams();
const isComparisonEnabled = Boolean(searchParams.get('compareScenarioId'));

const dispatch = useAppDispatch();
const { currentScenario, scenarioToCompare, isComparisonEnabled } = useAppSelector(scenarios);
const { currentScenario, scenarioToCompare } = useAppSelector(scenarios);
const { data: scenario } = useScenario(currentScenario);
const { data: scenarioB } = useScenario(scenarioToCompare);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useCallback, useMemo } from 'react';
import { useSearchParams } from 'next/navigation';

import { useAppSelector, useAppDispatch, useSyncIndicators } from 'store/hooks';
import { analysisMap, setLayer } from 'store/features/analysis/map';
import { scenarios } from 'store/features/analysis';
import LegendTypeChoropleth from 'components/legend/types/choropleth';
import LegendTypeComparative from 'components/legend/types/comparative';
import LegendItem from 'components/legend/item';
Expand All @@ -13,6 +13,9 @@ import type { Legend } from 'types';
const LAYER_ID = 'impact';

const ImpactLayer = () => {
const searchParams = useSearchParams();
const isComparisonEnabled = Boolean(searchParams.get('compareScenarioId'));

const dispatch = useAppDispatch();
const [syncedIndicators] = useSyncIndicators();

Expand Down Expand Up @@ -40,8 +43,6 @@ const ImpactLayer = () => {
[layer.metadata?.legend.items],
);

const { isComparisonEnabled } = useAppSelector(scenarios);

const name = useMemo(() => {
if (!layer.metadata?.legend?.name) return null;

Expand Down
Loading
Loading