diff --git a/client/index.html b/client/index.html index 60ee596..b2b9125 100644 --- a/client/index.html +++ b/client/index.html @@ -4,7 +4,7 @@ - Vite + React + Peetcode diff --git a/client/src/App.jsx b/client/src/App.jsx index f376af0..e1e74de 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -1,32 +1,26 @@ -import { BrowserRouter , Routes , Route } from "react-router-dom"; - -import HomePage from "./Components/HomePage/HomePage" +import { BrowserRouter, Routes, Route } from "react-router-dom"; +import HomePage from "./Components/HomePage/HomePage"; import AllProblems from "./Components/AllProblems/AllProblems"; - -import Navbar from "./Constants/Navbar/Navbar" +import Navbar from "./Constants/Navbar/Navbar"; import ProblemsPage from "./Components/ProblemsPage/ProblemsPage"; -import Signup from "./Components/Signup/Signup" -import Login from "./Components/Login/Login" -import "./App.css" +import Signup from "./Components/Signup/Signup"; +import Login from "./Components/Login/Login"; +import "./App.css"; function App() { - - return ( - - - - } /> - } /> - } /> - } /> - } /> - 404 Not Found} /> - - - //
- // Finish the assignment! Look at the comments in App.jsx as a starting point - //
- ) + return ( + + + + } /> + } /> + } /> + } /> + } /> + 404 Not Found} /> + + + ); } -export default App +export default App; diff --git a/client/src/Components/AllProblems/AllProblems.jsx b/client/src/Components/AllProblems/AllProblems.jsx index 1e16e6b..0ae1b56 100644 --- a/client/src/Components/AllProblems/AllProblems.jsx +++ b/client/src/Components/AllProblems/AllProblems.jsx @@ -1,50 +1,46 @@ -import React, {useEffect, useState} from 'react' -import { Link } from 'react-router-dom' - -import "./AllProblems.css" +import React, { Suspense, useEffect, useState } from "react"; +import { Link } from "react-router-dom"; +import "./AllProblems.css"; import { backendUrl } from "../../constants.js"; const AllProblemsPage = () => { const [problems, setProblems] = useState([]); - const init = async () => { const response = await fetch(`${backendUrl}/problems`, { method: "GET", }); - const json = await response.json(); setProblems(json.problems); - } + }; useEffect(() => { - init() + init(); }, []); return (
- - - {problems.map((prob,index) => ( - - - - - - - - ))} - + Loading Problems...}> + {problems.map((prob, index) => ( + + + + + + + + ))} +
Title Difficulty Acceptance
{prob.title}{prob.difficulty}{prob.acceptance}
{prob.title}{prob.difficulty}{prob.acceptance}
- ) -} + ); +}; -export default AllProblemsPage \ No newline at end of file +export default AllProblemsPage; diff --git a/client/src/Components/HomePage/HomePage.jsx b/client/src/Components/HomePage/HomePage.jsx index f11180c..8c78d1d 100644 --- a/client/src/Components/HomePage/HomePage.jsx +++ b/client/src/Components/HomePage/HomePage.jsx @@ -1,4 +1,4 @@ -import React from 'react' +import React, { Suspense } from 'react' import "./HomePage.css" import loremContent from './LoremPosts' @@ -6,6 +6,7 @@ const HomePage = () => { return (

Blogs

+ Loading Blogs...
}> {loremContent.map((content,index) => (

{content.date}

@@ -13,6 +14,7 @@ const HomePage = () => {

{content.content}

))} + ) diff --git a/client/src/main.jsx b/client/src/main.jsx index 5cc5991..f18b0f0 100644 --- a/client/src/main.jsx +++ b/client/src/main.jsx @@ -1,10 +1,10 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import App from './App' -import './index.css' +import React from "react"; +import ReactDOM from "react-dom/client"; +import App from "./App"; +import "./index.css"; -ReactDOM.createRoot(document.getElementById('root')).render( +ReactDOM.createRoot(document.getElementById("root")).render( - , -) + +);