From b0bddd40b9743f78d48a45ae802fbe4ac3a59961 Mon Sep 17 00:00:00 2001
From: Nidboj132 <28981031+Nidboj132@users.noreply.github.com>
Date: Sat, 14 Sep 2024 18:02:38 +0200
Subject: refactor: rules

---
 frontend/src/pages/Rules.tsx | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 frontend/src/pages/Rules.tsx

(limited to 'frontend/src/pages/Rules.tsx')

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 @@
+import React from 'react';
+import ReactMarkdown from 'react-markdown';
+
+import '../css/Rules.css';
+
+const Rules: React.FC = () => {
+
+    const [rulesText, setRulesText] = React.useState<string>("");
+
+    React.useEffect(() => {
+        const fetchRules = async () => {
+            try {
+                const response = await fetch(
+                    'https://raw.githubusercontent.com/pektezol/leastportalshub/main/README.md'
+                );
+                if (!response.ok) {
+                    throw new Error('Failed to fetch README');
+                }
+                const rulesText = await response.text();
+                setRulesText(rulesText);
+            } catch (error) {
+                console.error('Error fetching Rules:', error);
+            }
+            setRulesText(rulesText)
+        };
+        fetchRules();
+    }, []);
+
+
+    return (
+        <main>
+            <ReactMarkdown>{rulesText}</ReactMarkdown>
+        </main>
+    );
+};
+
+export default Rules;
-- 
cgit v1.2.3

