-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NavBar extended middleware #47
Open
pratyush1718
wants to merge
2
commits into
main
Choose a base branch
from
feature/pratyush1718/NavbarMiddleware
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React, { FC } from 'react'; | ||
|
||
const RightArrowComponent: FC = () => ( | ||
<svg xmlns="http://www.w3.org/2000/svg" width="23" height="24" viewBox="0 0 23 24" fill="none"> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.01513 17.3372C8.6486 16.9706 8.6486 16.3764 9.01513 16.0099L13.0442 11.9808L9.01513 7.95179C8.6486 7.58527 8.6486 6.99102 9.01513 6.6245C9.38165 6.25798 9.9759 6.25798 10.3424 6.6245L15.0351 11.3172C15.4016 11.6837 15.4016 12.278 15.0351 12.6445L10.3424 17.3372C9.9759 17.7037 9.38165 17.7037 9.01513 17.3372Z" fill="black"/> | ||
</svg> | ||
); | ||
|
||
export default RightArrowComponent; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export interface CategoriesData { | ||
title: string; | ||
items: [], | ||
type: String | ||
} | ||
|
||
const port = process.env.DEV_PORT || 3001; | ||
const CATEGORIES_URL = `http://localhost:${port}/api/categories`; | ||
|
||
export const getAllCategories = async () => { | ||
try { | ||
const response = await fetch(CATEGORIES_URL, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}); | ||
let data = await response.json(); | ||
data = data.categories; | ||
console.log(data); | ||
return data; | ||
} catch (error) { | ||
console.log(error) | ||
return []; | ||
} | ||
}; |
15 changes: 15 additions & 0 deletions
15
admin-portal-frontend/src/app/components/BlankPageComponent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React, { FC } from 'react'; | ||
|
||
interface Props { | ||
category?: string; | ||
} | ||
|
||
const BlankPageComponent: FC<Props> = ({ category }) => { | ||
return ( | ||
<div> | ||
<p>This is the blank page </p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default BlankPageComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,15 @@ | |
|
||
import styles from './VerticalNavBarStyles'; | ||
import HomeComponent from './HomeComponent'; | ||
import React, { ReactNode } from 'react'; | ||
import React, { ReactNode, useEffect, useState } from 'react'; | ||
import Accordion from 'react-bootstrap/Accordion'; | ||
import 'bootstrap/dist/css/bootstrap.css'; | ||
import { Card } from 'react-bootstrap'; | ||
import GpComponent from './GPComponent'; | ||
import SearchComponent from './SearchComponent'; | ||
import { getAllCategories } from '../api/categories'; | ||
import { NavLink } from 'react-router-dom'; | ||
|
||
|
||
const VerticalNavBar: React.FC = () => { | ||
|
||
interface CustomAccordionProps { | ||
|
@@ -26,6 +27,24 @@ import SearchComponent from './SearchComponent'; | |
); | ||
} | ||
|
||
interface Category { | ||
_id: string; | ||
title: String; | ||
items: []; | ||
type: String; | ||
} | ||
|
||
const [items, setItems] = useState<Category[]>([]); | ||
useEffect(() => { | ||
(async () => { | ||
const categories = await getAllCategories(); | ||
setItems(categories); | ||
})(); | ||
}, []); | ||
|
||
const generalPrinciples = items.filter(category => category.type === 'General Principle'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
|
||
return ( | ||
|
||
|
||
|
@@ -82,19 +101,19 @@ import SearchComponent from './SearchComponent'; | |
</div> | ||
</Accordion.Header> | ||
<Accordion.Body> | ||
<ul style={{ listStyleType: 'none' }}> | ||
<li style={styles.listItem}>All</li> | ||
<li style={styles.listItem}>Emergency Action Plan</li> | ||
<li style={styles.listItem}>Trauma Centers</li> | ||
<li style={styles.listItem}>Burn Centers</li> | ||
<li style={styles.listItem}>Stroke Centers</li> | ||
<li style={styles.listItem}>Serious On-Field Injury</li> | ||
<li style={styles.listItem}>Catastrophic Incident</li> | ||
<li style={styles.listItem}>Adminstering Medication</li> | ||
<li style={styles.listItem}>Muscle Injuries</li> | ||
<li style={styles.listItem}>Ligament Injuries</li> | ||
<li style={styles.listItem}>Dislocations/Sublaxations</li> | ||
<li style={styles.listItem}>Fractures</li> | ||
|
||
<ul> | ||
{generalPrinciples.map(category => ( | ||
<li style={styles.listItem} key={category._id}> | ||
<NavLink to={`/category/${category._id}`} style={({ isActive }) => { | ||
return { | ||
textDecoration: 'none', | ||
fontWeight: isActive ? "bold" : "", | ||
color: isActive ? "var(--DFM-Navy, #182B49)" : "var(--Neutral-Gray6, #484848)", | ||
}; | ||
}} className="active">{category.title}</NavLink> | ||
</li> | ||
))} | ||
</ul> | ||
|
||
</Accordion.Body> | ||
|
@@ -110,5 +129,6 @@ import SearchComponent from './SearchComponent'; | |
</div> | ||
); | ||
}; | ||
|
||
|
||
export default VerticalNavBar; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to have this url pull from a .env so it works in deployment. Lillian and Edwards pr has a similar file though, maybe you can just use this one once their pr is merged