From 4a9c0a4886621b0f6fba11dc601ff39e63a61318 Mon Sep 17 00:00:00 2001 From: Jacques Metevier Date: Thu, 25 May 2023 12:14:42 -0700 Subject: [PATCH] chore: remove unused code (#50507) --- client/src/assets/icons/spacer.tsx | 33 ------------------- client/src/client/frame-runner.ts | 2 +- .../Header/components/universal-nav.tsx | 2 +- client/src/components/Header/index.tsx | 5 +-- client/src/components/Map/index.tsx | 2 +- client/src/components/search/redux/index.js | 13 +------- client/src/components/seo/index.tsx | 22 ++++++------- client/src/redux/selectors.js | 4 +-- 8 files changed, 16 insertions(+), 67 deletions(-) delete mode 100644 client/src/assets/icons/spacer.tsx diff --git a/client/src/assets/icons/spacer.tsx b/client/src/assets/icons/spacer.tsx deleted file mode 100644 index 92575b71379..00000000000 --- a/client/src/assets/icons/spacer.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import React from 'react'; -import { useTranslation } from 'react-i18next'; - -interface SpacerPropTypes { - style: Record; -} - -function Spacer(props: SpacerPropTypes): JSX.Element { - const { t } = useTranslation(); - - return ( - <> - - - ); -} - -Spacer.displayName = 'Spacer'; - -export default Spacer; diff --git a/client/src/client/frame-runner.ts b/client/src/client/frame-runner.ts index a8b4eea87a6..f8b15e65195 100644 --- a/client/src/client/frame-runner.ts +++ b/client/src/client/frame-runner.ts @@ -21,7 +21,7 @@ window.$ = jQuery; document.__initTestFrame = initTestFrame; -export interface InitTestFrameArg { +interface InitTestFrameArg { code: { contents?: string; editableContents?: string; diff --git a/client/src/components/Header/components/universal-nav.tsx b/client/src/components/Header/components/universal-nav.tsx index d89eef4c65d..770045792d1 100644 --- a/client/src/components/Header/components/universal-nav.tsx +++ b/client/src/components/Header/components/universal-nav.tsx @@ -28,7 +28,7 @@ type UniversalNavProps = Omit< fetchState: { pending: boolean }; searchBarRef?: React.RefObject; }; -export const UniversalNav = ({ +const UniversalNav = ({ displayMenu, showMenu, hideMenu, diff --git a/client/src/components/Header/index.tsx b/client/src/components/Header/index.tsx index 826c493a37b..bc0bf51d4ab 100644 --- a/client/src/components/Header/index.tsx +++ b/client/src/components/Header/index.tsx @@ -14,10 +14,7 @@ interface HeaderProps { user: User; skipButtonText: string; } -export class Header extends React.Component< - HeaderProps, - { displayMenu: boolean } -> { +class Header extends React.Component { menuButtonRef: React.RefObject; searchBarRef: React.RefObject; static displayName: string; diff --git a/client/src/components/Map/index.tsx b/client/src/components/Map/index.tsx index 3206d48db1a..a5ce53cd515 100644 --- a/client/src/components/Map/index.tsx +++ b/client/src/components/Map/index.tsx @@ -120,7 +120,7 @@ function renderLearnMap(currentSuperBlock: MapProps['currentSuperBlock']) { ); } -export function Map({ +function Map({ forLanding = false, currentSuperBlock = null }: MapProps): React.ReactElement { diff --git a/client/src/components/search/redux/index.js b/client/src/components/search/redux/index.js index 9aadc527094..6c93f059057 100644 --- a/client/src/components/search/redux/index.js +++ b/client/src/components/search/redux/index.js @@ -12,24 +12,17 @@ const initialState = { }; const types = createTypes( - [ - 'toggleSearchDropdown', - 'toggleSearchFocused', - 'updateSearchIndexName', - 'updateSearchQuery' - ], + ['toggleSearchDropdown', 'toggleSearchFocused', 'updateSearchQuery'], ns ); export const toggleSearchDropdown = createAction(types.toggleSearchDropdown); export const toggleSearchFocused = createAction(types.toggleSearchFocused); -export const updateSearchIndexName = createAction(types.updateSearchIndexName); export const updateSearchQuery = createAction(types.updateSearchQuery); export const isSearchDropdownEnabledSelector = state => state[ns].isSearchDropdownEnabled; export const isSearchBarFocusedSelector = state => state[ns].isSearchBarFocused; -export const searchIndexNameSelector = state => state[ns].indexName; export const searchQuerySelector = state => state[ns].query; export const reducer = handleActions( @@ -43,10 +36,6 @@ export const reducer = handleActions( ...state, isSearchBarFocused: payload }), - [types.updateSearchIndexName]: (state, { payload }) => ({ - ...state, - indexName: payload - }), [types.updateSearchQuery]: (state, { payload }) => { return { ...state, diff --git a/client/src/components/seo/index.tsx b/client/src/components/seo/index.tsx index 25b40ca884a..363dbaf6a0c 100644 --- a/client/src/components/seo/index.tsx +++ b/client/src/components/seo/index.tsx @@ -48,7 +48,16 @@ const SEO: React.FC = ({ title, children }) => { site: { siteMetadata: { title: defaultTitle, siteUrl } } - }: SiteData = useStaticQuery(query); + }: SiteData = useStaticQuery(graphql` + query SEO { + site { + siteMetadata { + title + siteUrl + } + } + } + `); const seo = { title: title || defaultTitle @@ -99,14 +108,3 @@ const SEO: React.FC = ({ title, children }) => { SEO.displayName = 'SEO'; export default SEO; - -export const query = graphql` - query SEO { - site { - siteMetadata { - title - siteUrl - } - } - } -`; diff --git a/client/src/redux/selectors.js b/client/src/redux/selectors.js index a8cfcc17088..2c73c4a10a9 100644 --- a/client/src/redux/selectors.js +++ b/client/src/redux/selectors.js @@ -7,12 +7,10 @@ export const completedChallengesSelector = state => userSelector(state).completedChallenges || []; export const partiallyCompletedChallengesSelector = state => userSelector(state).partiallyCompletedChallenges || []; -export const completionCountSelector = state => state[MainApp].completionCount; +const completionCountSelector = state => state[MainApp].completionCount; export const currentChallengeIdSelector = state => state[MainApp].currentChallengeId; -export const emailSelector = state => userSelector(state).email; - export const isDonatingSelector = state => userSelector(state).isDonating; export const isOnlineSelector = state => state[MainApp].isOnline; export const isServerOnlineSelector = state => state[MainApp].isServerOnline;