Skip to content

Commit

Permalink
client: add notification page to protected route
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubham-Lal authored Aug 8, 2024
2 parents 367556e + 05f62e9 commit c34942d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 36 deletions.
2 changes: 1 addition & 1 deletion client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function App() {
<Route path='/create' element={<ProtectedRoute><CreateDebatePage isScrollingUp={isScrollingUp} isFullscreen={!sidebar} /></ProtectedRoute>} />
<Route path='/hot-topics' element={<HotTopicsPage />} />
<Route path='/open-topics' element={<OpenTopicsPage />} />
<Route path='/notifications' element={<NotificationPage />} />
<Route path='/notifications' element={<ProtectedRoute><NotificationPage /></ProtectedRoute>} />
<Route path=':username' element={<UserProfile isScrollingUp={isScrollingUp} />} />
</Routes>
</main>
Expand Down
13 changes: 0 additions & 13 deletions client/src/components/sidebar/left-sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@
font-size: 22px;
}

#left-sidebar li:nth-child(2) {
display: none;
}

.underline {
display: inline-block;
position: relative;
Expand Down Expand Up @@ -140,11 +136,6 @@
gap: 30px;
}

#left-sidebar li:nth-child(2) {
display: inline-flex;
justify-content: center;
}

#left-sidebar .profile__container {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -207,10 +198,6 @@
justify-content: center;
}

#left-sidebar li:nth-child(6) {
display: none;
}

#left-sidebar .links__wrapper p {
display: none;
}
Expand Down
12 changes: 10 additions & 2 deletions client/src/components/sidebar/profile.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@
flex-shrink: 0;
}

.notification-btn,
.profile__image,
.modal-profile__image {
background-color: var(--explore_input_bg);
}

.theme-btn,
.notification-btn {
.theme-btn {
display: none;
background-color: var(--explore_input_bg);
}
Expand Down Expand Up @@ -167,6 +167,10 @@
}

@media screen and (max-width: 767px) {
.profile__wrapper {
flex-direction: column;
}

.profile__wrapper .auth-btn {
width: 40px;
height: 40px;
Expand Down Expand Up @@ -198,6 +202,10 @@
}

@media screen and (max-width: 480px) {
.profile__wrapper {
flex-direction: row;
}

.profile__modal {
padding-top: 10px;
padding-bottom: 15px;
Expand Down
26 changes: 13 additions & 13 deletions client/src/components/sidebar/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,22 @@ const Profile: React.FC<ProfileProps> = ({ isVisible }) => {

return (
<div className='profile__wrapper'>
<Link
to='/notifications'
className='notification-btn'
style={{
borderWidth: '2px',
borderStyle: 'solid',
borderColor: location.pathname === '/notifications' ? 'var(--body_color)' : 'transparent'
}}
>
<PiBellSimpleFill size={20} />
</Link>
{isAuthenticated === AuthStatus.Authenticating ? (
<LoadingSkeleton style={{ width: '40px', height: '40px', borderRadius: '50%' }} />
) : isAuthenticated === AuthStatus.Authenticated ? (
<>
<div
<Link
to='/notifications'
className='notification-btn'
style={{
borderWidth: '2px',
borderStyle: 'solid',
borderColor: location.pathname === '/notifications' ? 'var(--body_color)' : 'transparent'
}}
>
<PiBellSimpleFill size={20} />
</Link>
<button
className='profile__image'
style={{
borderWidth: '2px',
Expand All @@ -88,7 +88,7 @@ const Profile: React.FC<ProfileProps> = ({ isVisible }) => {
) : (
<FaRegUser style={{ width: '50%', height: '50%' }} />
)}
</div>
</button>
</>
) : authTab === AuthTab.Closed && (
<>
Expand Down
14 changes: 7 additions & 7 deletions client/src/data/left-sidebar-links.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { RiHome2Fill, RiFireFill } from 'react-icons/ri'
import { FaFeather } from 'react-icons/fa6'
import { IoSearch } from 'react-icons/io5'
import { PiBellSimpleFill } from 'react-icons/pi'
import { IoMdCreate } from 'react-icons/io'
// import { PiBellSimpleFill } from 'react-icons/pi'

export const leftSidebarLinks = [
{
Expand Down Expand Up @@ -35,10 +35,10 @@ export const leftSidebarLinks = [
href: '/open-topics',
icon: FaFeather
},
{
id: 6,
name: 'Notifications',
href: '/notifications',
icon: PiBellSimpleFill
}
// {
// id: 6,
// name: 'Notifications',
// href: '/notifications',
// icon: PiBellSimpleFill
// }
]

0 comments on commit c34942d

Please sign in to comment.