From e6a183394f9ab7eb2880056345adffe885a9a1b6 Mon Sep 17 00:00:00 2001 From: Tim Hostetler <6970899+thostetler@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:29:27 -0400 Subject: [PATCH] Linting fixes --- scripts/react/templates.js | 2 +- src/api/config.ts | 2 +- .../AbstractRefList/AbstractRefLayout.tsx | 8 ++++++-- src/components/AuthorAffiliations/store.tsx | 4 ++-- .../components/DescriptionCollapse.tsx | 2 +- .../components/ExportContainer.tsx | 11 ++++------- .../DataDownloader/DataDownloader.tsx | 4 ++-- .../AssociatedArticlesForm.tsx | 14 +++++++------- src/components/HideOnPrint/HideOnPrint.tsx | 4 ++-- src/components/Layout/FeedbackLayout.tsx | 6 +++--- src/components/Layout/Layout.tsx | 4 ++-- src/components/Layout/SettingsLayout.tsx | 4 ++-- src/components/Layout/VizPageLayout.tsx | 4 ++-- src/components/NavBar/AppModeDropdown.tsx | 9 ++++++--- .../ResultList/Pagination/Pagination.tsx | 18 +++++++++++++++--- .../SearchBar/AllSearchTermsDropdown.tsx | 15 +++------------ .../SearchExamples/SearchExamples.tsx | 4 ++-- .../SearchFacetModal/AlphaSorter.tsx | 4 ++-- .../SearchFacetModal/SearchFacetModal.tsx | 2 +- .../SearchFacetModal/SearchInput.tsx | 4 ++-- src/components/SearchFacet/store/FacetStore.ts | 4 ++-- .../Graphs/AuthorNetworkGraph.tsx | 8 ++++---- src/mathjax.ts | 4 ++-- src/pages/_app.tsx | 6 +++--- src/pages/abs/[id]/abstract.tsx | 16 ++++++++++------ src/pages/classic-form.tsx | 2 +- src/utils.ts | 8 ++++---- 27 files changed, 92 insertions(+), 81 deletions(-) diff --git a/scripts/react/templates.js b/scripts/react/templates.js index e2f6c6516..601b6fc55 100644 --- a/scripts/react/templates.js +++ b/scripts/react/templates.js @@ -9,7 +9,7 @@ const propTypes = { children: PT.element, } -export const ${name}: FC = (props) => { +export const ${name}: FC> = (props) => { const { children, ...divProps } = props; return (
diff --git a/src/api/config.ts b/src/api/config.ts index c8f47cdf7..35c6915f9 100644 --- a/src/api/config.ts +++ b/src/api/config.ts @@ -38,7 +38,7 @@ export const defaultRequestConfig: AxiosRequestConfig = { indices: false, arrayFormat: 'comma', format: 'RFC1738', - sort: (a, b) => a - b, + sort: (a, b) => a.localeCompare(b), skipNulls: true, }), }, diff --git a/src/components/AbstractRefList/AbstractRefLayout.tsx b/src/components/AbstractRefList/AbstractRefLayout.tsx index 7f596e737..8b018a055 100644 --- a/src/components/AbstractRefList/AbstractRefLayout.tsx +++ b/src/components/AbstractRefList/AbstractRefLayout.tsx @@ -1,12 +1,16 @@ import { Heading, Stack, Text } from '@chakra-ui/react'; -import { FC } from 'react'; +import { FC, PropsWithChildren } from 'react'; interface IAbsRefLayoutProps { titleDescription: string; docTitle: string | string[]; } -export const AbstractRefLayout: FC = ({ children, titleDescription, docTitle }) => { +export const AbstractRefLayout: FC> = ({ + children, + titleDescription, + docTitle, +}) => { return ( diff --git a/src/components/AuthorAffiliations/store.tsx b/src/components/AuthorAffiliations/store.tsx index aa494f128..8fa92f09e 100644 --- a/src/components/AuthorAffiliations/store.tsx +++ b/src/components/AuthorAffiliations/store.tsx @@ -1,6 +1,6 @@ import { IAuthorAffiliationItem } from '@/api/author-affiliation/types'; import { isNotNilOrEmpty } from 'ramda-adjunct'; -import { FC } from 'react'; +import { FC, PropsWithChildren } from 'react'; import create, { GetState, Mutate, SetState, StoreApi } from 'zustand'; import createContext from 'zustand/context'; import { devtools } from 'zustand/middleware'; @@ -82,7 +82,7 @@ const createStore = (items: IAuthorAffiliationItem[]) => () => { const AuthorAffStoreCtx = createContext(); export const useAuthorAffStore = AuthorAffStoreCtx.useStore; -export const AuthorAffStoreProvider: FC = (props) => { +export const AuthorAffStoreProvider: FC> = (props) => { const { children, items } = props; return {children}; }; diff --git a/src/components/CitationExporter/components/DescriptionCollapse.tsx b/src/components/CitationExporter/components/DescriptionCollapse.tsx index a110fea56..505220466 100644 --- a/src/components/CitationExporter/components/DescriptionCollapse.tsx +++ b/src/components/CitationExporter/components/DescriptionCollapse.tsx @@ -2,7 +2,7 @@ import { QuestionIcon, QuestionOutlineIcon } from '@chakra-ui/icons'; import { Box, Collapse, CollapseProps, IconButton, useDisclosure } from '@chakra-ui/react'; import { ReactElement, ReactNode } from 'react'; -export interface IDescriptionCollapseProps extends CollapseProps { +export interface IDescriptionCollapseProps extends Omit { label: string; body: ReactNode; children: (props: { btn: ReactNode; content: ReactNode }) => ReactNode; diff --git a/src/components/CitationExporter/components/ExportContainer.tsx b/src/components/CitationExporter/components/ExportContainer.tsx index 588e289e9..ebb4af78d 100644 --- a/src/components/CitationExporter/components/ExportContainer.tsx +++ b/src/components/CitationExporter/components/ExportContainer.tsx @@ -1,12 +1,9 @@ import { Box, Heading, Spinner } from '@chakra-ui/react'; -import { FC, HTMLAttributes, ReactNode } from 'react'; +import { FC, HTMLAttributes, PropsWithChildren, ReactNode } from 'react'; -export const ExportContainer: FC<{ header: ReactNode; isLoading?: boolean } & HTMLAttributes> = ({ - children, - header, - isLoading, - ...divProps -}) => { +export const ExportContainer: FC< + PropsWithChildren<{ header: ReactNode; isLoading?: boolean } & HTMLAttributes> +> = ({ children, header, isLoading, ...divProps }) => { return ( = ({ +export const DataDownloader: FC> = ({ label, getFileContent, fileName, diff --git a/src/components/FeedbackForms/AssociatedArticles/AssociatedArticlesForm.tsx b/src/components/FeedbackForms/AssociatedArticles/AssociatedArticlesForm.tsx index 2ce4180b1..8adf3d5e2 100644 --- a/src/components/FeedbackForms/AssociatedArticles/AssociatedArticlesForm.tsx +++ b/src/components/FeedbackForms/AssociatedArticles/AssociatedArticlesForm.tsx @@ -334,7 +334,7 @@ export const AssociatedTable = () => { stylesTheme="default" onChange={handleRelationshipChange} /> - {!!errors.relationship && errors.relationship} + {!!errors.relationship && errors.relationship.message} {relationship !== null && ( @@ -359,12 +359,12 @@ export const AssociatedTable = () => { relationship === 'errata' ? 'Errata ' : relationship === 'addenda' - ? 'Addenda ' - : relationship === 'series' - ? 'Series of articles ' - : relationship === 'arxiv' - ? 'Main paper ' - : 'Related ' + ? 'Addenda ' + : relationship === 'series' + ? 'Series of articles ' + : relationship === 'arxiv' + ? 'Main paper ' + : 'Related ' }Bibcode(s)`} {associatedBibcodes.map((b, index) => ( diff --git a/src/components/HideOnPrint/HideOnPrint.tsx b/src/components/HideOnPrint/HideOnPrint.tsx index 74f61d9fc..a29c4c6ef 100644 --- a/src/components/HideOnPrint/HideOnPrint.tsx +++ b/src/components/HideOnPrint/HideOnPrint.tsx @@ -1,7 +1,7 @@ -import { FC } from 'react'; +import { FC, PropsWithChildren } from 'react'; import { Box, BoxProps } from '@chakra-ui/react'; -export const HideOnPrint: FC = (props) => { +export const HideOnPrint: FC> = (props) => { const { children, ...boxProps } = props; return ( = ({ children, title, alert }) => { +export const FeedbackLayout: FC> = ({ children, title, alert }) => { const alertRef = useRef(); // scroll to alert does not work diff --git a/src/components/Layout/Layout.tsx b/src/components/Layout/Layout.tsx index ac117421f..b96c8d9e4 100644 --- a/src/components/Layout/Layout.tsx +++ b/src/components/Layout/Layout.tsx @@ -1,7 +1,7 @@ import { Container, Flex, useMediaQuery } from '@chakra-ui/react'; import { SkipNavLink } from '@chakra-ui/skip-nav'; import { useRouter } from 'next/router'; -import { FC } from 'react'; +import { FC, PropsWithChildren } from 'react'; import { Footer } from '../Footer'; import { NavBar } from '../NavBar'; import dynamic from 'next/dynamic'; @@ -16,7 +16,7 @@ const LandingTabs = dynamic(() => import('@/components/LandingTabs/LandingTabs') }); const LANDING_PAGES = ['/', '/classic-form', '/paper-form']; -export const Layout: FC = ({ children }) => { +export const Layout: FC = ({ children }) => { const router = useRouter(); const isLandingPage = LANDING_PAGES.includes(router.pathname); diff --git a/src/components/Layout/SettingsLayout.tsx b/src/components/Layout/SettingsLayout.tsx index 436aa971f..08e7d0830 100644 --- a/src/components/Layout/SettingsLayout.tsx +++ b/src/components/Layout/SettingsLayout.tsx @@ -1,7 +1,7 @@ import { Heading, LayoutProps, Stack, Text } from '@chakra-ui/react'; import { SettingsSideNav } from '@/components'; import Head from 'next/head'; -import { FC } from 'react'; +import { FC, PropsWithChildren } from 'react'; import { ErrorBoundary, FallbackProps } from 'react-error-boundary'; import { SuspendedAlert } from '@/components/Feedbacks/SuspendedAlert'; @@ -10,7 +10,7 @@ interface ISettingsLayoutProps { maxW?: LayoutProps['maxW']; } -export const SettingsLayout: FC = ({ children, title }) => { +export const SettingsLayout: FC> = ({ children, title }) => { return ( diff --git a/src/components/Layout/VizPageLayout.tsx b/src/components/Layout/VizPageLayout.tsx index e75f9735d..836ea5531 100644 --- a/src/components/Layout/VizPageLayout.tsx +++ b/src/components/Layout/VizPageLayout.tsx @@ -1,7 +1,7 @@ import { Flex, Heading, HStack } from '@chakra-ui/react'; import { SimpleLink, VisualizationsTabs, VizSection } from '@/components'; import Head from 'next/head'; -import { FC } from 'react'; +import { FC, PropsWithChildren } from 'react'; import { UrlObject } from 'url'; import { ChevronLeftIcon } from '@chakra-ui/icons'; @@ -10,7 +10,7 @@ interface IVizPageLayoutProps { from?: UrlObject; } -export const VizPageLayout: FC = ({ children, vizPage, from }) => { +export const VizPageLayout: FC> = ({ children, vizPage, from }) => { return ( <> diff --git a/src/components/NavBar/AppModeDropdown.tsx b/src/components/NavBar/AppModeDropdown.tsx index d41b64807..e823aedc2 100644 --- a/src/components/NavBar/AppModeDropdown.tsx +++ b/src/components/NavBar/AppModeDropdown.tsx @@ -29,9 +29,12 @@ export const AppModeDropdown = (): ReactElement => { options={options} stylesTheme="theme" onChange={handleThemeChange} - label="Select theme" - id="theme-selector" - instanceId="theme-selector" + label="Select Mode" + inputId="appmode-selector" + id="appmode-selector" + instanceId="appmode-selector" + aria-label="Select Mode" + data-testid="appmode-selector" /> ); diff --git a/src/components/ResultList/Pagination/Pagination.tsx b/src/components/ResultList/Pagination/Pagination.tsx index 4486072ba..cf5f25665 100644 --- a/src/components/ResultList/Pagination/Pagination.tsx +++ b/src/components/ResultList/Pagination/Pagination.tsx @@ -25,7 +25,17 @@ import { NumPerPageType, SafeSearchUrlParams } from '@/types'; import { makeSearchParams, stringifySearchParams } from '@/utils'; import { useRouter } from 'next/router'; import { clamp, curryN } from 'ramda'; -import { Dispatch, FC, KeyboardEventHandler, ReactElement, useCallback, useMemo, useRef, useState } from 'react'; +import { + Dispatch, + FC, + KeyboardEventHandler, + PropsWithChildren, + ReactElement, + useCallback, + useMemo, + useRef, + useState, +} from 'react'; import { MenuPlacement } from 'react-select'; import { calculatePagination, PaginationAction, PaginationResult } from './usePagination'; @@ -106,7 +116,7 @@ export const Pagination = (props: PaginationProps): ReactElement => { */ const perPageChangeHandler = useCallback( ({ value }: SelectOption) => { - const numPerPage = parseInt(value, 10) as typeof APP_DEFAULTS['PER_PAGE_OPTIONS'][number]; + const numPerPage = parseInt(value, 10) as (typeof APP_DEFAULTS)['PER_PAGE_OPTIONS'][number]; if (typeof onPerPageSelect === 'function') { onPerPageSelect(numPerPage); } @@ -238,7 +248,9 @@ export const Pagination = (props: PaginationProps): ReactElement => { ); }; -const PaginationButton: FC<{ page: number; noLinks: boolean; onlyUpdatePageParam: boolean }> = (props) => { +const PaginationButton: FC> = ( + props, +) => { const { children, page, noLinks, onlyUpdatePageParam } = props; const router = useRouter(); const getLinkParams = useCallback( diff --git a/src/components/SearchBar/AllSearchTermsDropdown.tsx b/src/components/SearchBar/AllSearchTermsDropdown.tsx index 7a88a6f94..ae293a008 100644 --- a/src/components/SearchBar/AllSearchTermsDropdown.tsx +++ b/src/components/SearchBar/AllSearchTermsDropdown.tsx @@ -118,10 +118,7 @@ export const AllSearchTermsDropdown = ({ onSelect }: IAllSearchTermsDropdown): R { - tooltipReferenceRef(el); - return el; - }, + ref: (el: HTMLDivElement) => tooltipReferenceRef(el), })} w="200px" > @@ -131,10 +128,7 @@ export const AllSearchTermsDropdown = ({ onSelect }: IAllSearchTermsDropdown): R placeholder="all search terms" fontSize="md" {...getInputProps({ - ref: (el: HTMLInputElement) => { - dropdownReferenceRef(el); - return el; - }, + ref: (el: HTMLInputElement) => dropdownReferenceRef(el), onKeyDown: (event) => { if (event.key === 'Enter') { if (items.length === 0 || !isOpen) { @@ -170,10 +164,7 @@ export const AllSearchTermsDropdown = ({ onSelect }: IAllSearchTermsDropdown): R overflowY="scroll" overflowX="hidden" {...getMenuProps({ - ref: (el: HTMLUListElement) => { - dropdownPopperRef(el); - return el; - }, + ref: (el: HTMLUListElement) => dropdownPopperRef(el), })} data-testid="allSearchTermsMenu" > diff --git a/src/components/SearchExamples/SearchExamples.tsx b/src/components/SearchExamples/SearchExamples.tsx index 98a2094db..fd0b17d04 100644 --- a/src/components/SearchExamples/SearchExamples.tsx +++ b/src/components/SearchExamples/SearchExamples.tsx @@ -1,7 +1,7 @@ import { Box, Flex, Grid, GridItem, Text } from '@chakra-ui/react'; import { useStore } from '@/store'; import { noop } from '@/utils'; -import { FC, HTMLAttributes, MouseEventHandler, useMemo } from 'react'; +import { FC, HTMLAttributes, MouseEventHandler, PropsWithChildren, useMemo } from 'react'; import { examples } from './examples'; import { useIsClient } from '@/lib/useIsClient'; import { useIntermediateQuery } from '@/lib/useIntermediateQuery'; @@ -12,7 +12,7 @@ export interface ISearchExamplesProps extends HTMLAttributes { onSelect?: () => void; } -export const SearchExamples: FC = (props) => { +export const SearchExamples: FC> = (props) => { const { onSelect = noop, ...divProps } = props; const mode = useStore((state) => state.mode); const { appendToQuery } = useIntermediateQuery(); diff --git a/src/components/SearchFacet/SearchFacetModal/AlphaSorter.tsx b/src/components/SearchFacet/SearchFacetModal/AlphaSorter.tsx index f55a3cae2..ac62dd4a5 100644 --- a/src/components/SearchFacet/SearchFacetModal/AlphaSorter.tsx +++ b/src/components/SearchFacet/SearchFacetModal/AlphaSorter.tsx @@ -1,13 +1,13 @@ import { Box, Flex, FlexProps, RadioProps, useRadio, useRadioGroup } from '@chakra-ui/react'; import { range } from 'ramda'; -import { FC } from 'react'; +import { FC, PropsWithChildren } from 'react'; interface IAlphaSorterProps extends FlexProps { letter: string; onLetterChange: (letter: string) => void; } -export const AlphaSorter: FC = (props) => { +export const AlphaSorter: FC> = (props) => { const { letter = 'All', onLetterChange, ...flexProps } = props; const { getRootProps, getRadioProps } = useRadioGroup({ onChange: onLetterChange, diff --git a/src/components/SearchFacet/SearchFacetModal/SearchFacetModal.tsx b/src/components/SearchFacet/SearchFacetModal/SearchFacetModal.tsx index 52c24813d..a24a3295c 100644 --- a/src/components/SearchFacet/SearchFacetModal/SearchFacetModal.tsx +++ b/src/components/SearchFacet/SearchFacetModal/SearchFacetModal.tsx @@ -25,7 +25,7 @@ import { keyToPath, parseTitleFromKey } from '../helpers'; import { useDebounce } from 'src/lib'; import { SelectedList } from './SelectedList'; -interface ISearchFacetModalProps extends Omit { +interface ISearchFacetModalProps extends Omit { children: (props: { searchTerm: string }) => ReactNode; } diff --git a/src/components/SearchFacet/SearchFacetModal/SearchInput.tsx b/src/components/SearchFacet/SearchFacetModal/SearchInput.tsx index d98ffac0d..4d8cefba9 100644 --- a/src/components/SearchFacet/SearchFacetModal/SearchInput.tsx +++ b/src/components/SearchFacet/SearchFacetModal/SearchInput.tsx @@ -10,7 +10,7 @@ import { } from '@chakra-ui/react'; import { useFacetStore } from '@/components/SearchFacet/store/FacetStore'; import { capitalizeString } from '@/utils'; -import { ChangeEventHandler, FC } from 'react'; +import { ChangeEventHandler, FC, PropsWithChildren } from 'react'; export interface ISearchInputProps extends InputGroupProps { search: string; @@ -18,7 +18,7 @@ export interface ISearchInputProps extends InputGroupProps { isDisabled?: boolean; } -export const SearchInput: FC = (props) => { +export const SearchInput: FC> = (props) => { const { search, onSearchChange, isDisabled, ...inputGroupProps } = props; const forceUppercaseInitial = useFacetStore((state) => state.params.forceUppercaseInitial); diff --git a/src/components/SearchFacet/store/FacetStore.ts b/src/components/SearchFacet/store/FacetStore.ts index ff324bba5..3199adb11 100644 --- a/src/components/SearchFacet/store/FacetStore.ts +++ b/src/components/SearchFacet/store/FacetStore.ts @@ -2,7 +2,7 @@ import { ISearchFacetProps } from '@/components'; import { facetConfig } from '@/components/SearchFacet/config'; import { FacetItem, IFacetParams, SearchFacetID } from '@/components/SearchFacet/types'; import { omit, pick } from 'ramda'; -import { createElement, FC } from 'react'; +import { createElement, FC, PropsWithChildren } from 'react'; import create from 'zustand'; import createContext from 'zustand/context'; import { computeNextSelectionState, createNodes, getSelected } from './helpers'; @@ -108,7 +108,7 @@ const createStore = (preloadedState: Partial) => () => const FacetStoreContext = createContext(); export const useFacetStore = FacetStoreContext.useStore; -export const FacetStoreProvider: FC<{ facetId: SearchFacetID }> = ({ children, facetId }) => { +export const FacetStoreProvider: FC> = ({ children, facetId }) => { const params = pick( ['label', 'field', 'hasChildren', 'logic', 'facetQuery', 'filter', 'forceUppercaseInitial', 'maxDepth'], facetConfig[facetId], diff --git a/src/components/Visualizations/Graphs/AuthorNetworkGraph.tsx b/src/components/Visualizations/Graphs/AuthorNetworkGraph.tsx index f476562cf..4a6089981 100644 --- a/src/components/Visualizations/Graphs/AuthorNetworkGraph.tsx +++ b/src/components/Visualizations/Graphs/AuthorNetworkGraph.tsx @@ -129,7 +129,7 @@ export const AuthorNetworkGraph = ({ // handle mouse over label const handleMouseOverLabel = useCallback( - (e, n: NetworkHierarchyNode) => { + (_: unknown, n: NetworkHierarchyNode) => { if (!showLinkLayer) { return; } @@ -156,7 +156,7 @@ export const AuthorNetworkGraph = ({ // handle mouse over link const handleMouseOverLink = useCallback( - (e, link: ILink) => { + (_: unknown, link: ILink) => { if (!showLinkLayer) { return; } @@ -245,7 +245,7 @@ export const AuthorNetworkGraph = ({ .each(function (d) { this.lastAngle = { x0: d.x0, x1: d.x1 }; }) // save this angle for use in transition interpolation - .on('click', (e, p) => { + .on('click', (_: unknown, p) => { setSelectedNode(p.data); }); @@ -269,7 +269,7 @@ export const AuthorNetworkGraph = ({ g.selectAll('.link').classed('selected-link', false); g.selectAll('.node-label').classed('linked-label', false); }) - .on('click', (e, p) => { + .on('click', (_: unknown, p) => { setSelectedNode(p.data); }); diff --git a/src/mathjax.ts b/src/mathjax.ts index 115863650..0d8e1960f 100644 --- a/src/mathjax.ts +++ b/src/mathjax.ts @@ -1,5 +1,5 @@ import { MathJax3Config, MathJaxContext } from 'better-react-mathjax'; -import { createElement, FC, ReactElement } from 'react'; +import { createElement, FC, PropsWithChildren, ReactElement } from 'react'; const config: MathJax3Config = { startup: { @@ -21,6 +21,6 @@ const config: MathJax3Config = { }, }; -export const MathJaxProvider: FC = ({ children }): ReactElement => { +export const MathJaxProvider: FC = ({ children }): ReactElement => { return createElement(MathJaxContext, { version: 3, config }, children); }; diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 280234ebc..40f4801da 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -10,7 +10,7 @@ import { AppProps, NextWebVitalsMetric } from 'next/app'; import dynamic from 'next/dynamic'; import { useRouter } from 'next/router'; import 'nprogress/nprogress.css'; -import { FC, memo, ReactElement, useEffect, useMemo } from 'react'; +import { FC, memo, PropsWithChildren, ReactElement, useEffect, useMemo } from 'react'; import { DehydratedState, Hydrate, QueryClientProvider, useQuery, useQueryClient } from '@tanstack/react-query'; import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; import { IronSession } from 'iron-session'; @@ -57,7 +57,7 @@ const NectarApp = memo(({ Component, pageProps }: AppProps): ReactElement => { ); }); -const Providers: FC<{ pageProps: AppPageProps }> = ({ children, pageProps }) => { +const Providers: FC> = ({ children, pageProps }) => { const createStore = useCreateStore(pageProps.dehydratedAppState ?? {}); return ( @@ -76,7 +76,7 @@ const Providers: FC<{ pageProps: AppPageProps }> = ({ children, pageProps }) => ); }; -const QCProvider: FC = ({ children }) => { +const QCProvider: FC = ({ children }) => { const queryClient = useCreateQueryClient(); return {children}; }; diff --git a/src/pages/abs/[id]/abstract.tsx b/src/pages/abs/[id]/abstract.tsx index dbd93bdcd..9ec0672a1 100644 --- a/src/pages/abs/[id]/abstract.tsx +++ b/src/pages/abs/[id]/abstract.tsx @@ -352,12 +352,16 @@ const Detail = (props: IDetailProps): ReactElement => { {label} - {href && ( - - {normalizedValue} - - )} - {typeof children === 'function' ? children(value) : !href && normalizedValue} + <> + {href && ( + + <> + {normalizedValue} + + + )} + {typeof children === 'function' ? children(value) : !href && normalizedValue} + ); diff --git a/src/pages/classic-form.tsx b/src/pages/classic-form.tsx index 559758b13..cb7283aec 100644 --- a/src/pages/classic-form.tsx +++ b/src/pages/classic-form.tsx @@ -10,7 +10,7 @@ const ClassicFormPage: NextPage<{ ssrError?: string }> = ({ ssrError }) => { return ( - NASA Science Explorer - Classic Form Search + Classic Form - NASA Science Explorer diff --git a/src/utils.ts b/src/utils.ts index 016ab9b91..b3f090c56 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -45,7 +45,7 @@ export const normalizeURLParams = = Record; const value = typeof rawValue === 'string' ? rawValue : Array.isArray(rawValue) ? rawValue.join(',') : undefined; if (typeof value === 'undefined') { @@ -238,8 +238,8 @@ export const normalizeSolrSort = (rawSolrSort: unknown, postfixSort?: SolrSort): const sort = Array.isArray(rawSolrSort) ? filter(isString, rawSolrSort) : isString(rawSolrSort) - ? rawSolrSort.split(',') - : null; + ? rawSolrSort.split(',') + : null; const tieBreaker = postfixSort || APP_DEFAULTS.QUERY_SORT_POSTFIX; @@ -328,7 +328,7 @@ export const stringifySearchParams = (params: Record, options?: indices: false, arrayFormat: 'comma', format: 'RFC1738', - sort: (a, b) => a - b, + sort: (a, b) => a.localeCompare(b), skipNulls: true, ...options, });