From b861a658925f9c2aff59c089f1ff307ac1551264 Mon Sep 17 00:00:00 2001 From: Ruidy Nemausat Date: Thu, 20 Feb 2020 10:43:07 +0100 Subject: [PATCH] project page ticket tab done --- client/src/components/HorizontalCard.tsx | 58 ++++++------- client/src/components/TabRouter.tsx | 22 +---- client/src/components/TabRouterHeader.tsx | 100 +++++++++++----------- client/src/components/TicketList.tsx | 53 ++++-------- client/src/pages/ProjectPage.tsx | 5 +- 5 files changed, 99 insertions(+), 139 deletions(-) diff --git a/client/src/components/HorizontalCard.tsx b/client/src/components/HorizontalCard.tsx index a0d20dd..791222f 100644 --- a/client/src/components/HorizontalCard.tsx +++ b/client/src/components/HorizontalCard.tsx @@ -1,54 +1,44 @@ import React, { FC, MouseEvent } from "react"; import { AvatarList } from "./AvatarList"; +import { Link } from "react-router-dom"; interface IProps { title: string; - tasksTotalCount?: number; - tasksDone?: number; remainingDays?: number; - avatars: string[]; validateTicket: (event: MouseEvent) => void; archiveTicket: (event: MouseEvent) => void; } export const HorizontalCard: FC = ({ title, - tasksDone, - tasksTotalCount, remainingDays, - avatars, archiveTicket, validateTicket }) => { return ( -
-
-
-
-
-
-
{title}
-
- Due {remainingDays} days - {/* */} -
- {/* playlist_add_check - - {" "} - {tasksDone}/{tasksTotalCount} - */} - - - - check - - - - - archive - - -
+
+
+
+
+
+
+ + {title} + +
+
+ Due {remainingDays} days +
diff --git a/client/src/components/TabRouter.tsx b/client/src/components/TabRouter.tsx index 7a5c217..4709463 100644 --- a/client/src/components/TabRouter.tsx +++ b/client/src/components/TabRouter.tsx @@ -6,36 +6,22 @@ import { Switch, Route, useRouteMatch, Redirect } from "react-router-dom"; interface IProps { tickets: Ticket[]; - tasksTotalCount?: number; - tasksDone?: number; remainingDays?: number; - avatars: string[]; + tabNames: string[]; } -export const TabRouter: FC = ({ - tickets, - tasksDone, - tasksTotalCount, - remainingDays, - avatars -}) => { +export const TabRouter: FC = ({ tickets, remainingDays, tabNames }) => { const { url } = useRouteMatch(); return ( <>
- + - + diff --git a/client/src/components/TabRouterHeader.tsx b/client/src/components/TabRouterHeader.tsx index b21eb11..ed4ce15 100644 --- a/client/src/components/TabRouterHeader.tsx +++ b/client/src/components/TabRouterHeader.tsx @@ -1,12 +1,51 @@ import React, { FC, useState } from "react"; import { Link, useRouteMatch } from "react-router-dom"; +interface IProps { + tabClass?: string; + nTabs: number; + tabNames: string[]; +} + +export const TabRouterHeader: FC = ({ + tabClass = "tab col s4", + nTabs, + tabNames +}) => { + const [isActive, setIsActive] = useState(0); + + return ( + <> +
    + {tabNames.map((name, i) => ( + + ))} +
  • +
+ + ); +}; + interface TabUnitProps { tabClass: string; isActive: number; setIsActive: React.Dispatch>; text: string; value: string; + nTabs: number; } const TabUnit: FC = ({ @@ -14,15 +53,23 @@ const TabUnit: FC = ({ isActive, setIsActive, text, - value + value, + nTabs }) => { const { url } = useRouteMatch(); return ( -
  • +
  • setIsActive(parseInt(value))} > {text} @@ -30,50 +77,3 @@ const TabUnit: FC = ({
  • ); }; - -interface IProps { - tabClass?: string; -} - -export const TabRouterHeader: FC = ({ - tabClass = "tab col s3", - - children -}) => { - const [isActive, setIsActive] = useState(1); - - // const switchTab = (e: React.MouseEvent): void => { - // e.preventDefault(); - // setIsActive(e.target.id); - // }; - - return ( - <> -
    -
      - - - -
    -
    - - ); -}; diff --git a/client/src/components/TicketList.tsx b/client/src/components/TicketList.tsx index b7835a0..df56bb0 100644 --- a/client/src/components/TicketList.tsx +++ b/client/src/components/TicketList.tsx @@ -5,48 +5,33 @@ import { HorizontalCard } from "./HorizontalCard"; type TicketListProps = { tickets: Ticket[]; - tasksTotalCount?: number; - tasksDone?: number; remainingDays?: number; - avatars: string[]; }; -export const TicketList: FC = ({ - tickets, - tasksDone, - tasksTotalCount, - remainingDays, - avatars -}) => { +export const TicketList: FC = ({ tickets, remainingDays }) => { const archiveTicket = () => {}; const validateTicket = () => {}; return ( -
    + <>
    -
    -

    Tickets

    -
    -
    - -
    +

    Tickets

    +
    - -
      - {tickets.map((t: Ticket) => ( -
    • - -
    • - ))} -
    -
    +
    +
      + {tickets.map((t: Ticket) => ( +
    • + +
    • + ))} +
    +
    + ); }; diff --git a/client/src/pages/ProjectPage.tsx b/client/src/pages/ProjectPage.tsx index 5ce7d1e..95d484b 100644 --- a/client/src/pages/ProjectPage.tsx +++ b/client/src/pages/ProjectPage.tsx @@ -20,6 +20,7 @@ export const ProjectPage: FC = ({ viewModel }) => { ticketsTotalCount, remainingDays } = viewModel; + const tabNames: string[] = ["Tickets", "Files", "Activity"]; return (
    @@ -35,11 +36,9 @@ export const ProjectPage: FC = ({ viewModel }) => { remainingDays={remainingDays} />