From 8134ce6792808facd1c076dc7f659f189c66adbb Mon Sep 17 00:00:00 2001
From: Andre Emiliano
Date: Sat, 26 Jun 2021 18:33:40 +0000
Subject: [PATCH] Changed application card layout
---
src/components/application.js | 13 ++++---------
src/components/applicationcard.js | 5 ++++-
src/components/applicationsForUsers.js | 16 ++++------------
src/components/home.js | 2 +-
src/components/homegrid.js | 3 +--
src/components/login.js | 3 +--
src/components/nav.js | 13 ++++++-------
src/components/newApplication.js | 6 +++---
8 files changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/components/application.js b/src/components/application.js
index 89bc774..5a5d66e 100644
--- a/src/components/application.js
+++ b/src/components/application.js
@@ -1,20 +1,13 @@
import React from 'react';
import { withRouter } from 'react-router';
-import { Image, Row, Col, Typography, Space, Button, Form, Input } from 'antd';
+import { Image, Row, Col, Typography, Space, Button, Form } from 'antd';
import { status, json } from '../utilities/requestHandlers';
-import { Component } from 'react';
import Select from 'react-select';
import UserContext from '../contexts/user';
-import {useContext} from 'react';
const { Title, Paragraph } = Typography;
-const formItemLayout = {
- labelCol: { xs: { span: 24 }, sm: { span: 6 } },
- wrapperCol: { xs: { span: 24 }, sm: { span: 12 } }
-};
-
class Application extends React.Component {
static contextType = UserContext;
@@ -53,6 +46,8 @@ class Application extends React.Component {
edit(values){ //Edit application
if (this.context.user.loggedIn){
const id = this.props.match.params.id;
+ const username=this.context.user.username
+ const password=this.context.user.password
console.log(values)
const {status}=values
values.userID=this.context.user.ID
@@ -61,7 +56,7 @@ class Application extends React.Component {
method: "PUT",
body: data,
headers:{
- "Authorization": "Basic " + btoa("andre" + ":" + "12345")
+ "Authorization": "Basic " + btoa(username + ":" + password)
}
})
.then(status)
diff --git a/src/components/applicationcard.js b/src/components/applicationcard.js
index a148406..84b41fa 100644
--- a/src/components/applicationcard.js
+++ b/src/components/applicationcard.js
@@ -1,5 +1,6 @@
import React from 'react';
import { Card } from 'antd';
+import NavImage from './navimage';
import {Link} from "react-router-dom";
const { Meta } = Card;
@@ -15,8 +16,10 @@ class ApplicationCard extends React.Component {
{`${companyName}`}
}
+ cover={}
hoverable={true}>
+
+
);
diff --git a/src/components/applicationsForUsers.js b/src/components/applicationsForUsers.js
index 2d9a6d7..57aa1ed 100644
--- a/src/components/applicationsForUsers.js
+++ b/src/components/applicationsForUsers.js
@@ -1,26 +1,15 @@
import React from 'react';
import { withRouter } from 'react-router';
-import { Image, Row, Col, Typography, Space, Button, Form, Input } from 'antd';
+import { Image, Row, Col, Typography } from 'antd';
import { status, json } from '../utilities/requestHandlers';
-import { Component } from 'react';
-import Select from 'react-select';
-import ReactDOM from "react-dom";
-
-import ApplicationCard from './applicationcard';
import UserContext from '../contexts/user';
-import {useContext} from 'react';
window.$name = ""
const { Title, Paragraph } = Typography;
-const formItemLayout = {
- labelCol: { xs: { span: 24 }, sm: { span: 6 } },
- wrapperCol: { xs: { span: 24 }, sm: { span: 12 } }
-};
-
class ApplicationForUsers extends React.Component {
static contextType = UserContext;
@@ -46,6 +35,8 @@ class ApplicationForUsers extends React.Component {
.then(json)
.then(application => {
window.$id = id;
+ const id_user = id;
+ module.exports ={id_user};
this.setState({application:application})
})
.catch(err => {
@@ -85,4 +76,5 @@ render() {
}
+
export default withRouter(ApplicationForUsers);
diff --git a/src/components/home.js b/src/components/home.js
index 299810d..fb86cf3 100644
--- a/src/components/home.js
+++ b/src/components/home.js
@@ -11,7 +11,7 @@ function Home(props) {
const [search, setSearch] = useState(undefined);
function searchHandler(value) {
- console.log("setting query")
+ console.log("setting query" + value)
setSearch(value)
}
diff --git a/src/components/homegrid.js b/src/components/homegrid.js
index 489503e..695b524 100644
--- a/src/components/homegrid.js
+++ b/src/components/homegrid.js
@@ -1,10 +1,9 @@
import React from 'react';
-import { Col, Row ,Result, Button } from 'antd';
+import { Col, Row } from 'antd';
import ApplicationCard from './applicationcard';
import { status, json } from '../utilities/requestHandlers';
import { withRouter } from 'react-router-dom';
import UserContext from '../contexts/user';
-import {useContext} from 'react';
class HomeGrid extends React.Component {
diff --git a/src/components/login.js b/src/components/login.js
index 80cc8e0..ef09add 100644
--- a/src/components/login.js
+++ b/src/components/login.js
@@ -51,10 +51,9 @@ class LoginForm extends React.Component {
console.log('Logged in successfully');
console.log(user);
user.password = password; // store in context for future API calls
- console.log(user.id);
this.context.login(user);
alert('Hello ' + username + '!')
- if (username === "andre"){
+ if (user.role === "admin"){
this.setState({redirect:'/'});
}
else{
diff --git a/src/components/nav.js b/src/components/nav.js
index dac7d1e..af9c950 100644
--- a/src/components/nav.js
+++ b/src/components/nav.js
@@ -1,13 +1,10 @@
import React from 'react';
-import {useContext} from 'react';
import { Menu } from 'antd';
import { Link } from "react-router-dom";
import UserContext from '../contexts/user';
import { withRouter } from 'react-router';
-import { status, json } from '../utilities/requestHandlers';
-
-import ApplicationForUsers from './applicationsForUsers'
+import ApplicationForUsers from './applicationsForUsers' //Not being used
class Nav extends React.Component {
@@ -15,14 +12,16 @@ class Nav extends React.Component {
//Change the new application section for admins only!!
render() {
- const id = window.$id;
- console.log(id) //Find value that corresponds to the userID of the application
+ const { id_user } = require('./applicationsForUsers.js')
+ //const id = window.$id;
+ //console.log(this.context.state.user) //Find value that corresponds to the userID of the application
+ console.log(this.context.user.id)
return (
<>