diff --git a/public/sounds/nature/jungle.mp3 b/public/sounds/nature/jungle.mp3 new file mode 100644 index 0000000..35a3e7e Binary files /dev/null and b/public/sounds/nature/jungle.mp3 differ diff --git a/public/sounds/places/laundry-room.mp3 b/public/sounds/places/laundry-room.mp3 new file mode 100644 index 0000000..49df047 Binary files /dev/null and b/public/sounds/places/laundry-room.mp3 differ diff --git a/public/sounds/things/washing-machine.mp3 b/public/sounds/things/washing-machine.mp3 new file mode 100644 index 0000000..edddf31 Binary files /dev/null and b/public/sounds/things/washing-machine.mp3 differ diff --git a/src/components/sound/sound.tsx b/src/components/sound/sound.tsx index 64cf3a9..2df2443 100644 --- a/src/components/sound/sound.tsx +++ b/src/components/sound/sound.tsx @@ -27,8 +27,8 @@ export const Sound = forwardRef(function Sound( ) { const isPlaying = useSoundStore(state => state.isPlaying); const play = useSoundStore(state => state.play); - const select = useSoundStore(state => state.select); - const unselect = useSoundStore(state => state.unselect); + const selectSound = useSoundStore(state => state.select); + const unselectSound = useSoundStore(state => state.unselect); const setVolume = useSoundStore(state => state.setVolume); const volume = useSoundStore(state => state.sounds[id].volume); const isSelected = useSoundStore(state => state.sounds[id].isSelected); @@ -53,23 +53,23 @@ export const Sound = forwardRef(function Sound( else if (hidden && !isSelected) unselectHidden(label); }, [label, isSelected, hidden, selectHidden, unselectHidden]); - const _select = useCallback(() => { + const select = useCallback(() => { if (locked) return; - select(id); + selectSound(id); play(); - }, [select, play, id, locked]); + }, [selectSound, play, id, locked]); - const _unselect = useCallback(() => { + const unselect = useCallback(() => { if (locked) return; - unselect(id); + unselectSound(id); setVolume(id, 0.5); - }, [unselect, setVolume, id, locked]); + }, [unselectSound, setVolume, id, locked]); const toggle = useCallback(() => { if (locked) return; - if (isSelected) _unselect(); - else _select(); - }, [isSelected, _select, _unselect, locked]); + if (isSelected) unselect(); + else select(); + }, [isSelected, select, unselect, locked]); const handleClick = useCallback(() => { toggle(); diff --git a/src/data/sounds/nature.tsx b/src/data/sounds/nature.tsx index 4d20c8d..046e8ba 100644 --- a/src/data/sounds/nature.tsx +++ b/src/data/sounds/nature.tsx @@ -1,7 +1,13 @@ import { GiWaterfall } from 'react-icons/gi/index'; import { BsFire, BsFillDropletFill } from 'react-icons/bs/index'; import { BiSolidTree, BiWater } from 'react-icons/bi/index'; -import { FaWater, FaWind, FaLeaf, FaRegSnowflake } from 'react-icons/fa/index'; +import { + FaWater, + FaWind, + FaLeaf, + FaRegSnowflake, + FaTree, +} from 'react-icons/fa/index'; import type { Category } from '../types'; @@ -69,6 +75,12 @@ export const nature: Category = { label: 'Droplets', src: '/sounds/nature/droplets.mp3', }, + { + icon: , + id: 'jungle', + label: 'Jungle', + src: '/sounds/nature/jungle.mp3', + }, ], title: 'Nature', }; diff --git a/src/data/sounds/places.tsx b/src/data/sounds/places.tsx index 9ceb646..378ccc7 100644 --- a/src/data/sounds/places.tsx +++ b/src/data/sounds/places.tsx @@ -1,4 +1,8 @@ -import { BiSolidCoffeeAlt, BiSolidPlaneAlt } from 'react-icons/bi/index'; +import { + BiSolidCoffeeAlt, + BiSolidPlaneAlt, + BiSolidDryer, +} from 'react-icons/bi/index'; import { FaChurch, FaSubway, FaShoppingBasket } from 'react-icons/fa/index'; import { TbScubaMask, TbBeerFilled } from 'react-icons/tb/index'; import { GiVillage, GiCarousel } from 'react-icons/gi/index'; @@ -94,6 +98,12 @@ export const places: Category = { label: 'Laboratory', src: '/sounds/places/laboratory.mp3', }, + { + icon: , + id: 'laundry-room', + label: 'Laundry Room', + src: '/sounds/places/laundry-room.mp3', + }, ], title: 'Places', }; diff --git a/src/data/sounds/things.tsx b/src/data/sounds/things.tsx index db28117..3ba39cd 100644 --- a/src/data/sounds/things.tsx +++ b/src/data/sounds/things.tsx @@ -1,4 +1,8 @@ -import { GiWindchimes, GiFilmProjector } from 'react-icons/gi/index'; +import { + GiWindchimes, + GiFilmProjector, + GiWashingMachine, +} from 'react-icons/gi/index'; import { BsFillKeyboardFill } from 'react-icons/bs/index'; import { FaKeyboard, FaClock, FaFan } from 'react-icons/fa/index'; import { MdSmartToy, MdWaterDrop, MdRadio } from 'react-icons/md/index'; @@ -91,6 +95,12 @@ export const things: Category = { label: 'Morse Code', src: '/sounds/things/morse-code.mp3', }, + { + icon: , + id: 'washing-machine', + label: 'Washing Machine', + src: '/sounds/things/washing-machine.mp3', + }, ], title: 'Things', }; diff --git a/src/hooks/use-sound-effect.ts b/src/hooks/use-sound-effect.ts index eb47509..c7f4eb4 100644 --- a/src/hooks/use-sound-effect.ts +++ b/src/hooks/use-sound-effect.ts @@ -20,7 +20,7 @@ export function useSoundEffect(src: string, volume: number = 1) { }, [src, isBrowser]); useEffect(() => { - if (sound) sound.volume(typeof volume === 'number' ? volume : 1); + if (sound) sound.volume(volume ?? 1); }, [sound, volume]); const play = useCallback(() => { diff --git a/src/hooks/use-sound.ts b/src/hooks/use-sound.ts index 37e3779..362a550 100644 --- a/src/hooks/use-sound.ts +++ b/src/hooks/use-sound.ts @@ -34,13 +34,12 @@ export function useSound( useEffect(() => { if (sound) { - sound.loop(typeof options.loop === 'boolean' ? options.loop : false); + sound.loop(options.loop ?? false); } }, [sound, options.loop]); useEffect(() => { - if (sound) - sound.volume(typeof options.volume === 'number' ? options.volume : 0.5); + if (sound) sound.volume(options.volume ?? 0.5); }, [sound, options.volume]); const play = useCallback(() => {