File tree Expand file tree Collapse file tree 3 files changed +44
-0
lines changed
Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ import { AppGitHubSplitFiles } from "@/components/libresplit/AppGitHubSplitFiles" ;
2+
3+ export function SplitFiles ( ) {
4+ return (
5+ < div >
6+ < AppGitHubSplitFiles />
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 AppGitHubSplitFiles ( ) {
7+ const [ splitFiles , setSplitFiles ] = useState < string > ( "Loading..." ) ;
8+ const [ isLoading , setIsLoading ] = useState ( true ) ;
9+
10+ const urlSplitFiles =
11+ "https://raw.githubusercontent.com/LibreSplit/LibreSplit/refs/heads/main/docs/split-files.md" ;
12+
13+ useEffect ( ( ) => {
14+ fetch ( urlSplitFiles )
15+ . then ( ( res ) => {
16+ if ( ! res . ok ) throw new Error ( `HTTP Error! Status: ${ res . status } ` ) ;
17+ return res . text ( ) ;
18+ } )
19+ . then ( ( text ) => setSplitFiles ( text ) )
20+ . catch ( ( ) => setSplitFiles ( "Failed to load README from GitHub." ) )
21+ . finally ( ( ) => setIsLoading ( false ) ) ;
22+ } , [ ] ) ;
23+
24+ if ( isLoading ) {
25+ return < AppLoading /> ;
26+ }
27+
28+ return (
29+ < div >
30+ < Markdown content = { splitFiles } />
31+ </ div >
32+ ) ;
33+ }
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { Home } from "./app/home";
44import { NotFound } from "./app/not-found" ;
55import { SettingsKeybinds } from "./app/settings-keybinds" ;
66import { Themes } from "./app/themes" ;
7+ import { AppGitHubSplitFiles } from "./components/libresplit/AppGitHubSplitFiles" ;
78import { Route , Routes } from "react-router" ;
89
910export default function AppRouter ( ) {
@@ -15,6 +16,7 @@ export default function AppRouter() {
1516 { /* Documentation Pages */ }
1617 < Route path = "/docs/auto-splitters.md" element = { < AutoSplitters /> } />
1718 < Route path = "/docs/settings-keybinds.md" element = { < SettingsKeybinds /> } />
19+ < Route path = "/docs/split-files.md" element = { < AppGitHubSplitFiles /> } />
1820 < Route path = "/docs/themes.md" element = { < Themes /> } />
1921
2022 { /* 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