From fde4c9a858cbf744cc12f11f837a6732da67f922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tadeusz=20Miesi=C4=85c?= <tadeusz.miesiac@gmail.com> Date: Fri, 13 Oct 2023 22:08:11 +0800 Subject: [PATCH] refactor(pr fixes): pr fixes --- .../PinsListItem/PinsListItem.component.tsx | 2 +- .../Results/Results.component.tsx | 3 ++- .../DrawerHeadingBackwardButton.component.tsx | 4 +--- .../DrawerHeadingBackwardButton.constants.tsx | 2 ++ src/shared/Icon/Icon.component.tsx | 4 ++-- .../Icon/Icons/{PinOrance.tsx => Pin.tsx} | 6 +++--- src/types/iconTypes.ts | 2 +- src/utils/getReduxWrapperWithStore.tsx | 19 ++----------------- 8 files changed, 14 insertions(+), 28 deletions(-) create mode 100644 src/shared/DrawerHeadingBackwardButton/DrawerHeadingBackwardButton.constants.tsx rename src/shared/Icon/Icons/{PinOrance.tsx => Pin.tsx} (75%) diff --git a/src/components/Map/Drawer/SearchDrawerContent/Results/PinsList/PinsListItem/PinsListItem.component.tsx b/src/components/Map/Drawer/SearchDrawerContent/Results/PinsList/PinsListItem/PinsListItem.component.tsx index 754795e9..c6eba919 100644 --- a/src/components/Map/Drawer/SearchDrawerContent/Results/PinsList/PinsListItem/PinsListItem.component.tsx +++ b/src/components/Map/Drawer/SearchDrawerContent/Results/PinsList/PinsListItem/PinsListItem.component.tsx @@ -6,7 +6,7 @@ interface PinsListItemProps { export const PinsListItem = ({ name }: PinsListItemProps): JSX.Element => ( <div className="flex flex-row justify-between pt-4"> - <Icon name="pin-orange" className="mr-2 shrink-0" /> + <Icon name="pin" className="mr-2 shrink-0" /> <p className="w-full text-left">{name}</p> <Icon name="chevron-right" className="h-6 w-6 shrink-0" /> </div> diff --git a/src/components/Map/Drawer/SearchDrawerContent/Results/Results.component.tsx b/src/components/Map/Drawer/SearchDrawerContent/Results/Results.component.tsx index c6f7edad..89b9cd60 100644 --- a/src/components/Map/Drawer/SearchDrawerContent/Results/Results.component.tsx +++ b/src/components/Map/Drawer/SearchDrawerContent/Results/Results.component.tsx @@ -1,7 +1,8 @@ import { DrawerHeadingBackwardButton } from '@/shared/DrawerHeadingBackwardButton'; import { PinsList } from './PinsList'; +import { PinItem } from './PinsList/PinsList.types'; -const PINS_LIST = [ +const PINS_LIST: PinItem[] = [ { name: 'Glyceraldehyde-3-phosphate dehydrogenase' }, { name: 'D-3-phosphoglycerate dehydrogenase' }, { name: 'Glutathione reductase, mitochondrial' }, diff --git a/src/shared/DrawerHeadingBackwardButton/DrawerHeadingBackwardButton.component.tsx b/src/shared/DrawerHeadingBackwardButton/DrawerHeadingBackwardButton.component.tsx index d5b6394a..4e39e76a 100644 --- a/src/shared/DrawerHeadingBackwardButton/DrawerHeadingBackwardButton.component.tsx +++ b/src/shared/DrawerHeadingBackwardButton/DrawerHeadingBackwardButton.component.tsx @@ -1,9 +1,7 @@ import { useAppDispatch } from '@/redux/hooks/useAppDispatch'; import { closeDrawer } from '@/redux/drawer/drawer.slice'; import { IconButton } from '@/shared/IconButton'; - -export const CLOSE_BUTTON_ROLE = 'close-drawer-button'; -export const BACK_BUTTON_ROLE = 'back-button'; +import { BACK_BUTTON_ROLE, CLOSE_BUTTON_ROLE } from './DrawerHeadingBackwardButton.constants'; export interface DrawerHeadingBackwardButtonProps { title: string; diff --git a/src/shared/DrawerHeadingBackwardButton/DrawerHeadingBackwardButton.constants.tsx b/src/shared/DrawerHeadingBackwardButton/DrawerHeadingBackwardButton.constants.tsx new file mode 100644 index 00000000..84228705 --- /dev/null +++ b/src/shared/DrawerHeadingBackwardButton/DrawerHeadingBackwardButton.constants.tsx @@ -0,0 +1,2 @@ +export const CLOSE_BUTTON_ROLE = 'close-drawer-button'; +export const BACK_BUTTON_ROLE = 'back-button'; diff --git a/src/shared/Icon/Icon.component.tsx b/src/shared/Icon/Icon.component.tsx index 89943cae..b683ed15 100644 --- a/src/shared/Icon/Icon.component.tsx +++ b/src/shared/Icon/Icon.component.tsx @@ -12,7 +12,7 @@ import { PageIcon } from '@/shared/Icon/Icons/PageIcon'; import { PluginIcon } from '@/shared/Icon/Icons/PluginIcon'; import { PlusIcon } from '@/shared/Icon/Icons/PlusIcon'; import { CloseIcon } from '@/shared/Icon/Icons/CloseIcon'; -import { PinOrange } from '@/shared/Icon/Icons/PinOrance'; +import { Pin } from '@/shared/Icon/Icons/Pin'; import type { IconTypes } from '@/types/iconTypes'; @@ -26,7 +26,7 @@ const icons = { 'chevron-left': ChevronLeftIcon, 'chevron-up': ChevronUpIcon, 'chevron-down': ChevronDownIcon, - 'pin-orange': PinOrange, + pin: Pin, plus: PlusIcon, arrow: ArrowIcon, dots: DotsIcon, diff --git a/src/shared/Icon/Icons/PinOrance.tsx b/src/shared/Icon/Icons/Pin.tsx similarity index 75% rename from src/shared/Icon/Icons/PinOrance.tsx rename to src/shared/Icon/Icons/Pin.tsx index d2adc98f..f0ee2edd 100644 --- a/src/shared/Icon/Icons/PinOrance.tsx +++ b/src/shared/Icon/Icons/Pin.tsx @@ -2,7 +2,7 @@ interface PinOrangeProps { className: string; } -export const PinOrange = ({ className }: PinOrangeProps): JSX.Element => ( +export const Pin = ({ className }: PinOrangeProps): JSX.Element => ( <svg width="18" height="24" @@ -13,8 +13,8 @@ export const PinOrange = ({ className }: PinOrangeProps): JSX.Element => ( > <path d="M9 0C4.575 0 0 3.375 0 9C0 14.325 8.1 22.65 8.475 23.025C8.625 23.175 8.775 23.25 9 23.25C9.225 23.25 9.375 23.175 9.525 23.025C9.9 22.65 18 14.4 18 9C18 3.375 13.425 0 9 0ZM9 12C7.35 12 6 10.65 6 9C6 7.35 7.35 6 9 6C10.65 6 12 7.35 12 9C12 10.65 10.65 12 9 12Z" - fill="#E17221" + fill="currentColor" /> - <circle cx="9.0002" cy="8.99922" r="4.8" fill="#E17221" /> + <circle cx="9.0002" cy="8.99922" r="4.8" fill="currentColor" /> </svg> ); diff --git a/src/types/iconTypes.ts b/src/types/iconTypes.ts index f4db4670..c37714cb 100644 --- a/src/types/iconTypes.ts +++ b/src/types/iconTypes.ts @@ -13,4 +13,4 @@ export type IconTypes = | 'page' | 'plugin' | 'close' - | 'pin-orange'; + | 'pin'; diff --git a/src/utils/getReduxWrapperWithStore.tsx b/src/utils/getReduxWrapperWithStore.tsx index 1382f962..cf6097bd 100644 --- a/src/utils/getReduxWrapperWithStore.tsx +++ b/src/utils/getReduxWrapperWithStore.tsx @@ -1,4 +1,4 @@ -import { StoreType } from '@/redux/store'; +import { RootState, StoreType } from '@/redux/store'; import { configureStore } from '@reduxjs/toolkit'; import { Provider } from 'react-redux'; import bioEntityContentsReducer from '@/redux/bioEntityContents/bioEntityContents.slice'; @@ -9,27 +9,12 @@ import mirnasReducer from '@/redux/mirnas/mirnas.slice'; import projectReducer from '@/redux/project/project.slice'; import searchReducer from '@/redux/search/search.slice'; import modelsReducer from '@/redux/models/models.slice'; -import { SearchState } from '@/redux/search/search.types'; -import { ProjectState } from '@/redux/project/project.types'; -import { DrugsState } from '@/redux/drugs/drugs.types'; -import { MirnasState } from '@/redux/mirnas/mirnas.types'; -import { ChemicalsState } from '@/redux/chemicals/chemicals.types'; -import { BioEntityContentsState } from '@/redux/bioEntityContents/bioEntityContents.types'; -import { DrawerState } from '@/redux/drawer/drawer.types'; interface WrapperProps { children: React.ReactNode; } -export type InitialStoreState = { - search?: SearchState; - project?: ProjectState; - drugs?: DrugsState; - mirnas?: MirnasState; - chemicals?: ChemicalsState; - bioEntityContents?: BioEntityContentsState; - drawer?: DrawerState; -}; +export type InitialStoreState = Partial<RootState>; type GetReduxWrapperUsingSliceReducer = (initialState?: InitialStoreState) => { Wrapper: ({ children }: WrapperProps) => JSX.Element; -- GitLab