diff --git a/digital-course-file/package.json b/digital-course-file/package.json index d95ed7c40aa4ef01ee9577f7aa37aaf2298d646b..aa3dd93d2d8496dcec0a58e672268e854cb7004b 100644 --- a/digital-course-file/package.json +++ b/digital-course-file/package.json @@ -20,6 +20,7 @@ "react-google-button": "^0.7.2", "react-icons": "^4.2.0", "react-loader-spinner": "^4.0.0", + "react-router-bootstrap": "^0.25.0", "react-router-dom": "^5.2.0", "react-scripts": "4.0.2", "web-vitals": "^1.1.0" diff --git a/digital-course-file/public/favicon.ico b/digital-course-file/public/favicon.ico index a11777cc471a4344702741ab1c8a588998b1311a..9fe4ba508732955892643af0e11b7abc8e21bef3 100644 Binary files a/digital-course-file/public/favicon.ico and b/digital-course-file/public/favicon.ico differ diff --git a/digital-course-file/src/Routes.js b/digital-course-file/src/Routes.js index c13c1c718803edb4dbbb7dd7bb376344b8352092..d028e5bcbadb3a01f17388d9be62b7939d384829 100644 --- a/digital-course-file/src/Routes.js +++ b/digital-course-file/src/Routes.js @@ -10,8 +10,8 @@ import copyright from './user/copyright' import { Link } from 'react-router-dom' import { Container, Button, Navbar, Nav } from 'react-bootstrap' import fire from './fire' -import ForgotPassword from "./user/ForgotPassword" - +import ForgotPassword from './user/ForgotPassword' +import { LinkContainer } from 'react-router-bootstrap' const Routes = () => { const [user, setUser] = useState('') @@ -39,26 +39,31 @@ const Routes = () => { <h2>Course File System</h2> </Navbar.Brand> {user && ( - <Link to="/signin"> - <button className='logoutbutton' onClick={()=>fire.auth().signOut()}> - Logout - </button></Link> + <Link to='/signin'> + <button + className='logoutbutton' + onClick={() => fire.auth().signOut()} + > + Logout + </button> + </Link> )} </nav> </section> <Switch> {/*Folders*/} - <Route path='/folder/:folderId' component={Hero} /> + <Route path='/folder/:folderId' exact component={Hero} /> <Route path='/' exact component={Signin} /> <Route path='/signin' exact component={Signin} /> - <Route path='/copyright' exact component={copyright} /> + <Route path='/copyright' component={copyright} /> + <Route path='/folder/copyright' component={copyright} /> <Route path='/forgot-password' component={ForgotPassword} /> </Switch> - <Navbar fixed='bottom' variant='light' bg='light'> + <Navbar fixed='bottom' variant='light' bg='light'> <Container className='ml-sm-2'> - <Nav.Link eventKey={2} href='copyright'> - © Digital Course File Group 2 - </Nav.Link> + <LinkContainer to='/copyright'> + <Nav.Link>© Digital Course File Group 2</Nav.Link> + </LinkContainer> </Container> </Navbar> </BrowserRouter> diff --git a/digital-course-file/src/user/FolderNav.js b/digital-course-file/src/user/FolderNav.js index fbfe064a5b58a4ceb95fd8c37130667fe06e5ab9..38fbdb58b757216e9166e67ef725dc9ba85b6aa4 100644 --- a/digital-course-file/src/user/FolderNav.js +++ b/digital-course-file/src/user/FolderNav.js @@ -1,45 +1,42 @@ -import { react } from "react"; -import { Breadcrumb } from "react-bootstrap"; -import { Link } from "react-router-dom"; -import { ROOT_FOLDER } from "../hooks/useFolder"; +import { react } from 'react' +import { Breadcrumb } from 'react-bootstrap' +import { Link } from 'react-router-dom' +import { ROOT_FOLDER } from '../hooks/useFolder' -export default function FolderNav( {currentFolder} ) { +export default function FolderNav({ currentFolder }) { + let path = currentFolder === ROOT_FOLDER ? [] : [ROOT_FOLDER] - let path = currentFolder === ROOT_FOLDER ? [] : [ROOT_FOLDER] - if (currentFolder){ - path = [...path,...currentFolder.path]; - } + if (currentFolder) { + path = [...path, ...currentFolder.path] + } - return( - <Breadcrumb - className="flex-grow-1" - listProps = {{ className : "bg-white pl-0 m-0"}} + return ( + <Breadcrumb + className='flex-grow-1' + listProps={{ className: 'bg-white pl-0 m-0' }} + > + {path.map((folder, index) => ( + <Breadcrumb.Item + key={folder.id} + linkAs={Link} + linkProps={{ + to: folder.id ? `/folder/${folder.id}` : '/', + }} + className='text-truncate d-inline-block' + style={{ maxWidth: '175px' }} > - {path.map((folder,index) => ( - <Breadcrumb.Item - key={folder.id} - linkAs ={Link} - linkProps = {{ - to : folder.id ? `/folder/${folder.id}` : "/", - }} - className="text-truncate d-inline-block" - style = { {maxWidth : "175px"} } - > - {folder.name} - </Breadcrumb.Item> - ))} - { currentFolder && ( - <Breadcrumb.Item - className="text-truncate d-inline-block" - style = { {maxWidth : "200px"} } - active - > - {currentFolder.name} - </Breadcrumb.Item> - ) - - } - </Breadcrumb> - ); - + {folder.name} + </Breadcrumb.Item> + ))} + {currentFolder && ( + <Breadcrumb.Item + className='text-truncate d-inline-block' + style={{ maxWidth: '200px' }} + active + > + {currentFolder.name} + </Breadcrumb.Item> + )} + </Breadcrumb> + ) } \ No newline at end of file diff --git a/digital-course-file/src/user/Hero.js b/digital-course-file/src/user/Hero.js index 8beb26b2cf5c07a705d08eda3627fe08a0c44bf8..3db53a3a21c5cac4981f8cef694cd3087aef2dec 100644 --- a/digital-course-file/src/user/Hero.js +++ b/digital-course-file/src/user/Hero.js @@ -37,7 +37,8 @@ const Hero = ({ handleLogout }) => { ) } - return ( + if(folder.id!=="copyright"){ + return ( <> <Container fluid> <div className='d-flex align-items-center'> @@ -94,6 +95,12 @@ const Hero = ({ handleLogout }) => { </Navbar> </> ) + + }else{ + return null + } + + } class ContextMenu extends React.Component { state = {