diff --git a/src/widgets/media-server/DetailCollapseable.tsx b/src/widgets/media-server/DetailCollapseable.tsx index 2aa6a2105..beba658c0 100644 --- a/src/widgets/media-server/DetailCollapseable.tsx +++ b/src/widgets/media-server/DetailCollapseable.tsx @@ -1,6 +1,5 @@ -import { Card, Divider, Flex, Grid, Group, Text } from '@mantine/core'; +import { Card, Divider, Flex, Group, Stack, Text } from '@mantine/core'; import { IconDeviceMobile, IconId } from '@tabler/icons-react'; - import { GenericSessionInfo } from '~/types/api/media-server/session-info'; export const DetailCollapseable = ({ session }: { session: GenericSessionInfo }) => { @@ -11,18 +10,18 @@ export const DetailCollapseable = ({ session }: { session: GenericSessionInfo }) details = [ ...details, { - title: "Video", + title: 'Video', metrics: [ { - name: "Resolution", + name: 'Resolution', value: `${session.currentlyPlaying.metadata.video.width}x${session.currentlyPlaying.metadata.video.height}`, }, { - name: "Framerate", + name: 'Framerate', value: session.currentlyPlaying.metadata.video.videoFrameRate, }, { - name: "Video Codec", + name: 'Video Codec', value: session.currentlyPlaying.metadata.video.videoCodec, }, { @@ -39,14 +38,14 @@ export const DetailCollapseable = ({ session }: { session: GenericSessionInfo }) details = [ ...details, { - title: "Audio", + title: 'Audio', metrics: [ { - name: "Audio Channels", + name: 'Audio Channels', value: `${session.currentlyPlaying.metadata.audio.audioChannels}`, }, { - name: "Audio Codec", + name: 'Audio Codec', value: session.currentlyPlaying.metadata.audio.audioCodec, }, ], @@ -58,24 +57,24 @@ export const DetailCollapseable = ({ session }: { session: GenericSessionInfo }) details = [ ...details, { - title: "Transcoding", + title: 'Transcoding', metrics: [ { - name: "Resolution", + name: 'Resolution', value: `${session.currentlyPlaying.metadata.transcoding.width}x${session.currentlyPlaying.metadata.transcoding.height}`, }, { - name: "Context", + name: 'Context', value: session.currentlyPlaying.metadata.transcoding.context, }, { - name: "Hardware Encoding Requested", + name: 'Hardware Encoding Requested', value: session.currentlyPlaying.metadata.transcoding.transcodeHwRequested ? 'yes' : 'no', }, { - name: "Source Codec", + name: 'Source Codec', value: session.currentlyPlaying.metadata.transcoding.sourceAudioCodec || session.currentlyPlaying.metadata.transcoding.sourceVideoCodec @@ -83,7 +82,7 @@ export const DetailCollapseable = ({ session }: { session: GenericSessionInfo }) : undefined, }, { - name: "Target Codec", + name: 'Target Codec', value: `${session.currentlyPlaying.metadata.transcoding.videoCodec} ${session.currentlyPlaying.metadata.transcoding.audioCodec}`, }, ], @@ -109,23 +108,28 @@ export const DetailCollapseable = ({ session }: { session: GenericSessionInfo }) {session.sessionName} {details.length > 0 && ( - + )} - + {details.map((detail, index) => ( - - {detail.title} - {detail.metrics - .filter((x) => x.value !== undefined) - .map((metric, index2) => ( - - {metric.name} - {metric.value} - - ))} - + <> + + {detail.title} + {detail.metrics + .filter((x) => x.value !== undefined) + .map((metric, index2) => ( + + {metric.name} + {metric.value} + + ))} + + {index < details.length - 1 && ( + + )} + ))} - + ); }; diff --git a/src/widgets/media-server/TableRow.tsx b/src/widgets/media-server/TableRow.tsx index c9a795786..3795e674f 100644 --- a/src/widgets/media-server/TableRow.tsx +++ b/src/widgets/media-server/TableRow.tsx @@ -1,9 +1,8 @@ -import { Avatar, Collapse, Flex, Text, createStyles } from '@mantine/core'; -import { useState } from 'react'; - +import { Avatar, Flex, Popover, Text, createStyles } from '@mantine/core'; import { AppAvatar } from '~/components/AppAvatar'; import { GenericSessionInfo } from '~/types/api/media-server/session-info'; import { AppType } from '~/types/app'; + import { DetailCollapseable } from './DetailCollapseable'; import { NowPlayingDisplay } from './NowPlayingDisplay'; @@ -13,42 +12,47 @@ interface TableRowProps { } export const TableRow = ({ session, app }: TableRowProps) => { - const [collapseOpen, setCollapseOpen] = useState(false); const hasUserThumb = session.userProfilePicture !== undefined; const { classes } = useStyles(); return ( - <> - setCollapseOpen(!collapseOpen)}> - - - {app?.appearance.iconUrl && } - {session.sessionName} - - - - - {hasUserThumb ? ( - - ) : ( - - {session.username?.at(0)?.toUpperCase()} - - )} - {session.username} - - - - - - - - - - - - - - + + + + + + {app?.appearance.iconUrl && } + {session.sessionName} + + + + + {hasUserThumb ? ( + + ) : ( + + {session.username?.at(0)?.toUpperCase()} + + )} + {session.username} + + + + + + + + + + + ); }; @@ -56,8 +60,4 @@ const useStyles = createStyles(() => ({ dataRow: { cursor: 'pointer', }, - collapseTableDataCell: { - border: 'none !important', - padding: '0 !important', - }, }));