diff options
Diffstat (limited to 'frontend/src/pages/Rules.tsx')
| -rw-r--r-- | frontend/src/pages/Rules.tsx | 64 |
1 files changed, 30 insertions, 34 deletions
diff --git a/frontend/src/pages/Rules.tsx b/frontend/src/pages/Rules.tsx index 9f57b7e..9c7885c 100644 --- a/frontend/src/pages/Rules.tsx +++ b/frontend/src/pages/Rules.tsx | |||
| @@ -1,41 +1,37 @@ | |||
| 1 | import React from 'react'; | 1 | import React from "react"; |
| 2 | import ReactMarkdown from 'react-markdown'; | 2 | import ReactMarkdown from "react-markdown"; |
| 3 | import { Helmet } from 'react-helmet'; | 3 | import { Helmet } from "react-helmet"; |
| 4 | |||
| 5 | import '@css/Rules.css'; | ||
| 6 | 4 | ||
| 7 | const Rules: React.FC = () => { | 5 | const Rules: React.FC = () => { |
| 6 | const [rulesText, setRulesText] = React.useState<string>(""); | ||
| 8 | 7 | ||
| 9 | const [rulesText, setRulesText] = React.useState<string>(""); | 8 | React.useEffect(() => { |
| 10 | 9 | const fetchRules = async () => { | |
| 11 | React.useEffect(() => { | 10 | try { |
| 12 | const fetchRules = async () => { | 11 | const response = await fetch( |
| 13 | try { | 12 | "https://raw.githubusercontent.com/pektezol/lphub/main/RULES.md" |
| 14 | const response = await fetch( | 13 | ); |
| 15 | 'https://raw.githubusercontent.com/pektezol/lphub/main/RULES.md' | 14 | if (!response.ok) { |
| 16 | ); | 15 | throw new Error("Failed to fetch README"); |
| 17 | if (!response.ok) { | 16 | } |
| 18 | throw new Error('Failed to fetch README'); | 17 | const rulesText = await response.text(); |
| 19 | } | 18 | setRulesText(rulesText); |
| 20 | const rulesText = await response.text(); | 19 | } catch (error) { |
| 21 | setRulesText(rulesText); | 20 | console.error("Error fetching Rules:", error); |
| 22 | } catch (error) { | 21 | } |
| 23 | console.error('Error fetching Rules:', error); | 22 | // setRulesText(rulesText) |
| 24 | } | 23 | }; |
| 25 | // setRulesText(rulesText) | 24 | fetchRules(); |
| 26 | }; | 25 | }, []); |
| 27 | fetchRules(); | ||
| 28 | }, []); | ||
| 29 | |||
| 30 | 26 | ||
| 31 | return ( | 27 | return ( |
| 32 | <main> | 28 | <main className="ml-16 p-8 text-foreground font-[--font-barlow-semicondensed-regular] prose prose-invert max-w-none"> |
| 33 | <Helmet> | 29 | <Helmet> |
| 34 | <title>LPHUB | Rules</title> | 30 | <title>LPHUB | Rules</title> |
| 35 | </Helmet> | 31 | </Helmet> |
| 36 | <ReactMarkdown>{rulesText}</ReactMarkdown> | 32 | <ReactMarkdown>{rulesText}</ReactMarkdown> |
| 37 | </main> | 33 | </main> |
| 38 | ); | 34 | ); |
| 39 | }; | 35 | }; |
| 40 | 36 | ||
| 41 | export default Rules; | 37 | export default Rules; |