mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Remove unused imports, linting
This commit is contained in:
parent
65441ae06d
commit
4d06e17ef3
2 changed files with 73 additions and 58 deletions
|
|
@ -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) => (
|
||||
<Box>
|
||||
Link Saved
|
||||
<span style={{ padding: '16px' }} />
|
||||
<Button
|
||||
style="ctaDarkYellow"
|
||||
autoFocus
|
||||
onClick={() => {
|
||||
window.location.href = `/article/sr/${result.jobId}`
|
||||
}}
|
||||
>
|
||||
Read Now
|
||||
</Button>
|
||||
</Box>
|
||||
), { 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) => (
|
||||
<Box>
|
||||
Link Saved
|
||||
<span style={{ padding: '16px' }} />
|
||||
<Button
|
||||
style="ctaDarkYellow"
|
||||
autoFocus
|
||||
onClick={() => {
|
||||
window.location.href = `/article/sr/${result.jobId}`
|
||||
}}
|
||||
>
|
||||
Read Now
|
||||
</Button>
|
||||
</Box>
|
||||
),
|
||||
{ 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 (
|
||||
<ModalRoot defaultOpen onOpenChange={props.onOpenChange}>
|
||||
|
|
@ -110,7 +115,10 @@ export function AddLinkModal(props: AddLinkModalProps): JSX.Element {
|
|||
fontSize: '14px',
|
||||
}}
|
||||
/>
|
||||
<ModalButtonBar onOpenChange={props.onOpenChange} acceptButtonLabel="Add Link" />
|
||||
<ModalButtonBar
|
||||
onOpenChange={props.onOpenChange}
|
||||
acceptButtonLabel="Add Link"
|
||||
/>
|
||||
</form>
|
||||
</Box>
|
||||
</VStack>
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<VStack alignment="center" distribution="center" css={{ color: '$grayTextContrast', textAlign: 'center', paddingTop: '88px' }}>
|
||||
<VStack
|
||||
alignment="center"
|
||||
distribution="center"
|
||||
css={{
|
||||
color: '$grayTextContrast',
|
||||
textAlign: 'center',
|
||||
paddingTop: '88px',
|
||||
}}
|
||||
>
|
||||
<Book size={44} color={theme.colors.grayTextContrast.toString()} />
|
||||
<StyledText style="fixedHeadline" css={{ color: '$grayTextContrast' }}>
|
||||
No results found.
|
||||
</StyledText>
|
||||
<StyledText style="fixedHeadline" css={{ color: '$grayTextContrast' }}>
|
||||
No results found.
|
||||
</StyledText>
|
||||
|
||||
<StyledText style="footnote" css={{ color: '$grayTextContrast' }}>
|
||||
You can add a link or read more about Omnivore's <Link href="/help/search">advanced search</Link>.
|
||||
</StyledText>
|
||||
|
||||
<Button style="ctaDarkYellow" onClick={() => { props.onAddLinkClicked() }}>
|
||||
Add Link
|
||||
</Button>
|
||||
<StyledText style="footnote" css={{ color: '$grayTextContrast' }}>
|
||||
You can add a link or read more about Omnivore's{' '}
|
||||
<Link href="/help/search">advanced search</Link>.
|
||||
</StyledText>
|
||||
|
||||
<Button
|
||||
style="ctaDarkYellow"
|
||||
onClick={() => {
|
||||
props.onAddLinkClicked()
|
||||
}}
|
||||
>
|
||||
Add Link
|
||||
</Button>
|
||||
</VStack>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue