Skip to content

Commit ae28fa9

Browse files
committed
Implement markdown page for troubleshooting
1 parent e3c2f1c commit ae28fa9

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

src/app/troubleshooting.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { AppGitHubTroubleshooting } from "@/components/libresplit/AppGitHubTroubleshooting";
2+
3+
export function Troubleshooting() {
4+
return (
5+
<div>
6+
<AppGitHubTroubleshooting />
7+
</div>
8+
);
9+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { useEffect, useState } from "react";
2+
3+
import { AppLoading } from "./AppLoading";
4+
import { Markdown } from "@/lib/markdown";
5+
6+
export function AppGitHubTroubleshooting() {
7+
const [troubleshooting, setTroubleshooting] = useState<string>("Loading...");
8+
const [isLoading, setIsLoading] = useState(true);
9+
10+
const urlTroubleshooting =
11+
"https://raw.githubusercontent.com/LibreSplit/LibreSplit/refs/heads/main/docs/troubleshooting.md";
12+
13+
useEffect(() => {
14+
fetch(urlTroubleshooting)
15+
.then((res) => {
16+
if (!res.ok) throw new Error(`HTTP Error! Status: ${res.status}`);
17+
return res.text();
18+
})
19+
.then((text) => setTroubleshooting(text))
20+
.catch(() => setTroubleshooting("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={troubleshooting} />
31+
</div>
32+
);
33+
}

src/router.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Home } from "./app/home";
44
import { NotFound } from "./app/not-found";
55
import { SettingsKeybinds } from "./app/settings-keybinds";
66
import { Themes } from "./app/themes";
7+
import { Troubleshooting } from "./app/troubleshooting";
78
import { AppGitHubSplitFiles } from "./components/libresplit/AppGitHubSplitFiles";
89
import { Route, Routes } from "react-router";
910

@@ -18,6 +19,7 @@ export default function AppRouter() {
1819
<Route path="/docs/settings-keybinds.md" element={<SettingsKeybinds />} />
1920
<Route path="/docs/split-files.md" element={<AppGitHubSplitFiles />} />
2021
<Route path="/docs/themes.md" element={<Themes />} />
22+
<Route path="/docs/troubleshooting.md" element={<Troubleshooting />} />
2123

2224
{/* Fall back on app's 404 page. This is because of the SPA routing trick with 404.html used in GitHub Pages. */}
2325
<Route path="*" element={<NotFound />} />

0 commit comments

Comments
 (0)