Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rm nullifier from channel card #631

Merged
merged 5 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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