Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Copyright 2020 David Baruch Klein a.k.a Polarts

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
# haifa-dev-admin-panel
An admin panel to manage data for the Haifa:Dev website
# Haifa-dev-admin-panel

An admin panel to manage data for the Haifa:Dev website.

## Prerequisites

- You need haifa-dev-backend project

## Getting started

- Open the terminal at the project directory and run the command:

```sh
npm install (shortened: npm i )
npm start
```
14,267 changes: 14,267 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

44 changes: 44 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "haifa-dev-admin-panel",
"version": "0.1.0",
"private": true,
"dependencies": {
"@fullcalendar/core": "^4.4.0",
"@fullcalendar/daygrid": "^4.4.2",
"@fullcalendar/react": "^4.4.2",
"@material-ui/core": "^4.10.2",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.19.2",
"bootstrap": "^4.5.0",
"faker": "^4.1.0",
"fontawesome-4.7": "^4.7.0",
"react": "^16.13.1",
"react-bootstrap": "^1.0.1",
"react-dom": "^16.13.1",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file added public/favicon.ico
Binary file not shown.
43 changes: 43 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Binary file added public/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
3 changes: 3 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
120 changes: 120 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import React, { Component } from 'react';
import { Route, Switch, BrowserRouter } from "react-router-dom";

// var Navbar = ReactBootstrap.Navbar;
// import { Navbar } from 'react-bootstrap';
// import Navbar from 'react-bootstrap/Navbar';
import Navbar from 'react-bootstrap/Navbar';
import Nav from 'react-bootstrap/Nav';
// import NavDropdown from 'react-bootstrap/NavDropdown';

import Home from "./pages/Home/Home";
import Profile from "./pages/Profile/View";
import ProfileCreate from "./pages/Profile/Create";
// import ProfileEdit from "./pages/Profile/Edit";
import Event from "./pages/Event/Event";
import Project from "./pages/Project/Project";
import Request from "./pages/Request/Request";
// import { render } from "@testing-library/react";

const navItems = [
{ displayName: "Home", href: "/Home", className: "fa fa-home" },
{ displayName: "Profile", href: "/Profile", className: "fa fa-user" },
{ displayName: "Events", href: "/Event", className: "fa fa-calendar" },
{ displayName: "Projects", href: "/Project", className: "fa fa-diamond" },
{ displayName: "Requests", href: "/Request", className: "fa fa-paper-plane-o" }
Comment on lines +21 to +25
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't you make a model class for this? It will be much easier

];


const MyNav = (props) => {
const navItems = props.navItems;
Comment on lines +29 to +30
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If you only use 1 property of props, use deconstruction instead.
MyNav = ({navItems}) => ...
It will automatically extract it, no need to declare a variable.

const listItems = navItems.map((navItem) =>
<a className="list-group-item list-group-item-action bg-black" href={navItem.href} key={navItem.displayName}>
<i className={navItem.className} aria-hidden="true"></i>
{navItem.displayName}
</a>
);
return (
<div className="list-group list-group-flush">
{listItems}
</div>

);
}
Comment on lines +20 to +43
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could be a good idea to move it to a separated file




class App extends Component {

constructor(props) {
super(props);
this.state = { isToggleOn: true };
// This binding is necessary to make `this` work in the callback
this.handleClick = this.handleClick.bind(this);
}

handleClick() {
this.setState(prevState => ({
isToggleOn: !prevState.isToggleOn
}));
}
render() {
return (<BrowserRouter>
<div id="wrapper" className={this.state.isToggleOn ? 'd-flex toggled' : 'd-flex'}>
{/* <!-- Sidebar --> */}
<div className="" id="sidebar-wrapper">
<div className="sidebar-heading ">
<div className="logo small">
<span>:dev</span>
{/* <span className='d-block' style={{ fontSize: '0.8rem' }}>community</span> */}
</div>
{/* <div className="logo big">
haifa<span>:dev</span>
<span className='d-block' style={{ fontSize: '0.8rem' }}>developers community</span>
</div> */}
</div>
<MyNav navItems={navItems} />
</div >
{/* <!-- /#sidebar-wrapper --> */}
{/* <!-- Page Content --> */}
<div id="page-content-wrapper">

<Navbar collapseOnSelect expand="lg" bg="" variant="dark" className="border-bottom">
<button className="navbar-toggler navbar-toggler-dark btn-circle m-1" id="menu-toggle" onClick={this.handleClick}>
{/* <i className="fa fa-bars" aria-hidden="true"></i>
<span className="sr-only">Toggle Menu</span> */}
<span className="navbar-toggler-icon"></span>
</button>
<Navbar.Brand href="#home">React-Bootstrap</Navbar.Brand>
<Navbar.Toggle aria-controls="responsive-navbar-nav" className=" btn-circle m-1" />
<Navbar.Collapse id="responsive-navbar-nav">
<Nav className="ml-auto">
<Nav.Link href="#User">User</Nav.Link>
</Nav>
</Navbar.Collapse>
</Navbar>

<div className="container-fluid">

<Switch>
<Route exact path="/" component={Home} />
<Route exact path="/Home" component={Home} />
<Route exact path="/Profile" component={Profile} />
<Route exact path="/Profile/Create" component={ProfileCreate} />
{/* <Route exact path="/Profile/Edit" component={ProfileEdit} /> */}
<Route exact path="/Event" component={Event} />
<Route exact path="/Project" component={Project} />
<Route exact path="/Request" component={Request} />
</Switch>
{/* <script src="lib/bootstrap/dist/js/bootstrap.bundle.js"></script> */}
</div>
</div>
{/* <!-- /#page-content-wrapper --> */}
</div>

</BrowserRouter >
)
}
};

export default App;
8 changes: 8 additions & 0 deletions src/api/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import axios from 'axios';

export const baseURL = 'http://localhost:5000';
export const serverURL = `${baseURL}/api/v1`;

export default axios.create({
baseURL: serverURL
});
8 changes: 8 additions & 0 deletions src/components/Image.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react';
import { baseURL } from '../api/server';

export const Image = ({ image }) => (
<div style={{ margin: '.0rem' }}>
<img style={{ width: '1rem' }} src={`${baseURL}/${image}`} alt="developer profile" />
</div>
);
21 changes: 21 additions & 0 deletions src/components/Socials.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import PropTypes from 'prop-types';

const Socials = ({ socials }) =>
socials && socials.map(social => (
<a style={{ marginRight: '1em', padding: '.50em 0.50em' }}
key={social.id}
href={'/users/' + social.id}
target="_blank"
rel="noopener noreferrer" className="badge badge-warning">

{social.name}
{/* <span className="float-right"><i className="fa fa-circle" aria-hidden="true"></i> online</span> */}
</a>
));

Socials.propTypes = {
socials: PropTypes.array.isRequired
};

export default Socials;
Loading