feat: entry item template
This commit is contained in:
@@ -8,28 +8,52 @@ export function FeedIcon({
|
||||
entry,
|
||||
fallbackUrl,
|
||||
className,
|
||||
size = 20,
|
||||
}: {
|
||||
feed: FeedModel
|
||||
entry?: EntryModel["entries"]
|
||||
fallbackUrl?: string
|
||||
className?: string
|
||||
size?: number
|
||||
}) {
|
||||
const image = entry?.authorAvatar || feed.image
|
||||
if (image) {
|
||||
return (
|
||||
<Image
|
||||
src={image}
|
||||
className={cn("mr-2 size-5 shrink-0 rounded-sm", className)}
|
||||
className={cn("mr-2 shrink-0 rounded-sm", className)}
|
||||
style={{
|
||||
width: size,
|
||||
height: size,
|
||||
}}
|
||||
proxy={{
|
||||
width: 40,
|
||||
height: 40,
|
||||
width: size * 2,
|
||||
height: size * 2,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
} else if (feed.siteUrl) {
|
||||
return <SiteIcon url={feed.siteUrl} className={className} />
|
||||
return (
|
||||
<SiteIcon
|
||||
url={feed.siteUrl}
|
||||
className={className}
|
||||
style={{
|
||||
width: size,
|
||||
height: size,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
} else if (fallbackUrl) {
|
||||
return <SiteIcon url={fallbackUrl} className={className} />
|
||||
return (
|
||||
<SiteIcon
|
||||
url={fallbackUrl}
|
||||
className={className}
|
||||
style={{
|
||||
width: size,
|
||||
height: size,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -22,7 +22,8 @@ export function FollowSummary({
|
||||
<FeedIcon
|
||||
feed={feed}
|
||||
fallbackUrl={docs}
|
||||
className="mask-squircle mask mr-2 size-8 shrink-0 rounded-none"
|
||||
className="mask-squircle mask mr-2 shrink-0 rounded-none"
|
||||
size={32}
|
||||
/>
|
||||
<div className="truncate text-base font-semibold leading-tight">
|
||||
{feed.title}
|
||||
|
||||
@@ -4,9 +4,11 @@ import { parse } from "tldts"
|
||||
export function SiteIcon({
|
||||
url,
|
||||
className,
|
||||
style,
|
||||
}: {
|
||||
url?: string
|
||||
className?: string
|
||||
style?: React.CSSProperties
|
||||
}) {
|
||||
let host
|
||||
let src
|
||||
@@ -34,6 +36,7 @@ export function SiteIcon({
|
||||
e.currentTarget.src = fallback
|
||||
}
|
||||
}}
|
||||
style={style}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ const ImageImpl: FC<ImageProps> = ({
|
||||
popper = false,
|
||||
...props
|
||||
}) => {
|
||||
const { src, ...rest } = props
|
||||
const { src, style, ...rest } = props
|
||||
const [hidden, setHidden] = useState(!src)
|
||||
const [imgSrc, setImgSrc] = useState(
|
||||
proxy && src && !failedList.has(src) ?
|
||||
@@ -59,7 +59,7 @@ const ImageImpl: FC<ImageProps> = ({
|
||||
)
|
||||
|
||||
return (
|
||||
<div className={cn("overflow-hidden rounded", className)}>
|
||||
<div className={cn("overflow-hidden rounded", className)} style={style}>
|
||||
<img
|
||||
{...rest}
|
||||
onError={errorHandle}
|
||||
|
||||
@@ -1,63 +1,9 @@
|
||||
import { FeedIcon } from "@renderer/components/feed-icon"
|
||||
import { Image } from "@renderer/components/ui/image"
|
||||
import { useAsRead } from "@renderer/hooks"
|
||||
import dayjs from "@renderer/lib/dayjs"
|
||||
import { cn } from "@renderer/lib/utils"
|
||||
import { EntryTranslation } from "@renderer/modules/entry-column/translation"
|
||||
import { useEntry } from "@renderer/store/entry/hooks"
|
||||
import { ListItem } from "@renderer/modules/entry-column/list-item-template"
|
||||
|
||||
import { ReactVirtuosoItemPlaceholder } from "../../components/ui/placeholder"
|
||||
import type { UniversalItemProps } from "./types"
|
||||
|
||||
export function ArticleItem({ entryId, entryPreview, translation }: UniversalItemProps) {
|
||||
const entry = useEntry(entryId) || entryPreview
|
||||
|
||||
const asRead = useAsRead(entry)
|
||||
|
||||
// NOTE: prevent 0 height element, react virtuoso will not stop render any more
|
||||
if (!entry) return <ReactVirtuosoItemPlaceholder />
|
||||
|
||||
return (
|
||||
<div className={cn("relative flex px-2 py-3", !asRead && "before:absolute before:-left-1 before:top-[18px] before:block before:size-2 before:rounded-full before:bg-blue-500")}>
|
||||
<FeedIcon feed={entry.feeds} entry={entry.entries} />
|
||||
<div className="-mt-0.5 line-clamp-4 flex-1 text-sm leading-tight">
|
||||
<div className={cn("flex gap-1 text-[10px] font-bold", asRead ? "text-zinc-400" : "text-zinc-500")}>
|
||||
<span className="truncate">{entry.feeds.title}</span>
|
||||
<span>·</span>
|
||||
<span className="shrink-0">
|
||||
{dayjs
|
||||
.duration(
|
||||
dayjs(entry.entries.publishedAt).diff(dayjs(), "minute"),
|
||||
"minute",
|
||||
)
|
||||
.humanize()}
|
||||
</span>
|
||||
</div>
|
||||
<div className={cn("relative my-0.5 break-words", !!entry.collections && "pr-4", entry.entries.title ? "font-medium" : "text-[13px]")}>
|
||||
{entry.entries.title ? (
|
||||
<EntryTranslation source={entry.entries.title} target={translation?.title} />
|
||||
) : (
|
||||
<EntryTranslation source={entry.entries.description} target={translation?.description} />
|
||||
)}
|
||||
{!!entry.collections && (
|
||||
<i className="i-mgc-star-cute-fi absolute right-0 top-0.5 text-orange-400" />
|
||||
)}
|
||||
</div>
|
||||
<div className={cn("text-[13px]", asRead ? "text-zinc-400" : "text-zinc-500")}>
|
||||
<EntryTranslation source={entry.entries.description} target={translation?.description} />
|
||||
</div>
|
||||
</div>
|
||||
{entry.entries.images?.[0] && (
|
||||
<Image
|
||||
src={entry.entries.images[0]}
|
||||
className="ml-2 size-20 shrink-0"
|
||||
loading="lazy"
|
||||
proxy={{
|
||||
width: 160,
|
||||
height: 160,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<ListItem entryId={entryId} entryPreview={entryPreview} translation={translation} withDetails />
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,45 +1,9 @@
|
||||
import { FeedIcon } from "@renderer/components/feed-icon"
|
||||
import { useAsRead } from "@renderer/hooks"
|
||||
import dayjs from "@renderer/lib/dayjs"
|
||||
import { cn } from "@renderer/lib/utils"
|
||||
import { EntryTranslation } from "@renderer/modules/entry-column/translation"
|
||||
import { useEntry } from "@renderer/store/entry/hooks"
|
||||
import { ListItem } from "@renderer/modules/entry-column/list-item-template"
|
||||
|
||||
import { ReactVirtuosoItemPlaceholder } from "../../components/ui/placeholder"
|
||||
import type { UniversalItemProps } from "./types"
|
||||
|
||||
export function AudioItem({ entryId, entryPreview, translation }: UniversalItemProps) {
|
||||
const entry = useEntry(entryId) || entryPreview
|
||||
|
||||
const asRead = useAsRead(entry)
|
||||
|
||||
if (!entry) return <ReactVirtuosoItemPlaceholder />
|
||||
return (
|
||||
<div className={cn("relative flex px-2 py-3", !asRead && "before:absolute before:-left-1 before:top-[18px] before:block before:size-2 before:rounded-full before:bg-blue-500")}>
|
||||
<FeedIcon feed={entry.feeds} entry={entry.entries} />
|
||||
<div className="-mt-0.5 line-clamp-5 flex-1 text-sm leading-tight">
|
||||
<div className={cn("flex gap-1 text-[10px] font-bold", asRead ? "text-zinc-400" : "text-zinc-500")}>
|
||||
<span className="truncate">{entry.feeds.title}</span>
|
||||
<span>·</span>
|
||||
<span>
|
||||
{dayjs
|
||||
.duration(
|
||||
dayjs(entry.entries.publishedAt).diff(dayjs(), "minute"),
|
||||
"minute",
|
||||
)
|
||||
.humanize()}
|
||||
</span>
|
||||
</div>
|
||||
<div className={cn("relative my-0.5", !!entry.collections && "pr-4")}>
|
||||
<EntryTranslation source={entry.entries.title} target={translation?.title} />
|
||||
{!!entry.collections && (
|
||||
<i className="i-mgc-star-cute-fi absolute right-0 top-0.5 text-orange-400" />
|
||||
)}
|
||||
</div>
|
||||
{entry.entries?.enclosures?.[0].url && (
|
||||
<audio className="mt-2 h-10 w-full" controls src={entry.entries?.enclosures?.[0].url} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<ListItem entryId={entryId} entryPreview={entryPreview} translation={translation} withAudio />
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
import { FeedIcon } from "@renderer/components/feed-icon"
|
||||
import { ReactVirtuosoItemPlaceholder } from "@renderer/components/ui/placeholder"
|
||||
import { useAsRead } from "@renderer/hooks"
|
||||
import dayjs from "@renderer/lib/dayjs"
|
||||
import { cn } from "@renderer/lib/utils"
|
||||
import { EntryTranslation } from "@renderer/modules/entry-column/translation"
|
||||
import { useEntry } from "@renderer/store/entry/hooks"
|
||||
|
||||
import type { UniversalItemProps } from "./types"
|
||||
|
||||
export function GridItem({
|
||||
entryId,
|
||||
entryPreview,
|
||||
translation,
|
||||
children,
|
||||
}: UniversalItemProps & {
|
||||
children?: React.ReactNode
|
||||
}) {
|
||||
const entry = useEntry(entryId) || entryPreview
|
||||
|
||||
const asRead = useAsRead(entry)
|
||||
|
||||
if (!entry) return <ReactVirtuosoItemPlaceholder />
|
||||
return (
|
||||
<div>
|
||||
{children}
|
||||
<div className={cn("relative flex-1 px-2 pb-3 pt-1 text-sm", !asRead && "before:absolute before:-left-1 before:top-[13.5px] before:block before:size-2 before:rounded-full before:bg-blue-500")}>
|
||||
<div
|
||||
className={cn(
|
||||
"relative mb-1 mt-1.5 truncate font-medium leading-none",
|
||||
!!entry.collections && "pr-4",
|
||||
)}
|
||||
>
|
||||
<EntryTranslation source={entry.entries.title} target={translation?.title} />
|
||||
{!!entry.collections && (
|
||||
<i className="i-mgc-star-cute-fi absolute right-0 top-0 text-orange-400" />
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center gap-1 truncate text-[13px]">
|
||||
<FeedIcon
|
||||
className="mr-0.5 inline-block"
|
||||
feed={entry.feeds}
|
||||
entry={entry.entries}
|
||||
size={18}
|
||||
/>
|
||||
<span>{entry.feeds.title}</span>
|
||||
<span className="text-zinc-500">·</span>
|
||||
<span className="text-zinc-500">
|
||||
{dayjs
|
||||
.duration(
|
||||
dayjs(entry.entries.publishedAt).diff(dayjs(), "minute"),
|
||||
"minute",
|
||||
)
|
||||
.humanize()}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
import { FeedIcon } from "@renderer/components/feed-icon"
|
||||
import { Image } from "@renderer/components/ui/image"
|
||||
import { useAsRead } from "@renderer/hooks"
|
||||
import dayjs from "@renderer/lib/dayjs"
|
||||
import { cn } from "@renderer/lib/utils"
|
||||
import { EntryTranslation } from "@renderer/modules/entry-column/translation"
|
||||
import { useEntry } from "@renderer/store/entry/hooks"
|
||||
|
||||
import { ReactVirtuosoItemPlaceholder } from "../../components/ui/placeholder"
|
||||
import type { UniversalItemProps } from "./types"
|
||||
|
||||
export function ListItem({
|
||||
entryId,
|
||||
entryPreview,
|
||||
translation,
|
||||
withDetails,
|
||||
withAudio,
|
||||
}: UniversalItemProps & {
|
||||
withDetails?: boolean
|
||||
withAudio?: boolean
|
||||
}) {
|
||||
const entry = useEntry(entryId) || entryPreview
|
||||
|
||||
const asRead = useAsRead(entry)
|
||||
|
||||
// NOTE: prevent 0 height element, react virtuoso will not stop render any more
|
||||
if (!entry) return <ReactVirtuosoItemPlaceholder />
|
||||
|
||||
return (
|
||||
<div className={cn("relative flex py-3 pl-3 pr-2", !asRead && "before:absolute before:-left-0.5 before:top-[18px] before:block before:size-2 before:rounded-full before:bg-blue-500")}>
|
||||
<FeedIcon feed={entry.feeds} entry={entry.entries} />
|
||||
<div className="-mt-0.5 line-clamp-4 flex-1 text-sm leading-tight">
|
||||
<div className={cn("flex gap-1 text-[10px] font-bold", asRead ? "text-zinc-400" : "text-zinc-500")}>
|
||||
<span className="truncate">{entry.feeds.title}</span>
|
||||
<span>·</span>
|
||||
<span className="shrink-0">
|
||||
{dayjs
|
||||
.duration(
|
||||
dayjs(entry.entries.publishedAt).diff(dayjs(), "minute"),
|
||||
"minute",
|
||||
)
|
||||
.humanize()}
|
||||
</span>
|
||||
</div>
|
||||
<div className={cn("relative my-0.5 break-words", !!entry.collections && "pr-4", entry.entries.title ? (withDetails && "font-medium") : "text-[13px]")}>
|
||||
{entry.entries.title ? (
|
||||
<EntryTranslation source={entry.entries.title} target={translation?.title} />
|
||||
) : (
|
||||
<EntryTranslation source={entry.entries.description} target={translation?.description} />
|
||||
)}
|
||||
{!!entry.collections && (
|
||||
<i className="i-mgc-star-cute-fi absolute right-0 top-[3px] text-orange-400" />
|
||||
)}
|
||||
</div>
|
||||
{withDetails && (
|
||||
<div className={cn("text-[13px]", asRead ? "text-zinc-400" : "text-zinc-500")}>
|
||||
<EntryTranslation source={entry.entries.description} target={translation?.description} />
|
||||
</div>
|
||||
)}
|
||||
{withAudio && entry.entries?.enclosures?.[0].url && (
|
||||
<audio className="mt-2 h-10 w-full" controls src={entry.entries?.enclosures?.[0].url} />
|
||||
)}
|
||||
</div>
|
||||
{withDetails && entry.entries.images?.[0] && (
|
||||
<Image
|
||||
src={entry.entries.images[0]}
|
||||
className="ml-2 size-20 shrink-0"
|
||||
loading="lazy"
|
||||
proxy={{
|
||||
width: 160,
|
||||
height: 160,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,42 +1,9 @@
|
||||
import { FeedIcon } from "@renderer/components/feed-icon"
|
||||
import { useAsRead } from "@renderer/hooks"
|
||||
import dayjs from "@renderer/lib/dayjs"
|
||||
import { cn } from "@renderer/lib/utils"
|
||||
import { EntryTranslation } from "@renderer/modules/entry-column/translation"
|
||||
import { useEntry } from "@renderer/store/entry/hooks"
|
||||
import { ListItem } from "@renderer/modules/entry-column/list-item-template"
|
||||
|
||||
import { ReactVirtuosoItemPlaceholder } from "../../components/ui/placeholder"
|
||||
import type { UniversalItemProps } from "./types"
|
||||
|
||||
export function NotificationItem({ entryId, entryPreview, translation }: UniversalItemProps) {
|
||||
const entry = useEntry(entryId) || entryPreview
|
||||
|
||||
const asRead = useAsRead(entry)
|
||||
|
||||
if (!entry) return <ReactVirtuosoItemPlaceholder />
|
||||
return (
|
||||
<div className={cn("relative flex px-2 py-3", !asRead && "before:absolute before:-left-1 before:top-[18px] before:block before:size-2 before:rounded-full before:bg-blue-500")}>
|
||||
<FeedIcon feed={entry.feeds} entry={entry.entries} />
|
||||
<div className="-mt-0.5 line-clamp-5 flex-1 text-sm leading-tight">
|
||||
<div className={cn("flex gap-1 text-[10px] font-bold", asRead ? "text-zinc-400" : "text-zinc-500")}>
|
||||
<span className="truncate">{entry.feeds.title}</span>
|
||||
<span>·</span>
|
||||
<span>
|
||||
{dayjs
|
||||
.duration(
|
||||
dayjs(entry.entries.publishedAt).diff(dayjs(), "minute"),
|
||||
"minute",
|
||||
)
|
||||
.humanize()}
|
||||
</span>
|
||||
</div>
|
||||
<div className={cn("relative my-0.5", !!entry.collections && "pr-4")}>
|
||||
<EntryTranslation source={entry.entries.title} target={translation?.title} />
|
||||
{!!entry.collections && (
|
||||
<i className="i-mgc-star-cute-fi absolute right-0 top-0.5 text-orange-400" />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ListItem entryId={entryId} entryPreview={entryPreview} translation={translation} />
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import { FeedIcon } from "@renderer/components/feed-icon"
|
||||
import { SwipeImages } from "@renderer/components/ui/image/swipe-images"
|
||||
import { ReactVirtuosoItemPlaceholder } from "@renderer/components/ui/placeholder"
|
||||
import { useAsRead } from "@renderer/hooks"
|
||||
import dayjs from "@renderer/lib/dayjs"
|
||||
import { cn } from "@renderer/lib/utils"
|
||||
import { EntryTranslation } from "@renderer/modules/entry-column/translation"
|
||||
import { GridItem } from "@renderer/modules/entry-column/grid-item-template"
|
||||
import { useEntry } from "@renderer/store/entry/hooks"
|
||||
|
||||
import { usePreviewImages } from "../../components/ui/image/hooks"
|
||||
@@ -13,12 +9,10 @@ import type { UniversalItemProps } from "./types"
|
||||
export function PictureItem({ entryId, entryPreview, translation }: UniversalItemProps) {
|
||||
const entry = useEntry(entryId) || entryPreview
|
||||
|
||||
const asRead = useAsRead(entry)
|
||||
|
||||
const previewImage = usePreviewImages()
|
||||
if (!entry) return <ReactVirtuosoItemPlaceholder />
|
||||
return (
|
||||
<div>
|
||||
<GridItem entryId={entryId} entryPreview={entryPreview} translation={translation}>
|
||||
<div className="relative flex gap-2 overflow-x-auto">
|
||||
<SwipeImages
|
||||
images={entry.entries.images}
|
||||
@@ -30,36 +24,6 @@ export function PictureItem({ entryId, entryPreview, translation }: UniversalIte
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className={cn("relative flex-1 px-2 pb-3 pt-1 text-sm", !asRead && "before:absolute before:-left-1 before:top-[15px] before:block before:size-2 before:rounded-full before:bg-blue-500")}>
|
||||
<div
|
||||
className={cn(
|
||||
"relative mb-0.5 mt-1 truncate font-medium",
|
||||
!!entry.collections && "pr-4",
|
||||
)}
|
||||
>
|
||||
<EntryTranslation source={entry.entries.title} target={translation?.title} />
|
||||
{!!entry.collections && (
|
||||
<i className="i-mgc-star-cute-fi absolute right-0 top-0.5 text-orange-400" />
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center gap-1 truncate text-[13px]">
|
||||
<FeedIcon
|
||||
className="mr-0.5 inline-block size-[18px]"
|
||||
feed={entry.feeds}
|
||||
entry={entry.entries}
|
||||
/>
|
||||
<span>{entry.feeds.title}</span>
|
||||
<span className="text-zinc-500">·</span>
|
||||
<span className="text-zinc-500">
|
||||
{dayjs
|
||||
.duration(
|
||||
dayjs(entry.entries.publishedAt).diff(dayjs(), "minute"),
|
||||
"minute",
|
||||
)
|
||||
.humanize()}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</GridItem>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ export function SocialMediaItem({ entryId, entryPreview, translation }: Universa
|
||||
// NOTE: prevent 0 height element, react virtuoso will not stop render any more
|
||||
if (!entry) return <ReactVirtuosoItemPlaceholder />
|
||||
return (
|
||||
<div className={cn("relative flex w-full px-2 py-3", !asRead && "before:absolute before:-left-1 before:top-[18px] before:block before:size-2 before:rounded-full before:bg-blue-500")}>
|
||||
<FeedIcon feed={entry.feeds} entry={entry.entries} />
|
||||
<div className={cn("relative flex w-full py-3 pl-3 pr-2", !asRead && "before:absolute before:-left-0.5 before:top-[22px] before:block before:size-2 before:rounded-full before:bg-blue-500")}>
|
||||
<FeedIcon feed={entry.feeds} entry={entry.entries} size={28} />
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="-mt-0.5 line-clamp-5 flex-1 text-sm">
|
||||
<div className="space-x-1">
|
||||
@@ -36,7 +36,7 @@ export function SocialMediaItem({ entryId, entryPreview, translation }: Universa
|
||||
<div className={cn("relative mt-0.5", !!entry.collections && "pr-4")}>
|
||||
<EntryTranslation source={entry.entries.description} target={translation?.description} />
|
||||
{!!entry.collections && (
|
||||
<i className="i-mgc-star-cute-fi absolute right-0 top-0.5 text-orange-400" />
|
||||
<i className="i-mgc-star-cute-fi absolute right-0 top-1 text-orange-400" />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { FeedIcon } from "@renderer/components/feed-icon"
|
||||
import { Image } from "@renderer/components/ui/image"
|
||||
import { useAsRead } from "@renderer/hooks"
|
||||
import dayjs from "@renderer/lib/dayjs"
|
||||
import { urlToIframe } from "@renderer/lib/url-to-iframe"
|
||||
import { cn } from "@renderer/lib/utils"
|
||||
import { GridItem } from "@renderer/modules/entry-column/grid-item-template"
|
||||
import { useEntry } from "@renderer/store/entry/hooks"
|
||||
import { useHover } from "@use-gesture/react"
|
||||
import { useMemo, useRef, useState } from "react"
|
||||
@@ -14,8 +11,6 @@ import type { UniversalItemProps } from "./types"
|
||||
export function VideoItem({ entryId, entryPreview, translation }: UniversalItemProps) {
|
||||
const entry = useEntry(entryId) || entryPreview
|
||||
|
||||
const asRead = useAsRead(entry)
|
||||
|
||||
const iframeSrc = useMemo(() => urlToIframe(entry?.entries.url), [entry?.entries.url])
|
||||
|
||||
const ref = useRef<HTMLDivElement>(null)
|
||||
@@ -31,10 +26,11 @@ export function VideoItem({ entryId, entryPreview, translation }: UniversalItemP
|
||||
|
||||
if (!entry) return <ReactVirtuosoItemPlaceholder />
|
||||
return (
|
||||
<div className="flex">
|
||||
<GridItem entryId={entryId} entryPreview={entryPreview} translation={translation}>
|
||||
<div className="w-full">
|
||||
<div className="overflow-x-auto" ref={ref}>
|
||||
{iframeSrc && hovered ? (
|
||||
// eslint-disable-next-line @eslint-react/dom/no-missing-iframe-sandbox
|
||||
<iframe
|
||||
src={iframeSrc}
|
||||
className="pointer-events-none aspect-video w-full shrink-0 rounded-md bg-black object-cover"
|
||||
@@ -53,31 +49,7 @@ export function VideoItem({ entryId, entryPreview, translation }: UniversalItemP
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className={cn("relative flex-1 px-2 pb-3 pt-1 text-sm", !asRead && "before:absolute before:-left-1 before:top-[14px] before:block before:size-2 before:rounded-full before:bg-blue-500")}>
|
||||
<div className={cn("relative mb-0.5 mt-1 truncate font-medium", !!entry.collections && "pr-4")}>
|
||||
{translation?.title || entry.entries.title}
|
||||
{!!entry.collections && (
|
||||
<i className="i-mgc-star-cute-fi absolute right-0 top-0.5 text-orange-400" />
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center gap-1 truncate text-xs">
|
||||
<FeedIcon
|
||||
className="mr-0.5 inline-block size-3"
|
||||
feed={entry.feeds}
|
||||
/>
|
||||
<span>{entry.entries.author}</span>
|
||||
<span className="text-zinc-500">·</span>
|
||||
<span className="text-zinc-500">
|
||||
{dayjs
|
||||
.duration(
|
||||
dayjs(entry.entries.publishedAt).diff(dayjs(), "minute"),
|
||||
"minute",
|
||||
)
|
||||
.humanize()}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</GridItem>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ const FeedItemImpl = ({
|
||||
feed.errorAt && "text-red-900",
|
||||
)}
|
||||
>
|
||||
<FeedIcon feed={feed} className="size-4" />
|
||||
<FeedIcon feed={feed} size={16} />
|
||||
<div
|
||||
className={cn(
|
||||
"truncate",
|
||||
|
||||
@@ -74,7 +74,8 @@ export function Component() {
|
||||
</Helmet>
|
||||
<FeedIcon
|
||||
feed={feed.data.feed}
|
||||
className="mask-squircle mask size-16 shrink-0"
|
||||
className="mask-squircle mask shrink-0"
|
||||
size={64}
|
||||
/>
|
||||
<div className="flex flex-col items-center">
|
||||
<div className="mb-2 mt-4 flex items-center text-2xl font-bold">
|
||||
|
||||
Reference in New Issue
Block a user