File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed
Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ import { AppGitHubAutoSplitters } from "@/components/libresplit/AppGitHubAutoSplitters" ;
2+
3+ export function AutoSplitters ( ) {
4+ return (
5+ < div >
6+ < AppGitHubAutoSplitters />
7+ </ div >
8+ ) ;
9+ }
Original file line number Diff line number Diff line change 1+ import { useEffect , useState } from "react" ;
2+
3+ import { AppLoading } from "./AppLoading" ;
4+ import { Markdown } from "@/lib/markdown" ;
5+
6+ export function AppGitHubAutoSplitters ( ) {
7+ const [ autoSplitters , setAutoSplitters ] = useState < string > ( "Loading..." ) ;
8+ const [ isLoading , setIsLoading ] = useState ( true ) ;
9+
10+ const urlAutoSplitters =
11+ "https://raw.githubusercontent.com/LibreSplit/LibreSplit/refs/heads/main/docs/auto-splitters.md" ;
12+
13+ // Fetch markdown from GitHub page for LibreSplit, place into the readme state.
14+ useEffect ( ( ) => {
15+ fetch ( urlAutoSplitters )
16+ . then ( ( res ) => {
17+ if ( ! res . ok ) throw new Error ( `HTTP Error! Status: ${ res . status } ` ) ;
18+ return res . text ( ) ;
19+ } )
20+ . then ( ( text ) => setAutoSplitters ( text ) )
21+ . catch ( ( ) => setAutoSplitters ( "Failed to load README from GitHub." ) )
22+ . finally ( ( ) => setIsLoading ( false ) ) ;
23+ } , [ ] ) ;
24+
25+ if ( isLoading ) {
26+ return < AppLoading /> ;
27+ }
28+
29+ return (
30+ < div >
31+ < Markdown content = { autoSplitters } />
32+ </ div >
33+ ) ;
34+ }
Original file line number Diff line number Diff line change 1+ import { AutoSplitters } from "./app/auto-splitters" ;
12import { Converter } from "./app/converter" ;
23import { Home } from "./app/home" ;
34import { NotFound } from "./app/not-found" ;
@@ -11,6 +12,7 @@ export default function AppRouter() {
1112 < Route path = "/converter" element = { < Converter /> } />
1213
1314 { /* Documentation Pages */ }
15+ < Route path = "/docs/auto-splitters.md" element = { < AutoSplitters /> } />
1416 < Route path = "/docs/themes.md" element = { < Themes /> } />
1517
1618 { /* Fall back on app's 404 page. This is because of the SPA routing trick with 404.html used in GitHub Pages. */ }
You can’t perform that action at this time.
0 commit comments