diff --git a/src/App.tsx b/src/App.tsx index 76738b6..18604de 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -6,17 +6,19 @@ import './App.css'; import BenchmarkDetail from './components/Benchmarks/BenchmarkDetail'; import Benchmarks from './components/Benchmarks/Benchmarks'; import CreateBenchmark from './components/Benchmarks/CreateBenchmark'; +import UserBenchmarks from './components/Benchmarks/UserBenchmarks'; import Landing from './components/Landing'; import Login from './components/Login'; import Register from './components/Register'; import PrivateRoute from './components/Routing/PrivateRoute'; import Rules from './components/rules/Rules'; +import User from './components/User'; function App() { const queryClient = new QueryClient(); return ( -
+
@@ -29,8 +31,13 @@ function App() { + + ) => { + let benchmarks: benchmarkModel[] = []; + const { + isLoading: isBenchmarksLoading, + isError: isBenchmarksError, + data: benchmarksData, + error, + } = useBenchmarksForUser(match.params.id); + + if (isBenchmarksLoading) { + return Loading....; + } + + if (isBenchmarksError) { + if (error) { + return Error: {error.message}; + } + } + + if (benchmarksData) { + benchmarks = benchmarksData; + } + + return ( + +
+
+
+
+
+
+ + + + + + + + + + + + {benchmarks.map((benchmark: benchmarkModel) => ( + + ))} + +
+ Title + + Subject + + Difficulty + + Creator + + View +
+
+
+
+
+
+ + ); +}; + +export default UserBenchmarks; diff --git a/src/components/Page/Navbar.tsx b/src/components/Page/Navbar.tsx index 911491a..e9eac3b 100644 --- a/src/components/Page/Navbar.tsx +++ b/src/components/Page/Navbar.tsx @@ -5,7 +5,7 @@ import Gravatar from 'react-gravatar'; import { Link, useHistory } from 'react-router-dom'; import useDarkMode from 'use-dark-mode'; import { useToken } from '../../hooks/token'; -import useProfile from '../../hooks/users'; +import { useProfile } from '../../hooks/users'; const navigation = ['Benchmarks', 'Rules']; const profile = ['Your Profile', 'Settings', 'Sign out']; @@ -71,29 +71,27 @@ export default function Navbar() {
- {navigation.map( - (item, itemIdx) => ( - // itemIdx === 0 ? ( - // - // {/* Current: "bg-gray-900 text-white", Default: "text-gray-300 hover:bg-gray-700 hover:text-white" */} - // - // {item} - // - // - // ) : ( - - {item} - - ), - // ) - )} + + {'All benchmarks'} + + + {'My benchmarks'} + + + {'My profile'} +
@@ -184,6 +182,16 @@ export default function Navbar() { )} ))} */} + + + Profile + +