![]()
-
return (
-
-
-
-
- {entry.feeds.title}
- ·
-
- {dayjs
- .duration(
- dayjs(entry.entries.publishedAt).diff(dayjs(), "minute"),
- "minute",
- )
- .humanize()}
-
-
-
- {entry.entries.title ? (
-
- ) : (
-
- )}
- {!!entry.collections && (
-
- )}
-
-
-
-
-
- {entry.entries.images?.[0] && (
-
- )}
-
+
)
}
diff --git a/src/renderer/src/modules/entry-column/audio-item.tsx b/src/renderer/src/modules/entry-column/audio-item.tsx
index 60a795dc7..7614845c2 100644
--- a/src/renderer/src/modules/entry-column/audio-item.tsx
+++ b/src/renderer/src/modules/entry-column/audio-item.tsx
@@ -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
return (
-
-
-
-
- {entry.feeds.title}
- ·
-
- {dayjs
- .duration(
- dayjs(entry.entries.publishedAt).diff(dayjs(), "minute"),
- "minute",
- )
- .humanize()}
-
-
-
-
- {!!entry.collections && (
-
- )}
-
- {entry.entries?.enclosures?.[0].url && (
-
- )}
-
-
+
)
}
diff --git a/src/renderer/src/modules/entry-column/grid-item-template.tsx b/src/renderer/src/modules/entry-column/grid-item-template.tsx
new file mode 100644
index 000000000..fac70f4db
--- /dev/null
+++ b/src/renderer/src/modules/entry-column/grid-item-template.tsx
@@ -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
+ return (
+
+ {children}
+
+
+
+ {!!entry.collections && (
+
+ )}
+
+
+
+ {entry.feeds.title}
+ ·
+
+ {dayjs
+ .duration(
+ dayjs(entry.entries.publishedAt).diff(dayjs(), "minute"),
+ "minute",
+ )
+ .humanize()}
+
+
+
+
+ )
+}
diff --git a/src/renderer/src/modules/entry-column/list-item-template.tsx b/src/renderer/src/modules/entry-column/list-item-template.tsx
new file mode 100644
index 000000000..7ec112bb0
--- /dev/null
+++ b/src/renderer/src/modules/entry-column/list-item-template.tsx
@@ -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
+
+ return (
+
+
+
+
+ {entry.feeds.title}
+ ·
+
+ {dayjs
+ .duration(
+ dayjs(entry.entries.publishedAt).diff(dayjs(), "minute"),
+ "minute",
+ )
+ .humanize()}
+
+
+
+ {entry.entries.title ? (
+
+ ) : (
+
+ )}
+ {!!entry.collections && (
+
+ )}
+
+ {withDetails && (
+
+
+
+ )}
+ {withAudio && entry.entries?.enclosures?.[0].url && (
+
+ )}
+
+ {withDetails && entry.entries.images?.[0] && (
+
+ )}
+
+ )
+}
diff --git a/src/renderer/src/modules/entry-column/notification-item.tsx b/src/renderer/src/modules/entry-column/notification-item.tsx
index 92e51c2af..b695fea03 100644
--- a/src/renderer/src/modules/entry-column/notification-item.tsx
+++ b/src/renderer/src/modules/entry-column/notification-item.tsx
@@ -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
return (
-
-
-
-
- {entry.feeds.title}
- ·
-
- {dayjs
- .duration(
- dayjs(entry.entries.publishedAt).diff(dayjs(), "minute"),
- "minute",
- )
- .humanize()}
-
-
-
-
- {!!entry.collections && (
-
- )}
-
-
-
+
)
}
diff --git a/src/renderer/src/modules/entry-column/picture-item.tsx b/src/renderer/src/modules/entry-column/picture-item.tsx
index 7193112aa..a286f1135 100644
--- a/src/renderer/src/modules/entry-column/picture-item.tsx
+++ b/src/renderer/src/modules/entry-column/picture-item.tsx
@@ -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
return (
-
+
-
-
-
- {!!entry.collections && (
-
- )}
-
-
-
- {entry.feeds.title}
- ·
-
- {dayjs
- .duration(
- dayjs(entry.entries.publishedAt).diff(dayjs(), "minute"),
- "minute",
- )
- .humanize()}
-
-
-
-
+
)
}
diff --git a/src/renderer/src/modules/entry-column/social-media-item.tsx b/src/renderer/src/modules/entry-column/social-media-item.tsx
index 6487079c9..f6775e4f9 100644
--- a/src/renderer/src/modules/entry-column/social-media-item.tsx
+++ b/src/renderer/src/modules/entry-column/social-media-item.tsx
@@ -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
return (
-
-
+
+
@@ -36,7 +36,7 @@ export function SocialMediaItem({ entryId, entryPreview, translation }: Universa
{!!entry.collections && (
-
+
)}
diff --git a/src/renderer/src/modules/entry-column/video-item.tsx b/src/renderer/src/modules/entry-column/video-item.tsx
index efb6b195e..d3292c4a9 100644
--- a/src/renderer/src/modules/entry-column/video-item.tsx
+++ b/src/renderer/src/modules/entry-column/video-item.tsx
@@ -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
(null)
@@ -31,10 +26,11 @@ export function VideoItem({ entryId, entryPreview, translation }: UniversalItemP
if (!entry) return
return (
-
+
{iframeSrc && hovered ? (
+ // eslint-disable-next-line @eslint-react/dom/no-missing-iframe-sandbox
)}
-
-
- {translation?.title || entry.entries.title}
- {!!entry.collections && (
-
- )}
-
-
-
- {entry.entries.author}
- ·
-
- {dayjs
- .duration(
- dayjs(entry.entries.publishedAt).diff(dayjs(), "minute"),
- "minute",
- )
- .humanize()}
-
-
-
-
+
)
}
diff --git a/src/renderer/src/modules/feed-column/item.tsx b/src/renderer/src/modules/feed-column/item.tsx
index d897ca182..ca972e45d 100644
--- a/src/renderer/src/modules/feed-column/item.tsx
+++ b/src/renderer/src/modules/feed-column/item.tsx
@@ -215,7 +215,7 @@ const FeedItemImpl = ({
feed.errorAt && "text-red-900",
)}
>
-
+