File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed
Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ import { AppGitHubThemes } from "@/components/libresplit/AppGitHubThemes" ;
2+
3+ export function Themes ( ) {
4+ return (
5+ < div >
6+ < AppGitHubThemes />
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 AppGitHubThemes ( ) {
7+ const [ themes , setThemes ] = useState < string > ( "Loading..." ) ;
8+ const [ isLoading , setIsLoading ] = useState ( true ) ;
9+
10+ const urlThemes =
11+ "https://raw.githubusercontent.com/LibreSplit/LibreSplit/refs/heads/main/docs/themes.md" ;
12+
13+ useEffect ( ( ) => {
14+ fetch ( urlThemes )
15+ . then ( ( res ) => {
16+ if ( ! res . ok ) throw new Error ( `HTTP Error! Status: ${ res . status } ` ) ;
17+ return res . text ( ) ;
18+ } )
19+ . then ( ( text ) => setThemes ( text ) )
20+ . catch ( ( ) => setThemes ( "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 = { themes } />
31+ </ div >
32+ ) ;
33+ }
Original file line number Diff line number Diff line change 11import { Converter } from "./app/converter" ;
22import { Home } from "./app/home" ;
33import { NotFound } from "./app/not-found" ;
4+ import { Themes } from "./app/themes" ;
45import { Route , Routes } from "react-router" ;
56
67export default function AppRouter ( ) {
@@ -9,6 +10,9 @@ export default function AppRouter() {
910 < Route path = "/" element = { < Home /> } />
1011 < Route path = "/converter" element = { < Converter /> } />
1112
13+ { /* Documentation Pages */ }
14+ < Route path = "/docs/themes.md" element = { < Themes /> } />
15+
1216 { /* Fall back on app's 404 page. This is because of the SPA routing trick with 404.html used in GitHub Pages. */ }
1317 < Route path = "*" element = { < NotFound /> } />
1418 </ Routes >
You can’t perform that action at this time.
0 commit comments