From 065515c25be5ffddc9937e6b9dc90b9e1d5ae737 Mon Sep 17 00:00:00 2001 From: Lei Nelissen Date: Thu, 25 Jul 2024 17:12:23 +0200 Subject: [PATCH] chore: translation --- src/localisation/lang/en/locale.json | 6 +++- src/localisation/lang/nl/locale.json | 6 +++- src/localisation/types.ts | 6 +++- .../Player/components/MediaInformation.tsx | 31 ++++++++++++------- 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/src/localisation/lang/en/locale.json b/src/localisation/lang/en/locale.json index 085293ff..5d95536a 100644 --- a/src/localisation/lang/en/locale.json +++ b/src/localisation/lang/en/locale.json @@ -76,5 +76,9 @@ "delete": "Delete", "cancel": "Cancel", "disc": "Disc", - "lyrics": "Lyrics" + "lyrics": "Lyrics", + "direct-play": "Direct play", + "transcoded": "Transcoded", + "khz": "kHz", + "kbps": "kbps" } diff --git a/src/localisation/lang/nl/locale.json b/src/localisation/lang/nl/locale.json index 74f928b3..08f305c4 100644 --- a/src/localisation/lang/nl/locale.json +++ b/src/localisation/lang/nl/locale.json @@ -75,5 +75,9 @@ "sleep-timer": "Slaaptimer", "delete": "Verwijder", "cancel": "Annuleer", - "disc": "Schijf" + "disc": "Schijf", + "direct-play": "Direct afgespeeld", + "transcoded": "Getranscodeerd", + "khz": "kHz", + "kbps": "kbps" } diff --git a/src/localisation/types.ts b/src/localisation/types.ts index 9fbf55a3..6496a011 100644 --- a/src/localisation/types.ts +++ b/src/localisation/types.ts @@ -75,4 +75,8 @@ export type LocaleKeys = 'play-next' | 'delete' | 'cancel' | 'disc' -| 'lyrics'; \ No newline at end of file +| 'lyrics' +| 'direct-play' +| 'transcoded' +| 'khz' +| 'kbps' diff --git a/src/screens/modals/Player/components/MediaInformation.tsx b/src/screens/modals/Player/components/MediaInformation.tsx index f0828254..e1641402 100644 --- a/src/screens/modals/Player/components/MediaInformation.tsx +++ b/src/screens/modals/Player/components/MediaInformation.tsx @@ -1,15 +1,16 @@ import { Text } from '@/components/Typography'; -import { useTypedSelector } from '@/store'; import useCurrentTrack from '@/utility/useCurrentTrack'; import React from 'react-native'; import WaveformIcon from '@/assets/icons/waveform.svg'; import useDefaultStyles from '@/components/Colors'; import styled, { css } from 'styled-components/native'; +import { useMemo } from 'react'; +import { t } from '@/localisation'; const Container = styled.View` flex-direction: row; gap: 8px; - margin-top: 8px; + margin-top: 12px; margin-bottom: 16px; `; @@ -30,24 +31,28 @@ const Label = styled(Text)<{ overflow?: boolean }>` `} `; +/** + * This component displays information about the media that is being played + * back, such as the bitrate, sample rate, codec and whether it's transcoded. + */ export default function MediaInformation() { const styles = useDefaultStyles(); - const { track } = useCurrentTrack(); - const { entities } = useTypedSelector((state) => state.music.tracks); + const { track, albumTrack } = useCurrentTrack(); - if (!track) { + const mediaStream = useMemo(() => ( + albumTrack?.MediaStreams?.find((d) => d.Type === 'Audio') + ), [albumTrack]); + + if (!albumTrack || !track) { return null; } - const albumTrack = entities[track.backendId]; - const mediaStream = albumTrack.MediaStreams?.find((d) => d.Type === 'Audio'); - return ( )}