From b7349b3f935282a12ed7b3d165d5a96f582bc0e7 Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Sat, 10 Apr 2021 09:44:15 +0530 Subject: [PATCH] Add user page --- src/App.css | 15 ++++++++ src/App.js | 8 +++-- src/pages/Home.js | 2 +- src/pages/User.js | 65 ++++++++++++++++++++++++++++++++++ src/pages/index.js | 3 ++ src/pages/shared/NavBarUser.js | 9 +++-- src/sample.config.js | 3 +- 7 files changed, 98 insertions(+), 7 deletions(-) create mode 100644 src/pages/User.js diff --git a/src/App.css b/src/App.css index 1a27319..9c97b51 100644 --- a/src/App.css +++ b/src/App.css @@ -22,3 +22,18 @@ justify-content: space-evenly; width: 60%; } + +.user { + margin: 2em 10%; + width: 80%; +} + +.user-card { + width: 20%; + margin-right: 5%; + text-align: center; +} + +.user-profile { + width: 75%; +} diff --git a/src/App.js b/src/App.js index adb2fe1..56b37cd 100644 --- a/src/App.js +++ b/src/App.js @@ -1,4 +1,4 @@ -import { React } from "react"; +import React from "react"; import "./App.css"; import { BrowserRouter as Router, @@ -7,8 +7,7 @@ import { Redirect } from "react-router-dom"; -import Home from "./pages/Home"; -import Login from "./pages/Login"; +import { Home, Login, User } from "./pages"; function App() { return ( @@ -23,6 +22,9 @@ function App() { + + + ); diff --git a/src/pages/Home.js b/src/pages/Home.js index 782c93b..2ee3c3c 100644 --- a/src/pages/Home.js +++ b/src/pages/Home.js @@ -105,7 +105,7 @@ function App() { {visibleFeeds.map(feed => )}
-
+
Filters setCategories([])}> diff --git a/src/pages/User.js b/src/pages/User.js new file mode 100644 index 0000000..f7a75e6 --- /dev/null +++ b/src/pages/User.js @@ -0,0 +1,65 @@ +import React from "react"; +import { useParams } from "react-router-dom"; +import NavBar from "./shared/NavBar"; +import NavBarUser from "./shared/NavBarUser"; +import config from "../config"; +import {Card, CardContent, CardMedia, Chip, Typography} from "@material-ui/core"; + +import feeds from "./dummyData/feeds.json"; +const feedCategories = Array.from(new Set(feeds.map(i => i.tags).flat())); + +function User() { + const { username } = useParams(); + // TODO: Grab these values from the API + const name = "Ceda EI"; + const about = "I am a 20-year old student from India who has an interest in system administration and programming. I am a Linux user who likes to rice his desktop and have some experience managing servers."; + return (<> + + + +
+
+ + + + + {name} + + + @{username} + + + +
+
+ + + + About Me + + + {about} + + + + + + + Interests + + + {feedCategories.map((tag, idx) => )} + + + +
+ +
+ ); +} + +export default User; diff --git a/src/pages/index.js b/src/pages/index.js index e69de29..79242d8 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -0,0 +1,3 @@ +export { default as Home } from "./Home"; +export { default as Login } from "./Login"; +export { default as User } from "./User"; diff --git a/src/pages/shared/NavBarUser.js b/src/pages/shared/NavBarUser.js index d87dafd..a70edde 100644 --- a/src/pages/shared/NavBarUser.js +++ b/src/pages/shared/NavBarUser.js @@ -26,6 +26,11 @@ function NavBarUser() { history.push("/"); } + function profile() { + handleClose(); + history.push("/user/ceda_ei"); + } + return (
- Profile - My account + Profile + My account Logout
diff --git a/src/sample.config.js b/src/sample.config.js index 92e77b2..b066bf9 100644 --- a/src/sample.config.js +++ b/src/sample.config.js @@ -1,4 +1,5 @@ const config = { - thumbnailServer: "http://localhost:8000" + thumbnailServer: "http://localhost:8000", + profileServer: "http://localhost:8001", }; export default config;