Skip to content

Commit 5346447

Browse files
committed
Merge branch 'master' into verifySingleEmployee
2 parents 7fca935 + f13fec1 commit 5346447

File tree

11 files changed

+504
-66
lines changed

11 files changed

+504
-66
lines changed

package-lock.json

Lines changed: 128 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@
1111
"dependencies": {
1212
"@emotion/react": "^11.10.6",
1313
"@emotion/styled": "^11.10.6",
14+
"@fortawesome/fontawesome-svg-core": "^6.4.0",
15+
"@fortawesome/free-solid-svg-icons": "^6.4.0",
16+
"@fortawesome/react-fontawesome": "^0.2.0",
1417
"@mui/material": "^5.11.15",
1518
"@mui/x-data-grid": "^6.0.4",
1619
"@mui/x-date-pickers": "^6.0.4",
20+
"aos": "^2.3.4",
1721
"axios": "^1.3.5",
1822
"cheerio": "^1.0.0-rc.12",
1923
"firebase": "^9.19.1",

public/assets/emptyUser.png

2.22 KB
Loading

src/components/AppGrid.js

Lines changed: 58 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,55 @@
11
import * as React from "react";
22
import { DataGrid } from "@mui/x-data-grid";
3+
import PropTypes from "prop-types";
4+
import Button from "@mui/material/Button";
5+
6+
function RenderDate(props) {
7+
const { hasFocus, value } = props;
8+
const buttonElement = React.useRef(null);
9+
const rippleRef = React.useRef(null);
10+
const flagColor = props.value;
11+
12+
React.useLayoutEffect(() => {
13+
if (hasFocus) {
14+
const input = buttonElement.current?.querySelector("input");
15+
input?.focus();
16+
} else if (rippleRef.current) {
17+
// Only available in @mui/material v5.4.1 or later
18+
rippleRef.current.stop({});
19+
}
20+
}, [hasFocus]);
21+
22+
return (
23+
<>
24+
{flagColor === "green" && (
25+
<button
26+
className="focus:outline-none text-white w-[8rem] bg-green-700 hover:bg-green-800 focus:ring-4 focus:ring-green-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800"
27+
>
28+
Safe User
29+
</button>
30+
)}
31+
{flagColor === "red" && (
32+
<button
33+
className="focus:outline-none text-white w-[8rem] bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900"
34+
>
35+
Reported User
36+
</button>
37+
)}
38+
</>
39+
);
40+
}
41+
42+
RenderDate.propTypes = {
43+
/**
44+
* If true, the cell is the active element.
45+
*/
46+
hasFocus: PropTypes.bool.isRequired,
47+
/**
48+
* The cell value.
49+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
50+
*/
51+
value: PropTypes.instanceOf(Date),
52+
};
353

454
const columns = [
555
{ field: "id", headerName: "ID", width: 90 },
@@ -22,7 +72,7 @@ const columns = [
2272
},
2373
{ field: "Email", header: "Email", width: 250 },
2474
{ field: "Aadhar", header: "Aadhar" },
25-
{ field: "Flag", header: "Flags" },
75+
{ field: "Flag", header: "Flags", renderCell: RenderDate, width: 200 },
2676
];
2777

2878
const people = [
@@ -33,7 +83,8 @@ const people = [
3383
Gender: "Male",
3484
Email: "vansh@gmail.com",
3585
Aadhar: 3310,
36-
Flag: "flag",
86+
// Message will come with reports.message for red flag and for green, it will be from recommends.
87+
Flag: "red",
3788
},
3889
{
3990
id: 2,
@@ -42,7 +93,7 @@ const people = [
4293
Gender: "Male",
4394
Email: "vansh@gmail.com",
4495
Aadhar: 3310,
45-
Flag: "flag",
96+
Flag: "green",
4697
},
4798
{
4899
id: 3,
@@ -51,7 +102,7 @@ const people = [
51102
Gender: "Male",
52103
Email: "vansh@gmail.com",
53104
Aadhar: 3310,
54-
Flag: "flag",
105+
Flag: "red",
55106
},
56107
{
57108
id: 4,
@@ -60,7 +111,7 @@ const people = [
60111
Gender: "Male",
61112
Email: "vansh@gmail.com",
62113
Aadhar: 3310,
63-
Flag: "flag",
114+
Flag: "red",
64115
},
65116
{
66117
id: 5,
@@ -69,7 +120,7 @@ const people = [
69120
Gender: "Male",
70121
Email: "vansh@gmail.com",
71122
Aadhar: 3310,
72-
Flag: "flag",
123+
Flag: "green",
73124
},
74125
];
75126

@@ -79,20 +130,7 @@ export default function AppGrid() {
79130
style={{ width: "100%", backgroundColor: "white" }}
80131
className="h-[100vh]"
81132
>
82-
<DataGrid
83-
rows={people}
84-
columns={columns}
85-
// initialState={{
86-
// pagination: {
87-
// paginationModel: {
88-
// pageSize: 5,
89-
// },
90-
// },
91-
// }}
92-
// pageSizeOptions={[5]}
93-
checkboxSelection
94-
disableRowSelectionOnClick
95-
/>
133+
<DataGrid rows={people} columns={columns} disableRowSelectionOnClick className="bg-[#394150]" style={{color : 'white'}} />
96134
</div>
97135
);
98136
}

0 commit comments

Comments
 (0)