import { Box, VStack, HStack, SpanBox } from './../elements/LayoutPrimitives'
import type { LibraryItemNode } from '../../lib/networking/queries/useGetLibraryItemsQuery'
import { CoverImage } from './../elements/CoverImage'
import { StyledText } from './../elements/StyledText'
import { authoredByText } from './../patterns/ArticleSubtitle'
import { MoreOptionsIcon } from './../elements/images/MoreOptionsIcon'
import { theme } from './../tokens/stitches.config'
import Link from 'next/link'
import { CardMenu } from './../patterns/CardMenu'
import { LayoutType } from '../templates/homeFeed/HomeFeedContainer'
import { UserBasicData } from '../../lib/networking/queries/useGetViewerQuery'
export type LinkedItemCardAction =
| 'showDetail'
| 'showOriginal'
| 'archive'
| 'unarchive'
| 'delete'
| 'mark-read'
| 'mark-unread'
| 'share'
| 'snooze'
type LinkedItemCardProps = {
item: LibraryItemNode
layout: LayoutType
viewer: UserBasicData
handleAction: (action: LinkedItemCardAction) => void
}
export function LinkedItemCard(props: LinkedItemCardProps): JSX.Element {
if (props.layout == 'LIST_LAYOUT') {
return
} else {
return
}
}
export function GridLinkedItemCard(props: LinkedItemCardProps): JSX.Element {
const username = props.viewer.profile.username
const originText = new URL(props.item.url).hostname
return (
//
{
props.handleAction('showDetail')
}}
>
{originText}
{
// This is here to prevent menu click events from bubbling
// up and causing us to "click" on the link item.
e.stopPropagation()
}}
>
}
actionHandler={props.handleAction}
/>
{props.item.title}
{props.item.author && (
{authoredByText(props.item.author)}
{props.item.description ? ' \u2013 ' : ''}
)}
{props.item.description?.substring(0, 300)}
{props.item.image && (
{
;(e.target as HTMLElement).style.display = 'none'
}}
/>
)}
//
)
}
export function ListLinkedItemCard(props: LinkedItemCardProps): JSX.Element {
const username = props.viewer.profile.username
const originText = new URL(props.item.url).hostname
return (
//
{
props.handleAction('showDetail')
}}
>
{props.item.title}
{props.item.author && (
{authoredByText(props.item.author)}
)}
{originText}
{
// This is here to prevent menu click events from bubbling
// up and causing us to "click" on the link item.
e.stopPropagation()
}}
>
}
actionHandler={props.handleAction}
/>
//
)
}
type ProgressBarProps = {
fillPercentage: number
fillColor: string
backgroundColor: string
}
function ProgressBar(props: ProgressBarProps): JSX.Element {
return (
)
}