+
+
+ Edit
+
+
+ diff --git a/frontend/src/pages/BloggerProfile.js b/frontend/src/pages/BloggerProfile.js new file mode 100644 index 00000000..a63841d4 --- /dev/null +++ b/frontend/src/pages/BloggerProfile.js @@ -0,0 +1,181 @@ + +function getQueryParams() { + const params = new URLSearchParams(window.location.search); + return { + name: params.get('name'), + email: params.get('email'), + profilePic: params.get('profilePic') + }; +} + +import signOut from "./Login"; + +const userDetails = getQueryParams(); + + + +export function renderProfilePage(container) { + container.innerHTML = ` +
Create and save your blog drafts below.
+ + + + + + + + + + + + +${userDetails.email}
+No drafts available. Create your first draft!
`; + + // Attach edit event listeners + const editButtons = draftList.querySelectorAll('.edit-btn'); + editButtons.forEach(button => { + button.addEventListener('click', (event) => { + event.preventDefault(); // Prevent default link behavior + + const draftIndex = event.target.dataset.index; // Get the index of the draft to edit + const draftToEdit = drafts[draftIndex]; // Get the draft object + + // Fill the form with draft details + container.querySelector('#draft-title').value = draftToEdit.title; + container.querySelector('#draft-details').value = draftToEdit.details; + container.querySelector('#draft-category').value = draftToEdit.category; + + // Remove the draft from the drafts array + drafts.splice(draftIndex, 1); + renderDrafts(); // Re-render the drafts list + }); + }); + } + + + + + + +} diff --git a/frontend/src/pages/Login.js b/frontend/src/pages/Login.js index 920ba0f0..e3d73183 100644 --- a/frontend/src/pages/Login.js +++ b/frontend/src/pages/Login.js @@ -1,12 +1,11 @@ // Function to render the login UI export function renderLogin(container) { container.innerHTML = ` -