File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import SdGymLeaderboard from "./SdGymLeaderboard";
77import AboutSdGym from "./AboutSdGym" ;
88
99export default function SdGymContent ( ) {
10+ const [ rawData , setRawData ] = useState ( [ ] ) ;
1011 const [ data , setData ] = useState ( [ ] ) ;
1112 const [ dateTags , setDateTags ] = useState ( [ ] ) ;
1213 const activeDateTag = dateTags . find ( ( dt ) => dt . active ) ;
@@ -24,6 +25,7 @@ export default function SdGymContent() {
2425 const firstSheet = workbook . SheetNames [ 0 ] ;
2526 const worksheet = workbook . Sheets [ firstSheet ] ;
2627 const rawData = XLSX . utils . sheet_to_json ( worksheet ) ;
28+ setRawData ( rawData ) ;
2729
2830 // Date tags for the tables
2931 const rawDateTags = extractSortedDates ( rawData ) ;
@@ -41,6 +43,13 @@ export default function SdGymContent() {
4143 fetchExcel ( ) ;
4244 } , [ ] ) ;
4345
46+ useEffect ( ( ) => {
47+ if ( activeDateTag && rawData . length ) {
48+ const tableData = buildTableData ( rawData , activeDateTag . date ) ;
49+ setData ( tableData ) ;
50+ }
51+ } , [ activeDateTag , rawData ] ) ;
52+
4453 const extractSortedDates = ( data ) => {
4554 const datesSet = new Set ( ) ;
4655
You can’t perform that action at this time.
0 commit comments