From cf699cf5fb8f21ebd09dc4479a72382b3a0c46bf Mon Sep 17 00:00:00 2001 From: Nitinthegreat Date: Thu, 15 Aug 2024 15:14:36 +0530 Subject: [PATCH] History page basic frontend done --- ao3 webpages/components/Sidebar/Sidebar.jsx | 6 +- ao3 webpages/src/App.jsx | 3 + ao3 webpages/src/pages/history.jsx | 61 +++++++++++++++++++++ 3 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 ao3 webpages/src/pages/history.jsx diff --git a/ao3 webpages/components/Sidebar/Sidebar.jsx b/ao3 webpages/components/Sidebar/Sidebar.jsx index b2348e7..57245ce 100644 --- a/ao3 webpages/components/Sidebar/Sidebar.jsx +++ b/ao3 webpages/components/Sidebar/Sidebar.jsx @@ -21,7 +21,9 @@ const Sidebar = () => { const handleClickBookmarks = () => { navigate('/bookmarks'); // Redirects to the BookmarksPage }; - + const handleClickHistory = () => { + navigate('/history'); // Redirects to the HistoryPage + }; React.useEffect(() => { document.addEventListener('click', handleClickOutside); @@ -76,7 +78,7 @@ const Sidebar = () => { Bookmarks -
+
diff --git a/ao3 webpages/src/App.jsx b/ao3 webpages/src/App.jsx index c752966..6c6ee0d 100644 --- a/ao3 webpages/src/App.jsx +++ b/ao3 webpages/src/App.jsx @@ -5,6 +5,7 @@ import SignUp from '../components/SignUp'; import Dashboard from './pages/dashboard'; // Corrected import import NotesPage from './pages/Notes'; import Bookmarks from './pages/bookmarks'; +import History from './pages/history'; function App() { return ( @@ -14,6 +15,8 @@ function App() { } /> {/* Corrected route */} } /> } /> + } /> + {/* Add other routes here */} Hello World
} /> {/* Add other routes here */} diff --git a/ao3 webpages/src/pages/history.jsx b/ao3 webpages/src/pages/history.jsx new file mode 100644 index 0000000..edf1ad1 --- /dev/null +++ b/ao3 webpages/src/pages/history.jsx @@ -0,0 +1,61 @@ +import React from 'react'; +import Sidebar from '../../components/Sidebar/Sidebar'; +// Demo data +const historyData = [ + { id: 1, title: "The Shoebox Project", author: "ladyjaida, dorkorific", tags: ["Friendship", "Humor"], lastVisited: "13 Aug 2024" }, + { id: 2, title: "Thee of Hearts", author: "irnan", tags: ["Steve Rogers"], lastVisited: "09 Aug 2024" }, + { id: 3, title: "Time and Tide", author: "what_alchemy", tags: ["Hurt", "Angst", "Romance"], lastVisited: "08 Aug 2024" }, + { id: 4, title: "The Course of Honour", author: "Ameona", tags: ["Court", "Romance"], lastVisited: "05 Aug 2024" }, + { id: 5, title: "A Long Winter", author: "littlemousling", tags: ["Friendship", "Adventure"], lastVisited: "01 Aug 2024" }, + { id: 6, title: "Drastically Redefining Protocol", author: "rageprufrock", tags: ["Humor", "Romance"], lastVisited: "30 Jul 2024" }, + { id: 7, title: "Twist and Shout", author: "Gabriel, StandByMe", tags: ["Angst", "Tragedy"], lastVisited: "27 Jul 2024" }, + { id: 8, title: "Two Foxes", author: "QinLong", tags: ["Naruto", "Friendship"], lastVisited: "21 Jul 2024" }, + { id: 9, title: "I am Groot", author: "greenlily", tags: ["Friendship"], lastVisited: "18 Jul 2024" }, + { id: 10, title: "This, You Protect", author: "owlet", tags: ["Emotional", "Hurt"], lastVisited: "15 Jul 2024" }, + { id: 11, title: "How to Survive a Werewolf Attack", author: "Sara Holmes", tags: ["Humor", "Angst", "Action"], lastVisited: "10 Jul 2024" }, +]; + +export default function History() { + return ( +
+ +
+

History

+
+ + + + + + + + + + + {historyData.map((item, index) => ( + + + + + + + ))} + +
+ Title + *Click to follow link + + Author + + Tags + + Last visited +
+ {item.title} + {item.author}{item.tags.join(", ")}{item.lastVisited}
+
+ +
+
+ ); +} \ No newline at end of file