Skip to content

Commit 4f6d3af

Browse files
Merge pull request #1 from MohamedRizwan399/feature/TRAPWLS-19_LoginAuth
#TRAPWLS-19 Login and Crud code optimized
2 parents 7105369 + 760e579 commit 4f6d3af

39 files changed

+822
-480
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "my-app",
3-
"version": "0.1.0",
2+
"name": "javascript-crud-with-sampletasks",
3+
"version": "1.0",
44
"private": true,
55
"dependencies": {
66
"@reduxjs/toolkit": "^1.9.7",
@@ -18,6 +18,8 @@
1818
"react-redux": "^8.1.3",
1919
"react-router-dom": "^6.4.1",
2020
"react-scripts": "5.0.1",
21+
"react-spinners": "^0.14.1",
22+
"react-toastify": "^10.0.6",
2123
"react-uuid": "^1.0.3",
2224
"redux": "^4.2.0",
2325
"styled-components": "^5.3.5",

src/App.css

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ nav ul li a:not(.active):hover{
161161
}
162162

163163
.home-card{
164+
height: 100%;
164165
width: 30%;
165166
padding: 10px;
166167
padding-bottom: 80px;
@@ -193,6 +194,22 @@ nav ul li a:not(.active):hover{
193194
cursor: pointer;
194195
}
195196

197+
/* Styling for dashboard */
198+
.title-dashboard{
199+
margin-left: 10px;
200+
margin-top: 25px;
201+
font-weight: bold;
202+
font-size: 20px;
203+
color: teal;
204+
text-decoration: underline;
205+
}
206+
207+
.issue-btn{
208+
margin-left: 10px;
209+
margin-top: 20px;
210+
display: block;
211+
}
212+
196213
/* Styling for IssueCreation page(CRUD) */
197214
.form-container{
198215
margin-left: 10px;
@@ -219,6 +236,7 @@ nav ul li a:not(.active):hover{
219236
}
220237

221238
/* Styling for Tablecreation */
239+
222240
.table-responsive {
223241
margin-top: 20px;
224242
}
@@ -243,9 +261,11 @@ nav ul li a:not(.active):hover{
243261
}
244262

245263
.delete-btn{
264+
margin-left: 20px;
246265
color: red;
247266
}
248267
.edit-btn{
268+
margin-right: 20px;
249269
color: teal;
250270
}
251271

@@ -339,4 +359,17 @@ nav ul li a:not(.active):hover{
339359
.contactus{
340360
margin-top: 20px;
341361
text-align: center;
362+
}
363+
364+
/* Styling for loader*/
365+
.loader {
366+
top: 0;
367+
left: 0;
368+
position: fixed;
369+
width: 100%;
370+
height: 100%;
371+
display: flex;
372+
justify-content: center;
373+
align-items: center;
374+
z-index: 1;
342375
}

src/App.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import './App.css';
22
import { Routes, Route, BrowserRouter, Navigate} from 'react-router-dom';
33
import { useState } from 'react';
4-
import Aboutus from './HomePage/Aboutus';
5-
import Contactus from './HomePage/Contactus';
6-
import LoginPage from './LoginAuthentication/LoginPage';
4+
import Aboutus from './homePage/Aboutus';
5+
import Contactus from './homePage/Contactus';
6+
import LoginPage from './loginAuthentication/LoginPage';
77
import Dashboard from './IssueManagement/Dashboardview/Dashboard';
88
import IssueCreationPage from './IssueManagement/IssueCrud/IssueCreationPage';
9-
import PagenotFound from './HomePage/PagenotFound';
10-
import HeaderNavbarLogin from './HomePage/HeaderNavbarLogin';
11-
import Home from './HomePage/Home';
12-
import Footer from './HomePage/Footer';
13-
import FetchApi from './FetchApiData/FetchApi';
14-
import Demo from './HomePage/Demo';
9+
import PagenotFound from './homePage/PagenotFound';
10+
import HeaderNavbarLogin from './homePage/HeaderNavbarLogin';
11+
import Home from './homePage/Home';
12+
import Footer from './homePage/Footer';
13+
import FetchApi from './fetchApiData/FetchApi';
14+
import Demo from './homePage/Demo';
15+
import { ToastContainer } from 'react-toastify';
16+
import 'react-toastify/dist/ReactToastify.css';
1517

1618
export function App() {
1719
const loginData = JSON.parse(localStorage.getItem("loggedInData") || "{}");
@@ -20,6 +22,7 @@ export function App() {
2022
return(
2123
<BrowserRouter>
2224
<div>
25+
<ToastContainer/>
2326
{isLoggedinUser &&
2427
<HeaderNavbarLogin
2528
isLoggedinUser={loginData}
@@ -29,7 +32,7 @@ export function App() {
2932
<Routes>
3033
{isLoggedinUser === true ? (
3134
<>
32-
<Route path="/" element={<LoginPage/>}/>
35+
<Route path="/" element={<Home/>}/>
3336
<Route path="/home" element={<Home/>}/>
3437
<Route path="/dashboard" element={<Dashboard/>}/>
3538
<Route path="/issuecreate" element={<IssueCreationPage/>}/>

src/FetchApiData/FetchApi.jsx

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/HomePage/Card.jsx

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/HomePage/Home.jsx

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/IssueManagement/Dashboardview/Dashboard.jsx

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,65 @@
1-
import React from "react";
1+
import React, { useEffect, useState } from "react";
22
import { useNavigate } from "react-router-dom";
3+
import { TableView } from "../IssueCrud/TableView";
34

45

56
function Dashboard() {
67
//for navigate
78
let navigateToIssueCreationPage = useNavigate();
9+
const [getIssues, setCreatedIssues] = useState([]);
810

911
function createIssue() {
1012
navigateToIssueCreationPage('/issuecreate')
1113
}
1214

15+
useEffect(() => {
16+
let getCreatedIssues = JSON.parse(localStorage.getItem("issueData"));
17+
setCreatedIssues(getCreatedIssues);
18+
}, [])
19+
20+
//deletedata
21+
const deleteIssue=(id) => {
22+
let alert = window.confirm(`Are you sure to delete this '${id}' issue?`)
23+
console.log("From delete",id)
24+
if (alert) {
25+
const filteredIssues = getIssues.filter((element, index)=> {
26+
return element.id !== id;
27+
})
28+
setCreatedIssues(filteredIssues);
29+
localStorage.setItem('issueData', JSON.stringify(filteredIssues));
30+
}
31+
}
1332

1433
return(
1534

1635
<div className="issues-table">
17-
<table id="issueList" >
18-
<thead>
19-
<tr><th>DASHBOARD LIST</th></tr>
20-
<tr>
21-
<th scope="col">Issue Name</th> &emsp; &emsp; &emsp; &emsp; &emsp;
22-
<th scope="col">Assignee&emsp;&emsp;</th> &emsp; &emsp; &emsp; &emsp; &emsp;
23-
<th scope="col">Created On&emsp;&emsp;</th> &emsp; &emsp; &emsp; &emsp; &emsp;
24-
<th scope="col">Status&emsp;&emsp;</th> &emsp; &emsp; &emsp; &emsp; &emsp;
25-
<th scope="col">Actions</th>&emsp;&emsp; &emsp; &emsp; &emsp;
26-
</tr>
27-
</thead>
28-
<tbody id="tablebody">
29-
</tbody>
30-
</table>
31-
<button className="issue-btn" onClick={createIssue}>+ CREATE ISSUE</button>
36+
<>
37+
{getIssues?.length > 0 && <div className="title-dashboard">Created Issues List here:</div>}
38+
39+
{getIssues?.length > 0 &&
40+
<div className="table-responsive">
41+
<table>
42+
<thead>
43+
<tr>
44+
<th scope="col">ISSUE ID</th>
45+
<th scope="col">TASK NAME</th>
46+
<th scope="col">DUE ON</th>
47+
<th scope="col">PRIORITY</th>
48+
<th scope="col">ASSIGNEE</th>
49+
<th scope="col">STATUS</th>
50+
<th scope="col">DELETE</th>
51+
</tr>
52+
</thead>
53+
<tbody id="tablebody">
54+
<TableView issues={getIssues} deleteIssue={deleteIssue}/>
55+
</tbody>
56+
</table>
57+
</div>
58+
}
59+
60+
{getIssues?.length < 1 && <div className="no-issues">No Issues are Created yet</div>}
61+
<button className="issue-btn" onClick={createIssue}>+ CREATE NEW ISSUE</button>
62+
</>
3263
</div>
3364

3465
)

0 commit comments

Comments
 (0)