@@ -1711,21 +1711,74 @@ let make = (~versions: array<string>) => {
1711
1711
1712
1712
let headers = Array .mapWithIndex (tabs , (tab , i ) => {
1713
1713
let title = switch tab {
1714
- | Output => "Output"
1715
- | JavaScript => "JavaScript"
1716
- | Problems => "Problems"
1717
- | Settings => "Settings"
1714
+ | Output => "Output" -> React .string
1715
+
1716
+ | JavaScript => "JavaScript" -> React .string
1717
+
1718
+ | Problems => {
1719
+ let problemCounts : {"warnings" : int , "errors" : int } = switch compilerState {
1720
+ | Compiling ({state : ready })
1721
+ | Ready (ready )
1722
+ | Executing ({state : ready })
1723
+ | SwitchingCompiler (ready , _ ) => {
1724
+ "warnings" : switch ready .result {
1725
+ | Comp (Success ({warnings })) => warnings -> Array .length
1726
+ | _ => 0
1727
+ },
1728
+ "errors" : switch ready .result {
1729
+ | FinalResult .Comp (Fail (result )) =>
1730
+ switch result {
1731
+ | SyntaxErr (errors ) | TypecheckErr (errors ) | OtherErr (errors ) => errors -> Array .length
1732
+ | WarningErr (errors ) => errors -> Array .length
1733
+ | WarningFlagErr (_ ) => 1
1734
+ }
1735
+ | Conv (Fail ({details })) => details -> Array .length
1736
+ | Comp (Success (_ )) => 0
1737
+ | Conv (Success (_ )) => 0
1738
+ | Comp (UnexpectedError (_ ))
1739
+ | Conv (UnexpectedError (_ ))
1740
+ | Comp (Unknown (_ ))
1741
+ | Conv (Unknown (_ )) => 1
1742
+ | Nothing => 0
1743
+ },
1744
+ }
1745
+
1746
+ | SetupFailed (_ ) | Init => {
1747
+ "warnings" : 0 ,
1748
+ "errors" : 0 ,
1749
+ }
1750
+ }
1751
+
1752
+ <div className = "inline-flex items-center gap-2" >
1753
+ {if problemCounts ["errors" ] > 0 {
1754
+ <span className = "text-fire bg-fire-100 px-0.5" >
1755
+ {problemCounts ["errors" ]-> React .int }
1756
+ </span >
1757
+ } else {
1758
+ React .null
1759
+ }}
1760
+ {if problemCounts ["warnings" ] > 0 {
1761
+ <span className = "text-orange bg-orange-15 px-0.5" >
1762
+ {problemCounts ["warnings" ]-> React .int }
1763
+ </span >
1764
+ } else {
1765
+ React .null
1766
+ }}
1767
+ {"Problems" -> React .string }
1768
+ </div >
1769
+ }
1770
+
1771
+ | Settings => "Settings" -> React .string
1718
1772
}
1773
+
1719
1774
let onClick = evt => {
1720
1775
ReactEvent .Mouse .preventDefault (evt )
1721
1776
ReactEvent .Mouse .stopPropagation (evt )
1722
1777
setCurrentTab (_ => tab )
1723
1778
}
1724
1779
let active = currentTab === tab
1725
1780
let className = makeTabClass (active )
1726
- <button key = {Int .toString (i ) ++ ("-" ++ title )} onClick className disabled >
1727
- {React .string (title )}
1728
- </button >
1781
+ <button key = {Int .toString (i )} onClick className disabled > {title } </button >
1729
1782
})
1730
1783
1731
1784
<main className = {"flex flex-col bg-gray-100 overflow-hidden" }>
0 commit comments