Skip to content

Commit 45da2c9

Browse files
committed
removed redundant useless code
1 parent 429e9c7 commit 45da2c9

17 files changed

+166
-596
lines changed

src/assets/svgs/Closed.svg

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

src/assets/svgs/OnHold.svg

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

src/assets/svgs/Open.svg

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

src/assets/svgs/Pending.svg

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

src/assets/svgs/Solved.svg

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

src/assets/svgs/Ticket.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React from "react";
2+
import Badge from "react-bootstrap/Badge";
3+
4+
const BadgeElement = (props) => {
5+
let badgeVariant = null;
6+
switch (props.ticketState) {
7+
case "Open":
8+
badgeVariant = "primary";
9+
break;
10+
case "Solved":
11+
badgeVariant = "success";
12+
break;
13+
case "OnHold":
14+
badgeVariant = "secondary";
15+
break;
16+
case "Pending":
17+
badgeVariant = "warning";
18+
break;
19+
case "Closed":
20+
badgeVariant = "danger";
21+
break;
22+
default:
23+
badgeVariant = "Open";
24+
}
25+
return (
26+
<div>
27+
<Badge pill variant={badgeVariant}>
28+
{props.ticketState}
29+
</Badge>
30+
</div>
31+
);
32+
};
33+
34+
export default BadgeElement;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
const customStyles = {
2+
table: {
3+
style: {
4+
width: "87vw",
5+
height: "60vh",
6+
},
7+
},
8+
header: {
9+
style: {
10+
display: "none",
11+
fontFamily: "Inter",
12+
fontWeight: "bold",
13+
fontSize: "1.5rem",
14+
paddingLeft: "20px",
15+
color: "#2D2D2D", // override the row height
16+
},
17+
},
18+
rows: {
19+
style: {
20+
minHeight: "72px", // override the row height
21+
fontFamily: "Inter",
22+
fontStyle: "normal",
23+
fontWeight: "normal",
24+
},
25+
highlightOnHoverStyle: {
26+
backgroundColor: "#F5F5F5",
27+
},
28+
},
29+
headCells: {
30+
style: {
31+
marginLeft: "10px",
32+
fontFamily: "Inter",
33+
fontSize: "16px",
34+
fontWeight: "700",
35+
paddingLeft: "8px", // override the cell padding for head cells
36+
paddingRight: "8px",
37+
},
38+
},
39+
cells: {
40+
style: {
41+
paddingLeft: "8px", // override the cell padding for data cells
42+
paddingRight: "8px",
43+
margin: "10px",
44+
},
45+
},
46+
};
47+
48+
export default customStyles;

src/user/Admin/Tickets/TicketContent.js renamed to src/user/Admin/Tickets/TicketContent/TicketContent.js

Lines changed: 14 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,12 @@
11
import React, { Component } from "react";
22
import DataTable from "react-data-table-component";
3-
import data from "../../../assets/jsonData/tickets";
3+
import data from "../../../../assets/jsonData/tickets";
44
import "./TicketContent.scss";
5-
import userIcon2 from "../../../assets/images/userIcon2.jpg";
6-
import { Image, Badge } from "react-bootstrap";
5+
import userIcon2 from "../../../../assets/images/userIcon2.jpg";
6+
import { Image } from "react-bootstrap";
77
import { withRouter } from "react-router-dom";
8-
9-
const BadgeElement = (props) => {
10-
return (
11-
<div>
12-
{props.ticketState === "Open" && (
13-
<Badge pill variant="primary">
14-
{props.ticketState}
15-
</Badge>
16-
)}
17-
{props.ticketState === "Solved" && (
18-
<Badge pill variant="success">
19-
{props.ticketState}
20-
</Badge>
21-
)}
22-
{props.ticketState === "OnHold" && (
23-
<Badge pill variant="secondary">
24-
{props.ticketState}
25-
</Badge>
26-
)}
27-
{props.ticketState === "Pending" && (
28-
<Badge pill variant="warning">
29-
{props.ticketState}
30-
</Badge>
31-
)}
32-
{props.ticketState === "Closed" && (
33-
<Badge pill variant="danger">
34-
{props.ticketState}
35-
</Badge>
36-
)}
37-
38-
{/* <Badge pill variant="primary" style={{ fontSize: "12px" }}>
39-
{props.ticketState}
40-
</Badge> */}
41-
</div>
42-
);
43-
};
44-
45-
const customStyles = {
46-
table: {
47-
style: {
48-
width: "87vw",
49-
height: "60vh",
50-
},
51-
},
52-
header: {
53-
style: {
54-
display: "none",
55-
fontFamily: "Inter",
56-
fontWeight: "bold",
57-
fontSize: "1.5rem",
58-
paddingLeft: "20px",
59-
color: "#2D2D2D", // override the row height
60-
},
61-
},
62-
rows: {
63-
style: {
64-
minHeight: "72px", // override the row height
65-
fontFamily: "Inter",
66-
fontStyle: "normal",
67-
fontWeight: "normal",
68-
},
69-
highlightOnHoverStyle: {
70-
backgroundColor: "#F5F5F5",
71-
},
72-
},
73-
headCells: {
74-
style: {
75-
marginLeft: "10px",
76-
fontFamily: "Inter",
77-
fontSize: "16px",
78-
fontWeight: "700",
79-
paddingLeft: "8px", // override the cell padding for head cells
80-
paddingRight: "8px",
81-
},
82-
},
83-
cells: {
84-
style: {
85-
paddingLeft: "8px", // override the cell padding for data cells
86-
paddingRight: "8px",
87-
margin: "10px",
88-
},
89-
},
90-
};
8+
import BadgeElement from './BadgeElement';
9+
import customStyles from './DataTableCustomStyles';
9110

9211
class TicketContent extends Component {
9312
constructor(props) {
@@ -139,21 +58,21 @@ class TicketContent extends Component {
13958

14059
const columns = [
14160
{
142-
name: "Ticket Title",
61+
name: "Title",
14362
selector: "titler",
14463
sortable: true,
14564
maxWidth: "600px", // when using custom you should use width or maxWidth, otherwise, the table will default to flex grow behavior
14665
cell: (row) => <CustomTitle row={row} />,
14766
},
14867
{
149-
name: "Ticket Description",
68+
name: "Description",
15069
selector: "plot",
15170
wrap: true,
15271
sortable: true,
15372
format: (row) => `${row.plot.slice(0, 100)}...`,
15473
},
15574
{
156-
name: "Ticket Status",
75+
name: "Status",
15776
// eslint-disable-next-line react/no-array-index-key
15877
cell: (row) => (
15978
<div>
@@ -165,7 +84,6 @@ class TicketContent extends Component {
16584
},
16685
{
16786
name: "User",
168-
16987
cell: (row) => (
17088
<div>
17189
<Image
@@ -179,6 +97,12 @@ class TicketContent extends Component {
17997
</div>
18098
),
18199
},
100+
{
101+
name: "Created At"
102+
},
103+
{
104+
name: "Comments"
105+
}
182106
];
183107

184108
return (

0 commit comments

Comments
 (0)