Skip to content

Commit

Permalink
feat: no media available tip in picture item
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Sep 7, 2024
1 parent 76a33b6 commit 1d4fca4
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions src/renderer/src/modules/entry-column/Items/picture-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ export const PictureWaterFallItem = memo(function PictureWaterFallItem({
const previewMedia = usePreviewMedia()

if (!entry) return null
const hasMedia = entry.entries.media && entry.entries.media.length > 0

if (!hasMedia) return null
return (
<EntryItemWrapper
view={FeedViewType.Pictures}
Expand All @@ -97,21 +95,29 @@ export const PictureWaterFallItem = memo(function PictureWaterFallItem({
entryPreview={entryPreview}
translation={translation}
>
<MasonryItemFixedDimensionWrapper url={entry.entries.media![0].url}>
<SwipeMedia
media={entry.entries.media}
className={cn(
"w-full shrink-0 grow rounded-md",
isActive && "rounded-b-none",
)}
proxySize={proxySize}
imgClassName="object-cover"
uniqueKey={entryId}
onPreview={(media, i) => {
previewMedia(media, i)
}}
/>
</MasonryItemFixedDimensionWrapper>
{entry.entries.media && entry.entries.media.length > 0 ? (
<MasonryItemFixedDimensionWrapper url={entry.entries.media[0].url}>
<SwipeMedia
media={entry.entries.media}
className={cn(
"w-full shrink-0 grow rounded-md",
isActive && "rounded-b-none",
)}
proxySize={proxySize}
imgClassName="object-cover"
uniqueKey={entryId}
onPreview={(media, i) => {
previewMedia(media, i)
}}
/>
</MasonryItemFixedDimensionWrapper>
) : (
<div className="center aspect-video flex-col gap-1 bg-muted text-xs text-muted-foreground">
<i className="i-mgc-sad-cute-re size-6" />
No media available
</div>
)}

</GridItem>
</EntryItemWrapper>
)
Expand Down

0 comments on commit 1d4fca4

Please sign in to comment.