diff options
| author | Wolfboy248 <georgejvindkarlsen@gmail.com> | 2024-09-16 18:19:19 +0200 |
|---|---|---|
| committer | Wolfboy248 <georgejvindkarlsen@gmail.com> | 2024-09-16 18:19:19 +0200 |
| commit | 4c036c9a8bb39abe3bc10a30fdfcf53fb9613e21 (patch) | |
| tree | 2162b11b64083aca965724f89e658164eec28f25 /frontend/src/pages/Rules.tsx | |
| parent | refactor: rankings page (diff) | |
| parent | refactor: proper game/map ordering (diff) | |
| download | lphub-4c036c9a8bb39abe3bc10a30fdfcf53fb9613e21.tar.gz lphub-4c036c9a8bb39abe3bc10a30fdfcf53fb9613e21.tar.bz2 lphub-4c036c9a8bb39abe3bc10a30fdfcf53fb9613e21.zip | |
Rankings page
Diffstat (limited to 'frontend/src/pages/Rules.tsx')
| -rw-r--r-- | frontend/src/pages/Rules.tsx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/frontend/src/pages/Rules.tsx b/frontend/src/pages/Rules.tsx new file mode 100644 index 0000000..516b73c --- /dev/null +++ b/frontend/src/pages/Rules.tsx | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | import React from 'react'; | ||
| 2 | import ReactMarkdown from 'react-markdown'; | ||
| 3 | |||
| 4 | import '../css/Rules.css'; | ||
| 5 | |||
| 6 | const Rules: React.FC = () => { | ||
| 7 | |||
| 8 | const [rulesText, setRulesText] = React.useState<string>(""); | ||
| 9 | |||
| 10 | React.useEffect(() => { | ||
| 11 | const fetchRules = async () => { | ||
| 12 | try { | ||
| 13 | const response = await fetch( | ||
| 14 | 'https://raw.githubusercontent.com/pektezol/leastportalshub/main/README.md' | ||
| 15 | ); | ||
| 16 | if (!response.ok) { | ||
| 17 | throw new Error('Failed to fetch README'); | ||
| 18 | } | ||
| 19 | const rulesText = await response.text(); | ||
| 20 | setRulesText(rulesText); | ||
| 21 | } catch (error) { | ||
| 22 | console.error('Error fetching Rules:', error); | ||
| 23 | } | ||
| 24 | setRulesText(rulesText) | ||
| 25 | }; | ||
| 26 | fetchRules(); | ||
| 27 | }, []); | ||
| 28 | |||
| 29 | |||
| 30 | return ( | ||
| 31 | <main> | ||
| 32 | <ReactMarkdown>{rulesText}</ReactMarkdown> | ||
| 33 | </main> | ||
| 34 | ); | ||
| 35 | }; | ||
| 36 | |||
| 37 | export default Rules; | ||