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

Fix the normalization logic in seasonal risk #1592

Merged
merged 3 commits into from
Dec 24, 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
9 changes: 9 additions & 0 deletions app/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ const appConfigs = compat.config({
'no-shadow': 0,
'@typescript-eslint/no-shadow': ['error'],

'@typescript-eslint/consistent-type-imports': [
'warn',
{
disallowTypeAnnotations: false,
fixStyle: 'inline-type-imports',
prefer: 'type-imports',
},
],

'import/no-extraneous-dependencies': [
'error',
{
Expand Down
4 changes: 2 additions & 2 deletions app/src/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import {
} from '#config';
import RouteContext from '#contexts/route';
import UserContext, {
UserAuth,
UserContextProps,
type UserAuth,
type UserContextProps,
} from '#contexts/user';
import {
KEY_LANGUAGE_STORAGE,
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/CatalogueInfoCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@ifrc-go/ui';
import { _cs } from '@togglecorp/fujs';

import Link, { Props as LinkProps } from '#components/Link';
import Link, { type Props as LinkProps } from '#components/Link';

import styles from './styles.module.css';

Expand Down
6 changes: 3 additions & 3 deletions app/src/components/DropdownMenuItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import {
} from 'react';
import {
Button,
ButtonProps,
type ButtonProps,
ConfirmButton,
ConfirmButtonProps,
type ConfirmButtonProps,
} from '@ifrc-go/ui';
import { DropdownMenuContext } from '@ifrc-go/ui/contexts';
import { isDefined } from '@togglecorp/fujs';

import Link, { Props as LinkProps } from '#components/Link';
import Link, { type Props as LinkProps } from '#components/Link';

type CommonProp = {
persist?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/Link/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
import {
generatePath,
Link as InternalLink,
LinkProps as RouterLinkProps,
type LinkProps as RouterLinkProps,
} from 'react-router-dom';
import {
ChevronRightLineIcon,
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/MapPopup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CloseLineIcon } from '@ifrc-go/icons';
import {
Button,
Container,
ContainerProps,
type ContainerProps,
} from '@ifrc-go/ui';
import { useTranslation } from '@ifrc-go/ui/hooks';
import { _cs } from '@togglecorp/fujs';
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/NonFieldError/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@togglecorp/fujs';
import {
analyzeErrors,
Error,
type Error,
getErrorObject,
nonFieldError,
} from '@togglecorp/toggle-form';
Expand Down
6 changes: 3 additions & 3 deletions app/src/components/Page/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
ElementRef,
RefObject,
type ElementRef,
type RefObject,
useEffect,
} from 'react';
import {
Expand All @@ -19,7 +19,7 @@ import {
isNotDefined,
} from '@togglecorp/fujs';

import { components } from '#generated/types';
import { type components } from '#generated/types';
import useCurrentLanguage from '#hooks/domain/useCurrentLanguage';

import i18n from './i18n.json';
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/RichTextArea/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import {
InputContainer,
InputContainerProps,
type InputContainerProps,
} from '@ifrc-go/ui';
import {
Editor,
IAllProps,
type IAllProps,
} from '@tinymce/tinymce-react';
import { _cs } from '@togglecorp/fujs';

Expand Down
6 changes: 3 additions & 3 deletions app/src/components/domain/ActiveCountryBaseMapLayer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useMemo } from 'react';
import { MapLayer } from '@togglecorp/re-map';
import {
FillLayer,
LineLayer,
SymbolLayer,
type FillLayer,
type LineLayer,
type SymbolLayer,
} from 'mapbox-gl';

import {
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/domain/ActiveOperationMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ import {
optionLabelSelector,
outerCircleLayerOptionsForFinancialRequirements,
outerCircleLayerOptionsForPeopleTargeted,
ScaleOption,
type ScaleOption,
} from './utils';

import i18n from './i18n.json';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from 'react';
import {
SearchSelectInput,
SearchSelectInputProps,
type SearchSelectInputProps,
} from '@ifrc-go/ui';

import useDebouncedValue from '#hooks/useDebouncedValue';
Expand Down
16 changes: 8 additions & 8 deletions app/src/components/domain/BaseMapPointInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ import {
MapLayer,
MapSource,
} from '@togglecorp/re-map';
import { ObjectError } from '@togglecorp/toggle-form';
import { type ObjectError } from '@togglecorp/toggle-form';
import getBbox from '@turf/bbox';
import {
CircleLayer,
FillLayer,
LngLat,
Map,
MapboxGeoJSONFeature,
Point,
type CircleLayer,
type FillLayer,
type LngLat,
type Map,
type MapboxGeoJSONFeature,
type Point,
} from 'mapbox-gl';

import BaseMap, { Props as BaseMapProps } from '#components/domain/BaseMap';
import BaseMap, { type Props as BaseMapProps } from '#components/domain/BaseMap';
import useCountry from '#hooks/domain/useCountry';
import {
COLOR_LIGHT_GREY,
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/domain/CountryMultiSelectInput.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
MultiSelectInput,
MultiSelectInputProps,
type MultiSelectInputProps,
} from '@ifrc-go/ui';
import {
numericIdSelector,
stringNameSelector,
} from '@ifrc-go/ui/utils';

import useCountry, { Country } from '#hooks/domain/useCountry';
import useCountry, { type Country } from '#hooks/domain/useCountry';

export type CountryOption = Country;

Expand Down
4 changes: 2 additions & 2 deletions app/src/components/domain/CountrySelectInput.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
SelectInput,
SelectInputProps,
type SelectInputProps,
} from '@ifrc-go/ui';
import {
numericIdSelector,
stringNameSelector,
} from '@ifrc-go/ui/utils';

import useCountry, { Country } from '#hooks/domain/useCountry';
import useCountry, { type Country } from '#hooks/domain/useCountry';

type Props<NAME> = SelectInputProps<
number,
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/domain/DisasterTypeSelectInput.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
SelectInput,
SelectInputProps,
type SelectInputProps,
} from '@ifrc-go/ui';

import { DisasterTypes } from '#contexts/domain';
import { type DisasterTypes } from '#contexts/domain';
import useDisasterType from '#hooks/domain/useDisasterType';

export type DisasterTypeItem = NonNullable<DisasterTypes['results']>[number];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useState } from 'react';
import {
SearchMultiSelectInput,
SearchMultiSelectInputProps,
type SearchMultiSelectInputProps,
} from '@ifrc-go/ui';
import { isNotDefined } from '@togglecorp/fujs';

import { paths } from '#generated/types';
import { type paths } from '#generated/types';
import useDebouncedValue from '#hooks/useDebouncedValue';
import { useRequest } from '#utils/restRequest';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CheckDoubleFillIcon } from '@ifrc-go/icons';
import {
Button,
SearchMultiSelectInput,
SearchMultiSelectInputProps,
type SearchMultiSelectInputProps,
} from '@ifrc-go/ui';
import { useTranslation } from '@ifrc-go/ui/hooks';
import {
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/domain/EventSearchSelectInput.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from 'react';
import {
SearchSelectInput,
SearchSelectInputProps,
type SearchSelectInputProps,
} from '@ifrc-go/ui';

import useDebouncedValue from '#hooks/useDebouncedValue';
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/domain/FieldReportSearchSelectInput.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from 'react';
import {
SearchSelectInput,
SearchSelectInputProps,
type SearchSelectInputProps,
} from '@ifrc-go/ui';

import useDebouncedValue from '#hooks/useDebouncedValue';
Expand Down
8 changes: 4 additions & 4 deletions app/src/components/domain/GoMultiFileInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import React, {
useRef,
} from 'react';
import { DeleteBinFillIcon } from '@ifrc-go/icons';
import type { ButtonVariant } from '@ifrc-go/ui';
import {
import type {
Button,
ButtonVariant,
InputError,
NameType,
type NameType,
RawFileInput,
RawFileInputProps,
type RawFileInputProps,
} from '@ifrc-go/ui';
import { useTranslation } from '@ifrc-go/ui/hooks';
import {
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/domain/GoSingleFileInput/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback } from 'react';
import { DeleteBinLineIcon } from '@ifrc-go/icons';
import {
ButtonVariant,
type ButtonVariant,
IconButton,
InputError,
type NameType,
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/domain/NationalSocietyMultiSelectInput.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
MultiSelectInput,
MultiSelectInputProps,
type MultiSelectInputProps,
} from '@ifrc-go/ui';
import { numericIdSelector } from '@ifrc-go/ui/utils';

import useNationalSociety, { NationalSociety } from '#hooks/domain/useNationalSociety';
import useNationalSociety, { type NationalSociety } from '#hooks/domain/useNationalSociety';

function countrySocietyNameSelector(country: NationalSociety) {
return country.society_name;
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/domain/NationalSocietySelectInput.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
SelectInput,
SelectInputProps,
type SelectInputProps,
} from '@ifrc-go/ui';
import { numericIdSelector } from '@ifrc-go/ui/utils';
import { isDefined } from '@togglecorp/fujs';

import useNationalSociety, { NationalSociety } from '#hooks/domain/useNationalSociety';
import useNationalSociety, { type NationalSociety } from '#hooks/domain/useNationalSociety';

function countrySocietyNameSelector(country: NationalSociety) {
return country.society_name;
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/domain/PerAssessmentSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
listToMap,
mapToList,
} from '@togglecorp/fujs';
import { PartialForm } from '@togglecorp/toggle-form';
import { type PartialForm } from '@togglecorp/toggle-form';

import {
getPerAreaColor,
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/domain/RegionSelectInput.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
SelectInput,
SelectInputProps,
type SelectInputProps,
} from '@ifrc-go/ui';
import { stringValueSelector } from '@ifrc-go/ui/utils';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
COLOR_RED,
} from '#utils/constants';

import { RiskLayerSeverity } from '../utils';
import { type RiskLayerSeverity } from '../utils';

import styles from './styles.module.css';

Expand Down
4 changes: 2 additions & 2 deletions app/src/components/domain/RiskImminentEventMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
DURATION_MAP_ZOOM,
} from '#utils/constants';

import LayerOptions, { LayerOptionsValue } from './LayerOptions';
import LayerOptions, { type LayerOptionsValue } from './LayerOptions';
import {
activeHazardPointLayer,
exposureFillLayer,
Expand All @@ -57,7 +57,7 @@ import {
trackPointOuterCircleLayer,
uncertaintyConeLayer,
} from './mapStyles';
import { RiskLayerProperties } from './utils';
import { type RiskLayerProperties } from './utils';

import i18n from './i18n.json';
import styles from './styles.module.css';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { useTranslation } from '@ifrc-go/ui/hooks';
import { _cs } from '@togglecorp/fujs';

import { RiskEventListItemProps } from '#components/domain/RiskImminentEventMap';
import { type RiskEventListItemProps } from '#components/domain/RiskImminentEventMap';
import { type RiskApiResponse } from '#utils/restRequest';

import i18n from './i18n.json';
Expand Down
6 changes: 3 additions & 3 deletions app/src/components/domain/RiskImminentEvents/Gdacs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { type LngLatBoundsLike } from 'mapbox-gl';

import RiskImminentEventMap, { type EventPointFeature } from '#components/domain/RiskImminentEventMap';
import {
RiskLayerProperties,
RiskLayerSeverity,
type RiskLayerProperties,
type RiskLayerSeverity,
} from '#components/domain/RiskImminentEventMap/utils';
import { isValidFeatureCollection } from '#utils/domain/risk';
import {
RiskApiResponse,
type RiskApiResponse,
useRiskLazyRequest,
useRiskRequest,
} from '#utils/restRequest';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { useTranslation } from '@ifrc-go/ui/hooks';
import { _cs } from '@togglecorp/fujs';

import { RiskEventListItemProps } from '#components/domain/RiskImminentEventMap';
import { type RiskEventListItemProps } from '#components/domain/RiskImminentEventMap';
import { type RiskApiResponse } from '#utils/restRequest';

import i18n from './i18n.json';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { LngLatBoundsLike } from 'mapbox-gl';

import type { EventPointFeature } from '#components/domain/RiskImminentEventMap';
import RiskImminentEventMap from '#components/domain/RiskImminentEventMap';
import { RiskLayerProperties } from '#components/domain/RiskImminentEventMap/utils';
import { type RiskLayerProperties } from '#components/domain/RiskImminentEventMap/utils';
import { isValidFeatureCollection } from '#utils/domain/risk';
import {
type RiskApiResponse,
Expand Down
Loading
Loading