Fix hooks lints (#3)
This commit is contained in:
		
							parent
							
								
									f77ca5ed13
								
							
						
					
					
						commit
						fab691443f
					
				| 
						 | 
				
			
			@ -9,7 +9,6 @@ import {
 | 
			
		|||
  Tooltip,
 | 
			
		||||
  Legend,
 | 
			
		||||
} from 'chart.js'
 | 
			
		||||
import { ChartData } from 'chart.js'
 | 
			
		||||
import { Line } from 'react-chartjs-2'
 | 
			
		||||
import { bids as sampleBids } from '../../lib/simulator/sample-bids'
 | 
			
		||||
import { Entry, makeEntries } from '../../lib/simulator/entries'
 | 
			
		||||
| 
						 | 
				
			
			@ -147,15 +146,14 @@ function NewBidTable(props: {
 | 
			
		|||
    setNewBidType(newBidType === 'YES' ? 'NO' : 'YES')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const nextEntry = useMemo(() => {
 | 
			
		||||
  let nextEntry: Entry | null = null
 | 
			
		||||
 | 
			
		||||
  if (newBid) {
 | 
			
		||||
    const nextBid = makeBid(newBidType, newBid)
 | 
			
		||||
    const fakeBids = [...bids.slice(0, steps), nextBid]
 | 
			
		||||
    const entries = makeEntries(fakeBids)
 | 
			
		||||
      return entries[entries.length - 1]
 | 
			
		||||
    nextEntry = entries[entries.length - 1]
 | 
			
		||||
  }
 | 
			
		||||
    return null
 | 
			
		||||
  }, [newBid, newBidType, steps])
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <table className="table table-compact my-8 w-full text-center">
 | 
			
		||||
| 
						 | 
				
			
			@ -239,11 +237,7 @@ export default function Simulator() {
 | 
			
		|||
  )
 | 
			
		||||
  const probs = entries.map((entry) => entry.prob)
 | 
			
		||||
 | 
			
		||||
  // Set up chart
 | 
			
		||||
  const [chartData, setChartData] = useState({ datasets: [] } as ChartData)
 | 
			
		||||
 | 
			
		||||
  useEffect(() => {
 | 
			
		||||
    setChartData({
 | 
			
		||||
  const chartData = {
 | 
			
		||||
    labels: Array.from({ length: steps }, (_, i) => i + 1),
 | 
			
		||||
    datasets: [
 | 
			
		||||
      {
 | 
			
		||||
| 
						 | 
				
			
			@ -252,8 +246,7 @@ export default function Simulator() {
 | 
			
		|||
        borderColor: 'rgb(75, 192, 192)',
 | 
			
		||||
      },
 | 
			
		||||
    ],
 | 
			
		||||
    })
 | 
			
		||||
  }, [steps])
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <div className="relative overflow-hidden h-screen bg-gray-900">
 | 
			
		||||
| 
						 | 
				
			
			@ -303,7 +296,7 @@ export default function Simulator() {
 | 
			
		|||
            Probability of
 | 
			
		||||
            <div className="badge badge-success text-2xl h-8 w-18">YES</div>
 | 
			
		||||
          </h1>
 | 
			
		||||
          <Line data={chartData as any} height={200} />
 | 
			
		||||
          <Line data={chartData} height={200} />
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user