mirror of
https://github.com/rjNemo/ticket_manager
synced 2026-06-12 11:46:40 +00:00
[UI] updated TicketList
This commit is contained in:
parent
9e7a1290c0
commit
3f0b78f085
2 changed files with 33 additions and 11 deletions
|
|
@ -53,3 +53,4 @@
|
||||||
- [x] Form validators
|
- [x] Form validators
|
||||||
- [x] Azure
|
- [x] Azure
|
||||||
- [ ] Refactor TabPanels code
|
- [ ] Refactor TabPanels code
|
||||||
|
- [ ] Refactor Lists code
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,28 @@
|
||||||
import React, { FC, useState, ChangeEvent, MouseEvent } from "react";
|
import React, { FC, useState, ChangeEvent, MouseEvent } from "react";
|
||||||
import { Ticket } from "../types/Ticket";
|
import {
|
||||||
|
Grid,
|
||||||
|
Typography,
|
||||||
|
makeStyles,
|
||||||
|
Theme,
|
||||||
|
createStyles,
|
||||||
|
} from "@material-ui/core";
|
||||||
import { FloatingButton } from "./FloatingButton";
|
import { FloatingButton } from "./FloatingButton";
|
||||||
import { HorizontalCard } from "./HorizontalCard";
|
import { HorizontalCard } from "./HorizontalCard";
|
||||||
import { FilterBar } from "./FilterBar";
|
import { FilterBar } from "./FilterBar";
|
||||||
import { HttpResponse } from "../types/HttpResponse";
|
import { HttpResponse } from "../types/HttpResponse";
|
||||||
import { put } from "../utils/http";
|
import { Ticket } from "../types/Ticket";
|
||||||
import { Constants } from "../utils/Constants";
|
|
||||||
import { NewTicketModal } from "./NewTicketModal";
|
import { NewTicketModal } from "./NewTicketModal";
|
||||||
import { Project } from "../types/Project";
|
import { Project } from "../types/Project";
|
||||||
import { Grid, Typography } from "@material-ui/core";
|
import { put } from "../utils/http";
|
||||||
|
import { Constants } from "../utils/Constants";
|
||||||
|
|
||||||
|
const useStyles = makeStyles((theme: Theme) =>
|
||||||
|
createStyles({
|
||||||
|
header: {
|
||||||
|
paddingBottom: theme.spacing(2),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
type TicketListProps = {
|
type TicketListProps = {
|
||||||
tickets: Ticket[];
|
tickets: Ticket[];
|
||||||
|
|
@ -19,7 +33,7 @@ type TicketListProps = {
|
||||||
export const TicketList: FC<TicketListProps> = ({
|
export const TicketList: FC<TicketListProps> = ({
|
||||||
tickets,
|
tickets,
|
||||||
allProjects,
|
allProjects,
|
||||||
addButton = true
|
addButton = true,
|
||||||
}) => {
|
}) => {
|
||||||
const [filterText, setFilterText] = useState<string>("");
|
const [filterText, setFilterText] = useState<string>("");
|
||||||
const clearFilterText = (e: MouseEvent): void => {
|
const clearFilterText = (e: MouseEvent): void => {
|
||||||
|
|
@ -36,10 +50,13 @@ export const TicketList: FC<TicketListProps> = ({
|
||||||
|
|
||||||
const [showNew, setShowNew] = useState(false);
|
const [showNew, setShowNew] = useState(false);
|
||||||
let filteredTickets = tickets.filter(
|
let filteredTickets = tickets.filter(
|
||||||
t =>
|
(t) =>
|
||||||
t.status !== "Done" &&
|
t.status !== "Done" &&
|
||||||
t.title.toLowerCase().includes(filterText.toLowerCase())
|
t.title.toLowerCase().includes(filterText.toLowerCase())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const classes = useStyles();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<NewTicketModal
|
<NewTicketModal
|
||||||
|
|
@ -51,17 +68,21 @@ export const TicketList: FC<TicketListProps> = ({
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Grid container>
|
<Grid container>
|
||||||
<Grid item xs>
|
<Grid
|
||||||
|
container
|
||||||
|
direction="row"
|
||||||
|
justify="space-between"
|
||||||
|
alignItems="center"
|
||||||
|
className={classes.header}
|
||||||
|
>
|
||||||
<Typography variant="h4" component="h4">
|
<Typography variant="h4" component="h4">
|
||||||
Tickets
|
Tickets
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
|
||||||
<Grid item xs>
|
|
||||||
{addButton && (
|
{addButton && (
|
||||||
<FloatingButton color="primary" size="small" onClick={onClick} />
|
<FloatingButton color="primary" size="small" onClick={onClick} />
|
||||||
)}
|
)}
|
||||||
</Grid>
|
|
||||||
<Grid item xs={4}>
|
|
||||||
<FilterBar
|
<FilterBar
|
||||||
filterText={filterText}
|
filterText={filterText}
|
||||||
handleChange={handleChange}
|
handleChange={handleChange}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue