Skip to content

Commit

Permalink
Merge pull request #631 from 1ifeworld/salief/fix-channel-card-bug
Browse files Browse the repository at this point in the history
rm nullifier from channel card
  • Loading branch information
salieflewis authored Jun 2, 2024
2 parents c27a010 + a3fc045 commit acb797d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 15 deletions.
2 changes: 1 addition & 1 deletion apps/site/components/client/ChannelCard2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function ChannelCard2({
/>
) : (
<Flex className="bg-[#E9E9E9] justify-center items-center aspect-square w-16">
<Typography className="text-secondary-foreground">
<Typography className="text-secondary-foreground text-sm">
No items
</Typography>
</Flex>
Expand Down
47 changes: 33 additions & 14 deletions apps/site/components/server/ChannelCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,25 @@ export async function ChannelCard({
channel?.adds?.items ?? []
).find((item) => !item.removed)

if (!lastNonRemovedItem) return null
let channelCardMetadata

// Access the metadata of the most recent non-removed item and update with Mux processing status if it's a video
const channelCardMetadata = await kv.get<
Pick<MediaAssetObject, 'value'>['value']
>(lastNonRemovedItem?.item.uri as string)
if (
channelCardMetadata &&
isVideo({ mimeType: channelCardMetadata.contentType })
) {
if (muxClient) {
const { status } = await muxClient.video.assets.retrieve(
channelCardMetadata?.muxAssetId as string,
)
channelCardMetadata.muxAssetStatus = status
if (lastNonRemovedItem) {
// Retrieve metadata only if there is a non-removed item
channelCardMetadata = await kv.get<
Pick<MediaAssetObject, 'value'>['value']
>(lastNonRemovedItem.item.uri as string)

// Update with Mux processing status if it's a video
if (
channelCardMetadata &&
isVideo({ mimeType: channelCardMetadata.contentType })
) {
if (muxClient) {
const { status } = await muxClient.video.assets.retrieve(
channelCardMetadata.muxAssetId as string,
)
channelCardMetadata.muxAssetStatus = status
}
}
}

Expand Down Expand Up @@ -94,6 +98,20 @@ export async function ChannelCard({
width={width}
height={width}
/>
) : !lastNonRemovedItem ? (
<Flex
className={`bg-[#E9E9E9] justify-center items-center aspect-square ${
orientation === 0 ? `w-${width / 4}` : 'w-64'
}`}
>
<Typography
className={`text-secondary-foreground ${
orientation === 0 ? 'text-sm' : ''
}`}
>
No items
</Typography>
</Flex>
) : (
<GenericThumbnailLarge
className={`${
Expand All @@ -102,6 +120,7 @@ export async function ChannelCard({
text={channelCardMetadata?.contentType as string}
/>
)}
{/* Channel name & creator */}
<Stack className="gap-y-[3px]">
<Link
href={`/channel/${channel.id}`}
Expand Down

0 comments on commit acb797d

Please sign in to comment.