Skip to content

Commit

Permalink
Some Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeon Vinzenz Varapragasam authored and Yeon Vinzenz Varapragasam committed Aug 8, 2023
1 parent d23e1c7 commit 60699d9
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/components/Dialogs/IntroDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ export default function IntroDialog({ handleScan, scanning, setScanning }: any)
},
action_right: () => {
onSystemSettingsChange('create_segments', assistant.wledSegments)
if (assistant.openRgb) scanForOpenRgbDevices()
if (assistant.launchpad) scanForLaunchpadDevices()
if (assistant.openRgb) scanForOpenRgbDevices()
if (assistant.wled) setScanning(0)
if (assistant.wled) handleScan()
handleNext()
Expand Down
3 changes: 0 additions & 3 deletions src/components/Dialogs/SceneDialogs/EditSceneDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,6 @@ const EditSceneDialog = () => {
)
}}
/>
{scenes &&
Array.isArray(scenes) &&
scenes.map((scene) => console.log(scene))}
</Stack>
</>
) : (
Expand Down
51 changes: 28 additions & 23 deletions src/components/Integrations/Spotify/SpotifyProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,39 +107,44 @@ const SpotifyProvider = ({ children }: ISpotifyProviderProps) => {
}

useEffect(() => {
if (!integrations.spotify?.data) return
if (!integrations.spotify?.data && integrations.spotify?.status === 1)
return
const triggersNew: SpotifyTrigger[] = []
let id = 1
const temp = integrations?.spotify?.data

Object.keys(temp).forEach((key) => {
const temp1 = temp[key]
const sceneName = temp1.name
const sceneId = key
Object.keys(temp1).forEach((key1) => {
if (temp1[key1].constructor === Array) {
if (temp1[key1][0] !== spotifyState?.track_window?.current_track?.id)
return
triggersNew.push({
id,
trigger_id: `${temp1[key1][0]}-${temp1[key1][2]}`,
songId: temp1[key1][0],
songName: temp1[key1][1],
position: getTime(temp1[key1][2]),
position_ms: temp1[key1][2],
sceneId,
sceneName
})
id += 1
}
if (temp) {
Object.keys(temp).forEach((key) => {
const temp1 = temp[key]
const sceneName = temp1.name
const sceneId = key
Object.keys(temp1).forEach((key1) => {
if (temp1[key1].constructor === Array) {
if (
temp1[key1][0] !== spotifyState?.track_window?.current_track?.id
)
return
triggersNew.push({
id,
trigger_id: `${temp1[key1][0]}-${temp1[key1][2]}`,
songId: temp1[key1][0],
songName: temp1[key1][1],
position: getTime(temp1[key1][2]),
position_ms: temp1[key1][2],
sceneId,
sceneName
})
id += 1
}
})
})
})
}
triggersNew.sort((a, b) => a.position_ms - b.position_ms)
setCurrentTriggers(triggersNew)
}, [spotifyState?.track_window?.current_track?.id, sceneTriggers.length])

useEffect(() => {
if (!player) {
if (!player || integrations.spotify.status === 0) {
setSpotifyState(undefined)
return () => '' as any
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const IntegrationCardSpotify = ({ integration }: { integration: string }) => {
setMe(i)
}
}
getMe()
if (spAuthenticated && integrations[integration].status === 1) getMe()
}, [integrations[integration].status, spAuthenticated])

return integrations[integration]?.config ? (
Expand Down
6 changes: 1 addition & 5 deletions src/pages/Pages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,7 @@ const Routings = ({ handleWs }: any) => {
<Route path="*" element={<Home />} />
</Routes>
<NoHostDialog />
<SmartBar
open={smartBarOpen}
setOpen={(e) => console.log(e)}
direct={false}
/>
<SmartBar open={smartBarOpen} setOpen={() => false} direct={false} />
</Box>
<BottomBar />
</>
Expand Down
2 changes: 1 addition & 1 deletion src/store/api/storeActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const storeActions = (set: any) => ({
},
scanForLaunchpadDevices: async () => {
const resp = await Ledfx('/api/find_launchpad', 'GET', {})
if (resp && resp.status === 'success') {
if (resp && resp.status === 'success' && resp.device) {
set(
produce((state: IStore) => {
state.launchpadDevice = resp.device
Expand Down

0 comments on commit 60699d9

Please sign in to comment.