Skip to content

Commit

Permalink
rename playing to isPlaying
Browse files Browse the repository at this point in the history
  • Loading branch information
MutazAshhab committed Aug 21, 2023
1 parent 942d9b0 commit f5b2a5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function App() {
}, [selector, network]);

useEffect(() => {
if (playing.playing && isConnected) {
if (playing.isPlaying && isConnected) {
console.warn('Subscribing to simulation data');

subscribe(SIMULATION_DATA_TOPIC, message => {
Expand All @@ -76,7 +76,7 @@ export default function App() {
});

publish(SIMULATION_DESTINATION_PATH, { status: 'START' });
} else if (!playing.playing && isConnected) {
} else if (!playing.isPlaying && isConnected) {
console.warn('Unsubscribing from simulation data');
publish(SIMULATION_DESTINATION_PATH, { status: 'STOP' });
}
Expand All @@ -85,7 +85,7 @@ export default function App() {
deactivate();
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [playing.playing]);
}, [playing.isPlaying]);

return (
<div className="h-screen w-screen items-center justify-center flex">
Expand Down
8 changes: 4 additions & 4 deletions src/zustand/usePlaying.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { create } from 'zustand';

type Playing = {
playing: boolean;
isPlaying: boolean;
play: () => void;
pause: () => void;
};

export const usePlaying = create<Playing>(set => ({
playing: false,
play: () => set({ playing: true }),
pause: () => set({ playing: false }),
isPlaying: false,
play: () => set({ isPlaying: true }),
pause: () => set({ isPlaying: false }),
}));

0 comments on commit f5b2a5e

Please sign in to comment.