diff --git a/packages/web/components/templates/homeFeed/AddLinkModal.tsx b/packages/web/components/templates/homeFeed/AddLinkModal.tsx index a13426985..b8beba971 100644 --- a/packages/web/components/templates/homeFeed/AddLinkModal.tsx +++ b/packages/web/components/templates/homeFeed/AddLinkModal.tsx @@ -5,14 +5,10 @@ import { ModalTitleBar, ModalButtonBar, } from '../../elements/ModalPrimitives' -import { VStack, HStack, Box, SpanBox } from '../../elements/LayoutPrimitives' +import { VStack, Box } from '../../elements/LayoutPrimitives' import { Button } from '../../elements/Button' -import { StyledText } from '../../elements/StyledText' -import { CrossIcon } from '../../elements/images/CrossIcon' -import { theme } from '../../tokens/stitches.config' import { FormInput } from '../../elements/FormElements' import { useState, useCallback } from 'react' -import { createArticleFromURLMutation } from '../../../lib/networking/mutations/createArticleFromURLMutation' import { saveUrlMutation } from '../../../lib/networking/mutations/saveUrlMutation' import toast from 'react-hot-toast' import { showErrorToast } from '../../../lib/toastHelpers' @@ -24,42 +20,51 @@ type AddLinkModalProps = { export function AddLinkModal(props: AddLinkModalProps): JSX.Element { const [link, setLink] = useState('') - const handleLinkSubmission = useCallback(async (link: string) => { - const result = await saveUrlMutation(link) - // const result = await saveUrlMutation(link) - if (result && result.jobId) { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - toast((t) => ( - - Link Saved - - - - ), { position: 'bottom-right' }) - } else { - showErrorToast('Error saving link', { position: 'bottom-right' }) - } - }, [link]) + const handleLinkSubmission = useCallback( + async (link: string) => { + const result = await saveUrlMutation(link) + // const result = await saveUrlMutation(link) + if (result && result.jobId) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + toast( + (t) => ( + + Link Saved + + + + ), + { position: 'bottom-right' } + ) + } else { + showErrorToast('Error saving link', { position: 'bottom-right' }) + } + }, + [link] + ) - const validateLink = useCallback((link: string) => { - try { - const url = new URL(link) - if (url.protocol !== 'https:' && url.protocol !== 'http:') { + const validateLink = useCallback( + (link: string) => { + try { + const url = new URL(link) + if (url.protocol !== 'https:' && url.protocol !== 'http:') { + return false + } + } catch (e) { return false } - } catch (e) { - return false - } - return true - }, [link]) + return true + }, + [link] + ) return ( @@ -110,7 +115,10 @@ export function AddLinkModal(props: AddLinkModalProps): JSX.Element { fontSize: '14px', }} /> - + diff --git a/packages/web/components/templates/homeFeed/EmptyLibrary.tsx b/packages/web/components/templates/homeFeed/EmptyLibrary.tsx index e2395dac2..eadc62608 100644 --- a/packages/web/components/templates/homeFeed/EmptyLibrary.tsx +++ b/packages/web/components/templates/homeFeed/EmptyLibrary.tsx @@ -1,15 +1,8 @@ - - -// There aren't any discussions. -// You can open a new discussion to ask questions about this repository or get help. - import Link from 'next/link' import { Book } from 'phosphor-react' -import { LibraryItem } from '../../../lib/networking/queries/useGetLibraryItemsQuery' import { Button } from '../../elements/Button' -import { Box, VStack } from '../../elements/LayoutPrimitives' +import { VStack } from '../../elements/LayoutPrimitives' import { StyledText } from '../../elements/StyledText' -import { LinkedItemCardAction } from '../../patterns/LibraryCards/CardTypes' import { theme } from '../../tokens/stitches.config' type EmptyLibraryProps = { @@ -18,19 +11,33 @@ type EmptyLibraryProps = { export function EmptyLibrary(props: EmptyLibraryProps): JSX.Element { return ( - + - - No results found. - + + No results found. + - - You can add a link or read more about Omnivore's advanced search. - - - + + You can add a link or read more about Omnivore's{' '} + advanced search. + + + ) }