Skip to content

Conversation

@SHREESHANTH99
Copy link
Contributor

@SHREESHANTH99 SHREESHANTH99 commented Jul 4, 2025

Overview

This PR fixes part of [Feature Request]: Add Route Protection to Frontend #25.

This PR does the following:

Adds a reusable component to protect sensitive routes like /home and /profile.

Redirects unauthenticated users to /login.

Renders only inside protected pages (e.g., Home.jsx), cannot be rendered before login is done

##Essential Checklist
The PR title starts with Fix part of #25: followed by a clear summary.

"Allow edits from maintainers" is checked.

The PR is made from a branch not called main or master.

Proof that changes are correct

Uploading Screen Recording 2025-07-04 183758.mp4…

@netlify
Copy link

netlify bot commented Jul 4, 2025

Deploy Preview for ydo-bsoc ready!

Name Link
🔨 Latest commit 0aae707
🔍 Latest deploy log https://app.netlify.com/projects/ydo-bsoc/deploys/6870a334b30a2200087c3309
😎 Deploy Preview https://deploy-preview-32--ydo-bsoc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@SHREESHANTH99
Copy link
Contributor Author

Proof that changes are correct

Screen.Recording.2025-07-04.183758.mp4

@SHREESHANTH99
Copy link
Contributor Author

@Zapper9982 is it okay.

@Zapper9982
Copy link
Collaborator

Can u share the demo after login too ?

@SHREESHANTH99
Copy link
Contributor Author

Screen.Recording.2025-07-05.110504.mp4

@Zapper9982 i added navbar in home to show you

@Zapper9982
Copy link
Collaborator

Zapper9982 commented Jul 5, 2025

@SHREESHANTH99 the expected behaviour is that the navbar be served on all routes except the landing and Login.

adding the Navbar component to each route is not a feasible option .

@SHREESHANTH99
Copy link
Contributor Author

@Zapper9982 should I make it such that it should be available it all other routes automatically except landing and login

@Zapper9982
Copy link
Collaborator

@Zapper9982 should I make it such that it should be available it all other routes automatically except landing and login

yes exactly

@SHREESHANTH99
Copy link
Contributor Author

done should i sent video

@SHREESHANTH99
Copy link
Contributor Author

Screen.Recording.2025-07-05.130846.mp4

@Zapper9982
Copy link
Collaborator

@SHREESHANTH99 can u resolve the merge conflicts

@Zapper9982 Zapper9982 requested a review from Om-Thorat July 6, 2025 04:11
@Om-Thorat
Copy link
Contributor

@SHREESHANTH99 fix the build please

@Om-Thorat
Copy link
Contributor

Resolve the conflicts as well

@SHREESHANTH99
Copy link
Contributor Author

Is it okay now

src/App.jsx Outdated

<Route path="/callback" element={<Callback />} />
<Route path="/preloader" element={<Preloader />} />
<Route path="/profile" element={<ProfilePage />} />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the other endpoints have protection too ? Please add the private route components to others too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only profile and home page right I will add protection to profile too then

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only profile and home page right I will add protection to profile too then

we need protection for every route that will come apart from Home and Login can u implement it like that ? , cause just adding the PrivaterRoute around each route one by one , is redundant and is not production ready .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

SHREESHANTH99 and others added 11 commits July 10, 2025 11:33
Navbar be served on all routes except landing and login.

Closes bsoc-bitbyte#25
created a profile page which is editable using react usestate with /profile route

Closes bsoc-bitbyte#18
- Increase branch and year input box widths for better usability
- Fix layout shifts when switching between view and edit modes
- Ensure consistent font styling across input elements

Closes bsoc-bitbyte#18
- Increase branch and year input box widths for better usability
- Fix layout shifts when switching between view and edit modes
- Ensure consistent font styling across input elements

Closes bsoc-bitbyte#18
made a few changes in the width of the branchinput and year boxes

Closes bsoc-bitbyte#18
Made changes according to requirement.
Closes bsoc-bitbyte#25
Made changes according to requirement.
Closes bsoc-bitbyte#25
* feat: added the preloader

* feat: preloader background updated

* feat: preloader fixed bg and svg

Signed-off-by: Shirshendu R Tripathi <shirsh8924@gmail.com>

* feat: preloader fixed bg and svg

Signed-off-by: Shirshendu R Tripathi <shirsh8924@gmail.com>

* feat: fixed the backgrounds and comments

Signed-off-by: Shirshendu R Tripathi <shirsh8924@gmail.com>

---------

Signed-off-by: Shirshendu R Tripathi <shirsh8924@gmail.com>
@SHREESHANTH99 SHREESHANTH99 force-pushed the feature/protected-routes branch from 05f9582 to 7bcc66a Compare July 10, 2025 07:01
@Zapper9982
Copy link
Collaborator

@SHREESHANTH99 resolve all the conflicts and looks like all the checks have failed .

@Zapper9982
Copy link
Collaborator

@SHREESHANTH99 can you explain why have u force pushed ?

@SHREESHANTH99
Copy link
Contributor Author

@SHREESHANTH99 can you explain why have u force pushed ?

I forgot to merge and sync changes from main before doing commit so I was getting merge conflicts

Made changes according to requirement.
Closes bsoc-bitbyte#25
>>
>> Made changes according to requirement.
>>
>> Closes bsoc-bitbyte#25
@SHREESHANTH99 SHREESHANTH99 force-pushed the feature/protected-routes branch from cf76bc0 to 849070d Compare July 10, 2025 08:28
@SHREESHANTH99
Copy link
Contributor Author

@Zapper9982 i am getting this [Lint Commit Messages again again again what should i do?

Protected all routes except Landing, Login, and Callback by wrapping
routing logic with a central PrivateRoutesWrapper.

closes bsoc-bitbyte#25
@Zapper9982
Copy link
Collaborator

@Zapper9982 i am getting this [Lint Commit Messages again again again what should i do?

dont worry about it , one of your commit messages were not correctly listed , apart from that its okay dont worry

@SHREESHANTH99
Copy link
Contributor Author

@Zapper9982 i am getting this [Lint Commit Messages again again again what should i do?

dont worry about it , one of your commit messages were not correctly listed , apart from that its okay dont worry

I made changes of what you asked can you review

src/App.jsx Outdated
</Route>
<Route path="/callback" element={<Callback />} />
</Route>
<Route path="/preloader" element={<Preloader />} />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the preloaded into the private routes too since , the Login content exactly loads before the preloader starts

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OTHER than that looks good

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you review

@Zapper9982 Zapper9982 merged commit 9a9cd16 into bsoc-bitbyte:main Jul 15, 2025
5 of 6 checks passed
@Zapper9982 Zapper9982 added BSoC'25 Created for BSoC'25 Difficulty : Hard hard level issue labels Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BSoC'25 Created for BSoC'25 Difficulty : Hard hard level issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants