Skip to content

Commit

Permalink
chore: remove logs, update TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
fhenrich33 committed Apr 9, 2024
1 parent 7d890aa commit 9a99337
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 27 deletions.
27 changes: 5 additions & 22 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { fetchContent, parseContentIntoSentences } from "./lib/content";
import { useSpeech } from "./lib/useSpeech";

/**
TODO:
* - Playback order of events
* - Highlight word in sentence
* - Out of bounds bug(?)
* - Clear logs.
* @todo
* - Playback order of event lifecycle
* - Range bug
* - Use splice on highlight?
* - Fix failing specs due bad config, mocks: useSpeech, fetch?
*/
function App() {
const [sentences, setSentences] = useState<Array<string>>([]);
Expand Down Expand Up @@ -45,23 +45,6 @@ function App() {
state={playbackState}
/>
</div>
{/* DELETE AFTER DONE. */}
<br />
<br />
<div>
<b>DEBUG</b>
<br />
sentences: {JSON.stringify(sentences || [], null, 2)}
<br />
current sentence index: {currentSentenceIdx || 0}
<br />
current sentence: {sentences[currentSentenceIdx || 0]}
<br />
current word range: {JSON.stringify(currentWordRange || [], null, 2)}
<br />
playback state: {playbackState}
</div>
{/* DELETE AFTER DONE. */}
</div>
);
}
Expand Down
5 changes: 0 additions & 5 deletions src/lib/useSpeech.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,23 @@ const useSpeech = (sentences: Array<string>) => {

const engine = createSpeechEngine({
onBoundary: (e) => {
console.log("onBoundary", e);
setCurrentWordRange([e.charIndex, e.charIndex + e.charLength]);
},
onEnd: (e) => {
console.log("onEnd", e);
setCurrentSentenceIdx(currentSentenceIdx < sentences.length - 1 ? currentSentenceIdx + 1 : 0);
setCurrentWordRange([0, 0]);
},
onStateUpdate: (e) => {
console.log("onStateUpdate", e);
setPlaybackState(e);
},
})

const play = () => {
console.log("play pressed")
engine.load(sentences[currentSentenceIdx || 0]);
engine.play();
};

const pause = () => {
console.log("pause pressed")
engine.pause();
};

Expand Down

0 comments on commit 9a99337

Please sign in to comment.