web icon indicating copy to clipboard operation
web copied to clipboard

feat: new hook `useSpeech`

Open malavshah9 opened this issue 2 years ago • 15 comments

Hook description

Hook for playing text using the SpeechSynthesis API.

Valid use-case for the hook

  • Playing text when a component mounts.
  • Playing text when a component unmounts.
  • Playing text when a component receives new props.
  • Playing text when a component receives new state.
  • Playing text when a user clicks a button.
  • Playing text when a user hovers over an element.
  • Playing text when a user scrolls to a certain point on the page.
  • Playing text when a user types in an input.
  • Playing text when a user submits a form.
  • Playing text when a user presses a key.
  • Playing text when a user presses a key combination.
  • Playing text when a user presses a key combination and holds it down.

Checklist

  • [x] Have you read the contribution guidelines?
  • [x] If you are porting a hook from react-use, have you checked #33 and the migration guide to confirm that the hook has been approved for porting?
  • [x] Does the code have comments in hard-to-understand areas?
  • [x] Is there an existing issue for this PR?
    • https://github.com/react-hookz/web/issues/33
  • [x] Have the files been linted and formatted?
  • [x] Have the docs been updated?
  • [x] Have you written tests for the new hook?
  • [x] Have you run the tests locally to confirm they pass?

malavshah9 avatar Sep 18 '23 19:09 malavshah9

@JoeDuncko @xobotyi Please review this PR

malavshah9 avatar Sep 19 '23 14:09 malavshah9

@JoeDuncko @xobotyi Please review this PR

malavshah9 avatar Sep 21 '23 09:09 malavshah9

ill review it sometime this week

xobotyi avatar Sep 21 '23 09:09 xobotyi

@xobotyi Any update on PR review?

malavshah9 avatar Sep 25 '23 04:09 malavshah9

@xobotyi Any update on review?

malavshah9 avatar Oct 08 '23 06:10 malavshah9

On review - no, tests - failing =)

xobotyi avatar Oct 08 '23 16:10 xobotyi

@xobotyi Fixed test cases. You can check now.

malavshah9 avatar Oct 09 '23 17:10 malavshah9

@xobotyi Any update on this?

malavshah9 avatar Oct 11 '23 18:10 malavshah9

Codecov Report

Merging #1378 (79ab0e9) into master (c898241) will decrease coverage by 1.17%. Report is 40 commits behind head on master. The diff coverage is 60.60%.

@@            Coverage Diff             @@
##           master    #1378      +/-   ##
==========================================
- Coverage   99.62%   98.46%   -1.17%     
==========================================
  Files          62       63       +1     
  Lines        1072     1105      +33     
  Branches      169      174       +5     
==========================================
+ Hits         1068     1088      +20     
- Misses          2       12      +10     
- Partials        2        5       +3     
Files Coverage Δ
src/index.ts 100.00% <100.00%> (ø)
src/useSpeech/index.ts 59.37% <59.37%> (ø)

... and 9 files with indirect coverage changes

:mega: Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

codecov[bot] avatar Oct 15 '23 08:10 codecov[bot]

youi also have to add the hook to radme. otherwise - looks good

xobotyi avatar Oct 22 '23 14:10 xobotyi

also linting is failing

xobotyi avatar Oct 22 '23 14:10 xobotyi

@xobotyi Added hook in readme.md

I checked linting but it is not failing. Let me know by which command it is failing.

malavshah9 avatar Nov 02 '23 18:11 malavshah9

You can see linting annotations within files tab of pull request.

Linter should be run with yarn lint command

xobotyi avatar Nov 02 '23 18:11 xobotyi

@xobotyi Fixed linting. You can check now.

malavshah9 avatar Nov 03 '23 19:11 malavshah9

you should also add tests for pausing resuming, etc. you should target 100% coverage and in this case is it easily achievable.

xobotyi avatar Nov 06 '23 12:11 xobotyi