Skip to content
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

Bug: Bracket Height is calculated incorrectly when skips are present. #35

Open
ted537 opened this issue Jul 26, 2022 · 0 comments
Open

Comments

@ted537
Copy link
Contributor

ted537 commented Jul 26, 2022

Visible by adding this snippet to double-elim.stories.jsx.

export const DoubleEliminationUnbalanced = () => {                                                       
  const [width, height] = useWindowSize();                                                               
  const finalWidth = Math.max(width - 50, 500);                                                          
  const finalHeight = Math.max(height - 100, 500);                                                       
                                                                                                         
  const simpleDoubleClipped = {                                                                          
    lower: simpleDoubleFull.lower.filter(                                                                
      match => match.name !== 'LB 1.1'                                                                   
    ),                                                                                                   
    upper: simpleDoubleFull.upper.filter(                                                                
      match => match.name !== 'UB 1.1'                                                                   
    )                                                                                                    
  };                                                                                                     
                                                                                                         
  return (                                                                                               
    <DoubleElimBracketLeaderboard                                                                        
      matches={simpleDoubleClipped}                                                                      
      matchComponent={Match}                                                                             
      svgWrapper={({ children, ...props }) => (                                                          
        <StyledSvgViewer width={finalWidth} height={finalHeight} {...props}>                             
          {children}                                                                                     
        </StyledSvgViewer>                                                                               
      )}                                                                                                 
    />                                                                                                   
  );                                                                                                     
};

Note that this mock data might not entirely make sense but if the brackets are required to be balanced, then a warning should be issued when they are not. For my use case at least, the ideal solution would either a) account for the missing games when calculating dimensions or b) Fill in the "WALK OVER" matches automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant