diff --git a/README.md b/README.md index 2ac4cd8..74ce83e 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ - [ ] logging - [ ] check useRef, useReducer, dispatch - [ ] error page redirect when offline. -- [ ] ticket/files/activities list placeholders when empty +- [x] ticket/files/activities list placeholders when empty - [ ] think about public/private DTO's constructor, getters and setters - [x] write dtos without circular dependencies - [ ] use dtoRequest for PutProjects diff --git a/client/src/components/ActivityCollection.tsx b/client/src/components/ActivityCollection.tsx index b37d8ac..f85ad8d 100644 --- a/client/src/components/ActivityCollection.tsx +++ b/client/src/components/ActivityCollection.tsx @@ -1,5 +1,6 @@ import React, { FC } from "react"; import { Activity } from "../types/Activity"; +import { act } from "react-dom/test-utils"; type IProps = { activities: Activity[]; @@ -12,38 +13,58 @@ export const ActivityCollection: FC = ({ activities, filterText }) => { ) : ( <> ); }; type IFProps = { - activity: Activity; + activity?: Activity; }; export const ActivityEntry: FC = ({ activity }) => { return ( <> - - {/* folder */} - - {activity.user.firstName} {activity.description} {activity.ticket.title} - -

{activity.date.toDateString()}

+
  • + {/* */} + folder + + {activity ? activity.user.firstName : "Ruidy"} + {activity ? activity.description : " welcomes you "} + {activity ? activity.ticket.title : "here"} + +

    + {activity ? activity.date.toDateString() : new Date().toDateString()} +

    +
  • ); }; diff --git a/client/src/components/FileCollection.tsx b/client/src/components/FileCollection.tsx index 114ae98..c709da9 100644 --- a/client/src/components/FileCollection.tsx +++ b/client/src/components/FileCollection.tsx @@ -7,35 +7,38 @@ type IProps = { }; export const FileCollection: FC = ({ files, filterText }) => { + console.log(); return ( <>
      - {files - .filter( - f => - f.name.toLowerCase().includes(filterText.toLowerCase()) || - f.format.toLowerCase().includes(filterText.toLowerCase()) - ) - .map((file: AppFile) => ( - - ))} + {files.length === 0 ? ( + + ) : ( + files + .filter( + f => + f.name.toLowerCase().includes(filterText.toLowerCase()) || + f.format.toLowerCase().includes(filterText.toLowerCase()) + ) + .map((file: AppFile) => ) + )}
    ); }; type IFProps = { - file: AppFile; + file?: AppFile; }; export const FileEntry: FC = ({ file }) => { return (
  • {/* */} - folder - {file.name} + folder + {file ? file.name : "Add your first file"}

    - {file.size}kb {file.format} + {file ? file.size : 0}kb {file ? file.format : "pdf"}

    more_vert diff --git a/client/src/components/HorizontalCard.tsx b/client/src/components/HorizontalCard.tsx index aea8283..815804c 100644 --- a/client/src/components/HorizontalCard.tsx +++ b/client/src/components/HorizontalCard.tsx @@ -3,9 +3,9 @@ import { Link } from "react-router-dom"; import { getRemainingdays } from "../utils/methods"; interface IProps { - title: string; - remainingDays: string; - validateTicket: (event: MouseEvent) => void; + title?: string; + remainingDays?: string; + validateTicket?: (event: MouseEvent) => void; // archiveTicket: (event: MouseEvent) => void; } @@ -16,33 +16,45 @@ export const HorizontalCard: FC = ({ validateTicket }) => { return ( -
    -
    -
    -
    -
    -
    +
  • +
    +
    +
    +
    +
    +
    + + {title ?? "Nothing to do"} + +
    +
    + + Due{" "} + {remainingDays ? ( + getRemainingdays(remainingDays) + ) : ( + + Too much 0 + + )}{" "} + days + +
    - {title} + + check + -
  • -
    - Due {getRemainingdays(remainingDays)} days -
    - - - check - - - {/* + {/* archive */} +
    - +
  • ); }; diff --git a/client/src/components/InputFile.tsx b/client/src/components/InputFile.tsx index aa528e9..1f8c63f 100644 --- a/client/src/components/InputFile.tsx +++ b/client/src/components/InputFile.tsx @@ -7,7 +7,7 @@ export const InputFile: FC = () => { <>
    -
    +
    cloud_upload = ({ remainingDays }) => { const styleString: CSSProperties = { width: `${value}%` }; + const barColor: string = value < 75 ? "red" : ""; return ( <>
    -
    +
    playlist_add_check diff --git a/client/src/components/TabRouterHeader.tsx b/client/src/components/TabRouterHeader.tsx index 5a95261..9a9f389 100644 --- a/client/src/components/TabRouterHeader.tsx +++ b/client/src/components/TabRouterHeader.tsx @@ -14,7 +14,7 @@ export const TabRouterHeader: FC = ({ const nTabs = tabNames.length; return ( <> -
      +
        {tabNames.map((name, i) => ( = ({ /> ))}
      • = ({ setIsActive(parseInt(value))} > {text} diff --git a/client/src/components/TicketList.tsx b/client/src/components/TicketList.tsx index f75392b..4b551e7 100644 --- a/client/src/components/TicketList.tsx +++ b/client/src/components/TicketList.tsx @@ -30,7 +30,11 @@ export const TicketList: FC = ({ tickets }) => { }; const [showNew, setShowNew] = useState(false); - + let filteredTickets = tickets.filter( + t => + t.status !== "Done" && + t.title.toLowerCase().includes(filterText.toLowerCase()) + ); return ( <>
        @@ -42,7 +46,7 @@ export const TicketList: FC = ({ tickets }) => { />

        Tickets

        @@ -54,28 +58,25 @@ export const TicketList: FC = ({ tickets }) => {
          - {tickets - .filter( - t => - t.status !== "Done" && - t.title.toLowerCase().includes(filterText.toLowerCase()) - ) - .map((t: Ticket) => ( -
        • - { - e.preventDefault(); - await put>( - `${Constants.ticketsURI}/${t.id}/closed`, - {} - ); - }} - // archiveTicket={archiveTicket} - /> -
        • - ))} + {filteredTickets.length === 0 ? ( + + ) : ( + filteredTickets.map((t: Ticket) => ( + { + e.preventDefault(); + await put>( + `${Constants.ticketsURI}/${t.id}/closed`, + {} + ); + }} + // archiveTicket={archiveTicket} + /> + )) + )}
        diff --git a/client/src/pages/ProjectPage.tsx b/client/src/pages/ProjectPage.tsx index f7680d8..c0700c0 100644 --- a/client/src/pages/ProjectPage.tsx +++ b/client/src/pages/ProjectPage.tsx @@ -37,7 +37,7 @@ export const ProjectPage: FC = ({ viewModel }) => { setShowModal(true)} /> diff --git a/client/src/utils/router.tsx b/client/src/utils/router.tsx index 2d37f3e..c99ab2b 100644 --- a/client/src/utils/router.tsx +++ b/client/src/utils/router.tsx @@ -20,7 +20,7 @@ export const history = creacteHistory.createBrowserHistory(); export const AppRouter = () => { return ( -
        +