MCPcopy
hub / github.com/nukeop/nuclear / RemoteControl

Function RemoteControl

packages/player/src/remoteControl/RemoteControl.tsx:9–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7import { useRemoteState } from './useRemoteState';
8
9const RemoteControl: FC = () => {
10 const { t } = useTranslation('remote');
11 const state = useRemoteState();
12 const actions = useRemoteActions();
13
14 if (state.connectionStatus === 'failed') {
15 return (
16 <NuclearJam>
17 <NuclearJam.Error
18 labels={{
19 title: t('error.title'),
20 subtitle: t('error.subtitle'),
21 }}
22 />
23 </NuclearJam>
24 );
25 }
26
27 if (!state.synced || state.connectionStatus === 'connecting') {
28 return (
29 <NuclearJam>
30 <NuclearJam.Connecting
31 labels={{
32 title: t('connecting.title'),
33 subtitle: t('connecting.subtitle'),
34 }}
35 />
36 </NuclearJam>
37 );
38 }
39
40 return (
41 <NuclearJam>
42 <NuclearJam.Header
43 connectionStatus={state.connectionStatus}
44 connectionStatusLabels={{
45 connecting: t('connection.connecting'),
46 connected: t('connection.connected'),
47 reconnecting: t('connection.reconnecting'),
48 failed: t('connection.failed'),
49 }}
50 />
51 {state.hasQueue && state.currentTrack && (
52 <NuclearJam.NowPlaying
53 title={state.currentTrack.title}
54 artist={state.currentTrack.artist}
55 coverUrl={state.currentTrack.coverUrl}
56 isLoading={state.isLoading}
57 />
58 )}
59 {state.hasQueue && (
60 <NuclearJam.Controls
61 isPlaying={state.isPlaying}
62 isLoading={state.isLoading}
63 shuffleActive={state.settings.shuffle}
64 repeatMode={state.settings.repeat}
65 isDiscoveryActive={state.settings.discovery}
66 progress={state.progress}

Callers

nothing calls this directly

Calls 2

useRemoteStateFunction · 0.90
useRemoteActionsFunction · 0.90

Tested by

no test coverage detected