Skip to content

Commit

Permalink
Fixing a minor glitch
Browse files Browse the repository at this point in the history
  • Loading branch information
Almighty42 committed Sep 21, 2022
1 parent 1788464 commit e247872
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 14 deletions.
5 changes: 2 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ function createWindow() {
preload: __dirname + '/preload.js',
contextIsolation: true,
partition: true,
webSecurity: true
webSecurity: true,
devTools: false
}
})

console.log(`file://${path.join(__dirname, '/build/index.html')}`)

mainWindow.loadURL(`file://${path.join(__dirname, '/build/index.html')}`)

ipcMain.on('minimize', () => {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "soundbit",
"version": "1.0.0",
"version": "1.1.0",
"private": true,
"description": "App Description",
"author": "Almighty42",
Expand Down
2 changes: 0 additions & 2 deletions src/Comps/SoundSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ export default function SoundSlider({ audio }) {
} else if (deltaY < 0) {
setStateVolum(statevolum+5)
audio.current.volume = statevolum * 0.01;
} else {
console.log(" deltaY error ")
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Context/PlayerState.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const PlayerState = props => {

// Prev song
const prevSong = () => {
console.log("PrevSong")
if (state.currentSong === 0) {
SetCurrent(state.songs.length - 1)
} else {
Expand All @@ -59,14 +58,15 @@ const PlayerState = props => {
const toggleRandom = (id) => dispatch({ type: TOGGLE_RANDOM, data: state.random ? false : true })

// End of Song
const handleEnd = () => {
const handleEnd = (func) => {
// Check for random and repeat options
if (state.random) {
return dispatch({ type: SET_CURRENT_SONG, data: ~~(Math.random() * state.songs.length) })
} else {
if (state.repeat) {
nextSong()
} else if ((state.currentSong === state.songs.length - 1)) {
func()
return
} else {
nextSong();
Expand Down
2 changes: 0 additions & 2 deletions src/PageComps/FileBrowser/Navbar/FilterSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ const FilterSection = () => {

useEffect(() => {
window.electronAPI.asyncReply1((event, arg) => {
console.log("Async Reply 1")
// If the IPC reply is successful
if (!arg.other[0]) {

Expand Down Expand Up @@ -140,7 +139,6 @@ const FilterSection = () => {
}
})
window.electronAPI.asyncReply2((event, arg) => {
console.log("Async Reply 2")
// If the IPC reply is successful
if (!arg.other[0]) {
setFlip2(true)
Expand Down
12 changes: 10 additions & 2 deletions src/PageComps/PlayerNavbar/PlayerNavbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,19 @@ const PlayerNavbar = () => {
playing,
handleEnd,
SetCurrent,
togglePlaying
} = useContext(playerContext)
const { audioFlip,
currentTime,
setCurrentTime,
val,
playIconMorphInput
} = useContext(ThemeContext)
// useRef //
const audio = useRef('audio_tag');
// useEffect //
useEffect(() => {
toggleAudio()
console.log("Audio")
}, [audioFlip])

useEffect(() => {
Expand Down Expand Up @@ -98,6 +99,13 @@ const PlayerNavbar = () => {
}
}

const iconChange = () => {
playIconMorphInput(true);
togglePlaying();
setCurrentTime(0);
audio.current.currentTime = 0
}

return (
<>
<div className={classes.navbar}>
Expand All @@ -111,7 +119,7 @@ const PlayerNavbar = () => {

onTimeUpdate={(e) => setCurrentTime(e.target.currentTime)}
onCanPlay={(e) => setDur(e.target.duration)}
onEnded={handleEnd}
onEnded={() => { handleEnd(iconChange) }}
autoPlay={autoplayState}

ref={audio}
Expand Down

0 comments on commit e247872

Please sign in to comment.