File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ import { AppGitHubReadme } from "@/components/libresplit/AppGitHubReadme" ;
2+
13export function Home ( ) {
24 return (
35 < div >
46 < h1 > LibreSplit</ h1 >
7+ < AppGitHubReadme />
58 </ div >
69 ) ;
710}
Original file line number Diff line number Diff line change 1+ import { useEffect , useState } from "react" ;
2+
3+ export function AppGitHubReadme ( ) {
4+ const [ readme , setReadme ] = useState < string > ( "Loading..." ) ;
5+
6+ // Fetch markdown from GitHub page for LibreSplit.
7+ const urlReadme = "https://raw.githubusercontent.com/LibreSplit/LibreSplit/refs/heads/main/README.md" ;
8+ useEffect ( ( ) => {
9+ fetch ( urlReadme )
10+ . then ( ( res ) => {
11+ if ( ! res . ok ) throw new Error ( "HTTP Error! Status: ${res.status}" ) ;
12+ return res . text ( ) ;
13+ } )
14+ . then ( ( text ) => setReadme ( text ) )
15+ . catch ( ( ) => {
16+ setReadme ( "Failed to load README from GitHub." ) ;
17+ } ) ;
18+ } , [ ] ) ;
19+
20+ return (
21+ < div >
22+ < p > { readme } </ p >
23+ </ div >
24+ ) ;
25+ }
You can’t perform that action at this time.
0 commit comments