diff --git a/app/(auth)/(tabs)/(home)/sessions/index.tsx b/app/(auth)/(tabs)/(home)/sessions/index.tsx
index 097205da..255da47d 100644
--- a/app/(auth)/(tabs)/(home)/sessions/index.tsx
+++ b/app/(auth)/(tabs)/(home)/sessions/index.tsx
@@ -147,7 +147,7 @@ const SessionCard = ({ session }: SessionCardProps) => {
@@ -160,87 +160,76 @@ const SessionCard = ({ session }: SessionCardProps) => {
};
interface TranscodingBadgesProps {
- properties: Array;
+ properties: StreamProps;
}
-const TranscodingBadges = ({ properties = [] }: TranscodingBadgesProps) => {
+const TranscodingBadges = ({ properties }: TranscodingBadgesProps) => {
+ const iconMap = {
+ bitrate: ,
+ codec: ,
+ videoRange: (
+
+ ),
+ resolution: ,
+ language: ,
+ audioChannels: ,
+ } as const;
+
const icon = (val: string) => {
- switch (val) {
- case "bitrate":
- return ;
- break;
- case "codec":
- return ;
- break;
- case "videoRange":
- return (
-
- );
- break;
- case "resolution":
- return ;
- break;
- case "language":
- return ;
- break;
- case "audioChannels":
- return ;
- break;
- default:
- return ;
- }
+ return (
+ iconMap[val as keyof typeof iconMap] ?? (
+
+ )
+ );
};
- const formatVal = (key: String, val: any) => {
+ const formatVal = (key: string, val: any) => {
switch (key) {
case "bitrate":
return formatBitrate(val);
- break;
default:
return val;
}
};
- return Object.keys(properties)
- .filter(
- (key) => !(properties[key] === undefined || properties[key] === null)
- )
- .map((key) => (
+ return Object.entries(properties)
+ .filter(([_, value]) => value !== undefined && value !== null)
+ .map(([key]) => (
));
};
interface StreamProps {
- resolution: String | null | undefined;
- language: String | null | undefined;
- codec: String | null | undefined;
- bitrate: number | null | undefined;
- videoRange: String | null | undefined;
- audioChannels: String | null | undefined;
+ resolution?: string | null | undefined;
+ language?: string | null | undefined;
+ codec?: string | null | undefined;
+ bitrate?: number | null | undefined;
+ videoRange?: string | null | undefined;
+ audioChannels?: string | null | undefined;
}
interface TranscodingStreamViewProps {
- title: String | undefined;
- value: String;
+ title: string | undefined;
+ value?: string;
isTranscoding: Boolean;
- transcodeValue: String | undefined | null;
- properties: Array;
- transcodeProperties: Array;
+ transcodeValue?: string | undefined | null;
+ properties: StreamProps;
+ transcodeProperties?: StreamProps;
}
const TranscodingStreamView = ({
title,
- value,
isTranscoding,
+ properties,
+ transcodeProperties,
+ value,
transcodeValue,
- properties = [],
- transcodeProperties = [],
}: TranscodingStreamViewProps) => {
return (
@@ -252,7 +241,7 @@ const TranscodingStreamView = ({
- {isTranscoding && (
+ {isTranscoding && transcodeProperties ? (
<>
@@ -267,7 +256,7 @@ const TranscodingStreamView = ({
>
- )}
+ ) : null}
);
};
@@ -309,7 +298,6 @@ const TranscodingView = ({ session }: SessionCardProps) => {
resolution: videoStreamTitle(),
bitrate: videoStream?.BitRate,
codec: videoStream?.Codec,
- //videoRange: videoStream?.VideoRange
}}
transcodeProperties={{
bitrate: session.TranscodingInfo?.Bitrate,
@@ -333,7 +321,7 @@ const TranscodingView = ({ session }: SessionCardProps) => {
transcodeProperties={{
bitrate: session.TranscodingInfo?.Bitrate,
codec: session.TranscodingInfo?.AudioCodec,
- audioChannels: session.TranscodingInfo?.AudioChannels,
+ audioChannels: session.TranscodingInfo?.AudioChannels?.toString(),
}}
isTranscoding={
isTranscoding && !session.TranscodingInfo?.IsVideoDirect