diff --git a/packages/web/pages/settings/pinned-searches.tsx b/packages/web/pages/settings/pinned-searches.tsx index f7d85437e..819278b78 100644 --- a/packages/web/pages/settings/pinned-searches.tsx +++ b/packages/web/pages/settings/pinned-searches.tsx @@ -1,13 +1,11 @@ -import { +import React, { + ReactNode, useCallback, useEffect, useMemo, useReducer, - useRef, - useState, } from 'react' import { Toaster } from 'react-hot-toast' -import { Button } from '../../components/elements/Button' import { Box, HStack, @@ -16,25 +14,13 @@ import { } from '../../components/elements/LayoutPrimitives' import { StyledText } from '../../components/elements/StyledText' import { SettingsLayout } from '../../components/templates/SettingsLayout' -import { styled, theme } from '../../components/tokens/stitches.config' -import { updateEmailMutation } from '../../lib/networking/mutations/updateEmailMutation' -import { updateUserMutation } from '../../lib/networking/mutations/updateUserMutation' -import { updateUserProfileMutation } from '../../lib/networking/mutations/updateUserProfileMutation' -import { useGetLibraryItemsQuery } from '../../lib/networking/queries/useGetLibraryItemsQuery' -import { useGetViewerQuery } from '../../lib/networking/queries/useGetViewerQuery' -import { useValidateUsernameQuery } from '../../lib/networking/queries/useValidateUsernameQuery' import { applyStoredTheme } from '../../lib/themeUpdater' -import { showErrorToast, showSuccessToast } from '../../lib/toastHelpers' -import { ConfirmationModal } from '../../components/patterns/ConfirmationModal' -import { ProgressBar } from '../../components/elements/ProgressBar' import { useGetLabelsQuery } from '../../lib/networking/queries/useGetLabelsQuery' import { useGetSavedSearchQuery } from '../../lib/networking/queries/useGetSavedSearchQuery' -import CheckboxComponent from '../../components/elements/Checkbox' import { Label } from '../../lib/networking/fragments/labelFragment' -import { Circle, ToggleLeft } from 'phosphor-react' +import { Circle } from 'phosphor-react' import { SavedSearch } from '../../lib/networking/fragments/savedSearchFragment' import { usePersistedState } from '../../lib/hooks/usePersistedState' -import { StyledToggleButton } from '../../components/templates/PrimaryDropdown' export type PinnedSearch = { type: 'saved-search' | 'label' @@ -162,92 +148,89 @@ export default function PinnedSearches(): JSX.Element { top: '5rem', }} /> - -
+ ) } @@ -263,78 +246,28 @@ type LabelButtonProps = { function LabelButton(props: LabelButtonProps): JSX.Element { const labelId = `checkbox-label-${props.label.id}` - - const changeState = useCallback( - (newState: boolean) => { - if (!newState) { - props.listAction({ - type: 'REMOVE_ITEM', - item: { - type: 'label', - itemId: props.label.id, - name: props.label.name, - search: `label:\"${props.label.name}\"`, - }, - }) - } else { - props.listAction({ - type: 'ADD_ITEM', - item: { - type: 'label', - itemId: props.label.id, - name: props.label.name, - search: `label:\"${props.label.name}\"`, - }, - }) - } - }, - [props] - ) - return ( -