- 
                Notifications
    You must be signed in to change notification settings 
- Fork 16
Show track rubbered state in the Weather overlay #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
  File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            16 changes: 16 additions & 0 deletions
          
          16 
        
  src/frontend/components/Weather/WeatherTrackRubbered/WeatherTrackRubbered.tsx
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import React from 'react'; | ||
| import { Path } from '@phosphor-icons/react'; | ||
| interface Props { | ||
| trackRubbered: string | undefined; | ||
| } | ||
|  | ||
| export const WeatherTrackRubbered: React.FC<Props> = ({ trackRubbered }) => { | ||
| return ( | ||
| <div className="bg-slate-800/70 p-2 rounded-sm"> | ||
| <div className="flex flex-row items-center gap-6"> | ||
| <span className="text-m text-gray-400 mr-1"><Path /></span> | ||
| <span className="text-sm">{trackRubbered ?? 'N/A'}</span> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | 
        
          
          
            12 changes: 12 additions & 0 deletions
          
          12 
        
  src/frontend/components/Weather/hooks/useTrackRubberedState.tsx
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { useSessionStore } from '@irdashies/context'; | ||
| import { useStore } from 'zustand'; | ||
|  | ||
| export const useTrackRubberedState = () => { | ||
| return useStore( | ||
| useSessionStore, | ||
| (state) => | ||
| state.session?.SessionInfo?.Sessions?.find( | ||
| (session) => session.SessionNum === 0 | ||
| )?.SessionTrackRubberState | ||
| ); | ||
| }; | ||
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it SessionNum 0? I think you should use current session number. Like for example here: https://github.com/tariknz/irdashies/blob/76b1ba72a8d829b4a3db9cb9175556e68b431eae/src/frontend/components/Standings/hooks/useSessionLapCount.tsx#L5-L6C23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point sorry I missed that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My fault for submitting unread code ;) I guess the effect is that you get stale track state for practice during qualy and race. I'll try to fix and submit a new PR later today when I get home
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a look at this, and the plot seriously thickened:
I almost regret submitting this now 🤣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm stupid it´s a very easy fix, I'll submit another PR with a sane handling of this