bryanlundberg / NexusTimer

Nexus Timer is a powerful unopinionated, minimalist training tool for SpeedCubing.
https://nexustimer.com/
GNU General Public License v3.0
42 stars 32 forks source link

Add text message beating personal best time #177

Closed bryanlundberg closed 12 months ago

bryanlundberg commented 12 months ago

we can improve the record alert including a legend.

  1. Need include translations
  2. Need to use the boolean from menu settings "alert - best time"

image

idrak888 commented 12 months ago

Hi I am interested in working on this

bryanlundberg commented 12 months ago

Sure, go ahead you can start @idrak888

idrak888 commented 12 months ago

Could you point me to the right file for this. Not sure where the 'new record message' is currently handled/rendered

bryanlundberg commented 12 months ago

Actually it is not rendered, doesn't exist in the app. That's the mission, create a good place to insert the text message.

If you mean where is the logic launched after doing a best time. hooks/useTimerStatistics

Doing like this you can get the overall record calculation from selected cube category.

const { global } = useTimerStatistics()

From hooks/useTimerStore const { lastSolve } = useTimerStore() This one has the last resolution details including time.

Finally in the place you want render the message make a boolean

global.best === lastSolve.time

If true message will be "congratulations...etc"

idrak888 commented 12 months ago

I have decided that HeaderTimer.tsx, right under the scramble display, would be a suitable place for the text. I did as you said and utilized the useTimerStore() and useTimerStatistics() to conditionally render the time like so:

image

Made a PR too

bryanlundberg commented 12 months ago

I will review it there, thanks!