Merge pull request #4326 from omnivore-app/fix/web-non-urls-list

fix/web non urls list
This commit is contained in:
Jackson Harper 2024-08-26 16:38:12 +08:00 committed by GitHub
commit aa5f50d52e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 18 additions and 13 deletions

View file

@ -19,7 +19,10 @@ export function ArticleSubtitle(props: ArticleSubtitleProps): JSX.Element {
return (
<Box>
<StyledText style={textStyle} css={{ wordBreak: 'break-word' }}>
{subtitle} {subtitle && <span style={{ bottom: 1 }}> </span>}{' '}
{subtitle}{' '}
{subtitle && !shouldHideUrl(props.href) && (
<span style={{ bottom: 1 }}> </span>
)}{' '}
{!props.hideButton && !shouldHideUrl(props.href) && (
<>
<StyledLink

View file

@ -11,7 +11,7 @@ import {
MenuStyle,
FLAIR_ICON_NAMES,
} from './LibraryCardStyles'
import { siteName } from '../../../lib/textFormatting'
import { shouldHideUrl, siteName } from '../../../lib/textFormatting'
import { sortedLabels } from '../../../lib/labelsSort'
import { LIBRARY_LEFT_MENU_WIDTH } from '../../templates/navMenu/LibraryMenu'
import { LibraryHoverActions } from './LibraryHoverActions'

View file

@ -119,16 +119,10 @@ export function LibraryContainer(props: LibraryContainerProps): JSX.Element {
isFetchingNextPage,
isFetching,
fetchNextPage,
fetchPreviousPage,
hasNextPage,
status,
error: fetchItemsError,
} = useGetLibraryItems(props.folder ?? 'home', props.folder, queryInputs)
console.log(
`status ${status}, isLoading: ${isLoading}, isFetching: ${isFetching}`
)
useEffect(() => {
if (queryValue.startsWith('#')) {
debouncedFetchSearchResults(
@ -163,7 +157,6 @@ export function LibraryContainer(props: LibraryContainerProps): JSX.Element {
}, [router.asPath])
const libraryItems = useMemo(() => {
console.log('library items: ', itemsPages)
const items =
itemsPages?.pages
.flatMap((ad: LibraryItems) => {
@ -1027,8 +1020,6 @@ export function LibraryItemsLayout(
isSessionStorage: false,
})
console.log('props.isValidating: ', props.isValidating)
return (
<>
<VStack

View file

@ -20,6 +20,7 @@ export const articleFragment = gql`
description
linkId
state
siteName
wordsCount
}
`

View file

@ -969,6 +969,7 @@ export type ArticleAttributes = {
author?: string
image?: string
savedAt: string
siteName?: string
createdAt: string
publishedAt?: string
description?: string

View file

@ -23,15 +23,22 @@ export const shouldHideUrl = (url: string): boolean => {
return false
}
const shouldHideSiteName = (siteName: string) => {
const hideNames = ['storage.googleapis.com', 'omnivore.app']
if (hideNames.indexOf(siteName) != -1) {
return true
}
return false
}
export const siteName = (
originalArticleUrl: string,
itemUrl: string,
siteName?: string
): string => {
if (siteName) {
return shouldHideUrl(siteName) ? '' : siteName
return shouldHideSiteName(siteName) ? '' : siteName
}
if (shouldHideUrl(originalArticleUrl)) {
return ''
}

View file

@ -50,6 +50,8 @@ export default function Debug(): JSX.Element {
value: article.originalArticleUrl,
})
result.push({ name: 'author', value: article.author ?? 'null' })
result.push({ name: 'siteName', value: article.siteName ?? 'null' })
result.push({ name: 'image', value: article.image ?? 'null' })
result.push({ name: 'savedAt', value: article.savedAt })
result.push({ name: 'createdAt', value: article.createdAt })