-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAppGitHubSettingsKeybinds.tsx
More file actions
35 lines (29 loc) · 1.01 KB
/
AppGitHubSettingsKeybinds.tsx
File metadata and controls
35 lines (29 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { useEffect, useState } from "react";
import { AppLoading } from "./AppLoading";
import { Markdown } from "@/lib/markdown";
export function AppGitHubSettingsKeybinds() {
const [settingsKeybinds, setSettingsKeybinds] =
useState<string>("Loading...");
const [isLoading, setIsLoading] = useState(true);
const urlSettingsKeybinds =
"https://raw.githubusercontent.com/LibreSplit/LibreSplit/refs/heads/main/docs/settings-keybinds.md";
// Fetch markdown from GitHub page for LibreSplit, place into the readme state.
useEffect(() => {
fetch(urlSettingsKeybinds)
.then((res) => {
if (!res.ok) throw new Error(`HTTP Error! Status: ${res.status}`);
return res.text();
})
.then((text) => setSettingsKeybinds(text))
.catch(() => setSettingsKeybinds("Failed to load README from GitHub."))
.finally(() => setIsLoading(false));
}, []);
if (isLoading) {
return <AppLoading />;
}
return (
<div>
<Markdown content={settingsKeybinds} />
</div>
);
}