-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from nuoxoxo/aoc
edit css
- Loading branch information
Showing
5 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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,53 @@ | ||
import { useState, useEffect } from "react" | ||
import { FetchDataWithoutTrim, /*Deepcopy2DArray*/ } from "../helpers/Helpers" | ||
|
||
const suffixes = ['in', 'alt'] | ||
const choice = suffixes[Math.floor(Math.random() * suffixes.length)] | ||
const URL:string = "https://raw.githubusercontent.com/nuoxoxo/in/main/aoc/1813." + choice | ||
|
||
var Aoc1813 = () => { | ||
|
||
const [lines, setLines] = useState<string[]>([]) | ||
const [p1] = useState<number>(0) | ||
const [p2] = useState<number>(0) | ||
|
||
const handleData = async () => { | ||
|
||
try { | ||
const raws = await FetchDataWithoutTrim(URL) | ||
setLines(raws) | ||
} catch (error: any) { | ||
console.error("Error fetching data: ", error) | ||
} | ||
} | ||
|
||
useEffect(() => { | ||
handleData() | ||
}, []) | ||
|
||
return ( | ||
<> | ||
{lines ? ( | ||
<> | ||
|
||
<div className="playground"> | ||
<div className="field res-field res-field-1813"> | ||
<span>--- 2018 Day 13: Mine Cart Madness ---</span> | ||
<span>Part 1: {p1 ? p1 : "(empty)"} </span> | ||
<span>Part 2: {p2 ? p2 : "(empty)"} </span> | ||
</div> | ||
</div> | ||
|
||
<div className="field data-field data-field-1813"> | ||
{ lines ? lines.join("\n") : "No data available." } | ||
</div> | ||
|
||
</> | ||
) : ( | ||
<p>Loading data...</p> | ||
)} | ||
</> | ||
) | ||
} | ||
|
||
export default Aoc1813 |
This file contains 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
This file contains 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