diff --git a/.gitignore b/.gitignore index e927834..1bb39cc 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ tmp /data /data.db + +/logrus.log diff --git a/client/app/components/sound-list/sound-list.tsx b/client/app/components/sound-list/sound-list.tsx index 9cc9dd0..9c873dc 100644 --- a/client/app/components/sound-list/sound-list.tsx +++ b/client/app/components/sound-list/sound-list.tsx @@ -4,6 +4,8 @@ import './sound-list.scss'; interface Props { soundList: SoundType[]; type: string; + onPlayDiscord?: (sound: SoundType) => void; + showDiscordPlay?: boolean; } interface State { @@ -37,17 +39,14 @@ export class SoundList extends React.Component { } } - handleShowAudio(index: any) { - let temp = this.state.showAudioControls; - temp[index] = true; - - this.setState({ - showAudioControls: temp, - }); + handlePlayAudioInBrowser(sound: SoundType, type: string) { + const url = `/public/${type.toLowerCase()}/` + sound.name + '.' + sound.extension; + const audio = new Audio(url); + audio.play(); } render() { - const { soundList, type } = this.props; + const { onPlayDiscord, showDiscordPlay, soundList, type } = this.props; return (
@@ -74,7 +73,32 @@ export class SoundList extends React.Component { style={{ width: '100px' }} /> ) : ( -