Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikwilkowski committed Mar 20, 2020
2 parents a953297 + b966739 commit 84d0023
Show file tree
Hide file tree
Showing 7 changed files with 162 additions and 165 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bronzies",
"version": "1.0.1",
"version": "1.0.2",
"private": true,
"scripts": {
"start": "concurrently \"yarn start:server\" \"yarn start:app\"",
Expand All @@ -27,18 +27,18 @@
"dependencies": {
"@emotion/core": "^10.0.28",
"@reach/router": "^1.3.3",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.0",
"react-spring": "^8.0.27",
"soundmanager2": "^2.97.20170602"
"use-sound": "^0.3.0"
},
"devDependencies": {
"@testing-library/cypress": "^6.0.0",
"concurrently": "^5.1.0",
"cypress": "^4.1.0",
"cypress": "^4.2.0",
"cypress-waitfor": "^1.1.0",
"start-server-and-test": "^1.10.10"
"start-server-and-test": "^1.10.11"
},
"proxy": "http://localhost:5555",
"jest": {
Expand Down
Binary file removed public/heartbeat.m4a
Binary file not shown.
Binary file removed public/heartbeat.ogg
Binary file not shown.
Binary file removed public/heartbeat.wav
Binary file not shown.
16 changes: 8 additions & 8 deletions server/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -439,22 +439,22 @@ minimalistic-assert@^1.0.0:
dependencies:
brace-expansion "^1.1.7"

minimist@0.0.8:
version "0.0.8"
resolved "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=
minimist@^1.2.5:
version "1.2.5"
resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==

mixme@^0.3.1:
version "0.3.5"
resolved "https://registry.npmjs.org/mixme/-/mixme-0.3.5.tgz#304652cdaf24a3df0487205e61ac6162c6906ddd"
integrity sha512-SyV9uPETRig5ZmYev0ANfiGeB+g6N2EnqqEfBbCGmmJ6MgZ3E4qv5aPbnHVdZ60KAHHXV+T3sXopdrnIXQdmjQ==

mkdirp@~0.5.1:
version "0.5.1"
resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=
version "0.5.3"
resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz#5a514b7179259287952881e94410ec5465659f8c"
integrity sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==
dependencies:
minimist "0.0.8"
minimist "^1.2.5"

moment@^2.10.6:
version "2.24.0"
Expand Down
43 changes: 9 additions & 34 deletions src/cpr.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/** @jsx jsx */
import { soundManager } from 'soundmanager2/script/soundmanager2-nodebug';
// import { soundManager } from 'soundmanager2'; // debug version
import { jsx, keyframes } from '@emotion/core';
import { useState, useEffect } from 'react';
import useInterval from './useInterval';
import { Link } from '@reach/router';
import { useState, } from 'react';
import { colors } from './theme';
import useSound from 'use-sound';
import Toggle from './toggle';
import SVG from './svg';

function CPR() {
const [ refHeart, setRefHeart ] = useState( false );
const [ playSound ] = useSound('heartbeat.mp3');
const [ refBeat, setBeat ] = useState( false );
const [ mute, setMute ] = useState( true );
const [ sound, setSound ] = useState({});

const heartbeat = keyframes({
'from, to': {
Expand All @@ -23,42 +22,18 @@ function CPR() {
}
});

// Setup soundManager
useEffect( () => {
if( soundManager.ok() ) {
soundManager.setup({
onready: () => {
setSound(
soundManager.createSound({
id: 'beat',
url: [
'heartbeat.mp3',
'heartbeat.ogg',
'heartbeat.m4a',
'heartbeat.wav',
],
audioTagTimeToLive: 1000,
})
);
},
});
}

return () => soundManager.destroySound('beat');
}, []);

// Create the interval
useInterval( () => {
if( refHeart && !mute ) {
if( refBeat && !mute ) {
try {
sound.play();
playSound();
}
catch( error ) {
//
console.log( error );
}
}

setRefHeart( !refHeart );
setBeat( !refBeat );
}, 250 );

return (
Expand Down Expand Up @@ -86,7 +61,7 @@ function CPR() {
maxWidth: '400px',
maxHeight: '400px',
margin: '0 auto 1rem auto',
animation: `${ refHeart ? heartbeat : null } 0.3s`,
animation: `${ refBeat ? heartbeat : null } 0.3s`,
}} src='/sprite.svg#heart' title='Heart' />
<div css={{
position: 'absolute',
Expand Down
Loading

0 comments on commit 84d0023

Please sign in to comment.