From 14e47378dd9c2089f82f1e2ddb8b755e4494c48b Mon Sep 17 00:00:00 2001 From: Ruidy Nemausat Date: Thu, 20 Feb 2020 14:51:03 +0100 Subject: [PATCH] Code cleaning --- client/src/App.css | 42 -------------------- client/src/App.tsx | 2 - client/src/components/ActivityCollection.tsx | 10 +++-- client/src/components/AvatarList.tsx | 17 +++++--- client/src/components/Button.tsx | 2 +- client/src/components/FileCollection.tsx | 6 +-- client/src/components/HorizontalCard.tsx | 9 ++--- client/src/components/ProgressBar.tsx | 2 +- client/src/components/TabRouter.tsx | 30 +++++++------- client/src/components/TabRouterHeader.tsx | 7 ++-- client/src/controllers/ProjectController.tsx | 12 ++++-- client/src/pages/ProjectPage.tsx | 4 +- client/src/pages/TicketPage.tsx | 2 +- client/src/types/User.ts | 1 + client/src/utils/router.tsx | 15 ++++--- client/src/viewModels/ProjectVM.ts | 11 +++-- 16 files changed, 73 insertions(+), 99 deletions(-) delete mode 100644 client/src/App.css diff --git a/client/src/App.css b/client/src/App.css deleted file mode 100644 index 90edddb..0000000 --- a/client/src/App.css +++ /dev/null @@ -1,42 +0,0 @@ -.panel { - padding-left: 0px; - padding-top: 10px; -} -.field { - padding-left: 10px; - padding-right: 10px; -} -.city { - display: flex; - background: linear-gradient( - 90deg, - rgba(2, 0, 36, 1) 0%, - rgba(25, 112, 245, 0.6399510487788865) 0%, - rgba(0, 212, 255, 1) 100% - ); - flex-direction: column; - height: 40vh; - justify-content: center; - align-items: center; - padding: 0px 20px 20px 20px; - margin: 0px 0px 50px 0px; - border: 1px solid; - border-radius: 5px; - box-shadow: 2px 2px #888888; - font-family: "Merriweather", serif; -} -.city h1 { - line-height: 1.2; -} -.city span { - padding-left: 20px; -} -.city .row { - padding-top: 20px; -} -.weatherError { - color: #f16051; - font-size: 20px; - letter-spacing: 1px; - font-weight: 200; -} diff --git a/client/src/App.tsx b/client/src/App.tsx index 2400e59..88220e3 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -1,6 +1,4 @@ import React, { FC } from "react"; -import { AppRouter } from "./utils/router"; -import "./App.css"; import Layout from "./pages/Layout"; const App: FC = () => { diff --git a/client/src/components/ActivityCollection.tsx b/client/src/components/ActivityCollection.tsx index e351219..1a3e506 100644 --- a/client/src/components/ActivityCollection.tsx +++ b/client/src/components/ActivityCollection.tsx @@ -9,8 +9,10 @@ export const ActivityCollection: FC = ({ activities }) => { return ( <> @@ -23,13 +25,13 @@ type IFProps = { export const ActivityEntry: FC = ({ activity }) => { return ( -
  • + <> {/* folder */} {activity.user.firstName} {activity.description} {activity.ticket.title}

    {activity.date.toDateString()}

    -
  • + ); }; diff --git a/client/src/components/AvatarList.tsx b/client/src/components/AvatarList.tsx index 7075728..48aacbf 100644 --- a/client/src/components/AvatarList.tsx +++ b/client/src/components/AvatarList.tsx @@ -1,15 +1,22 @@ import React, { FC } from "react"; -import { FloatingButton } from "./FloatingButton"; +import { User } from "../types/User"; interface AvatarListProps { - avatars: string[]; + users: User[]; } -export const AvatarList: FC = ({ avatars }) => { +export const AvatarList: FC = ({ users }) => { return ( <> - {avatars.map((avatar: string) => ( - + {users.map((user: User, i: number) => ( + {user.fullName} ))} ); diff --git a/client/src/components/Button.tsx b/client/src/components/Button.tsx index 0a42e10..8fc9f86 100644 --- a/client/src/components/Button.tsx +++ b/client/src/components/Button.tsx @@ -1,4 +1,4 @@ -import React, { FC, Children } from "react"; +import React, { FC } from "react"; interface IProps { icon?: string; diff --git a/client/src/components/FileCollection.tsx b/client/src/components/FileCollection.tsx index 158c1cb..582fe92 100644 --- a/client/src/components/FileCollection.tsx +++ b/client/src/components/FileCollection.tsx @@ -9,8 +9,8 @@ export const FileCollection: FC = ({ files }) => { return ( <>
      - {files.map((f: AppFile) => ( - + {files.map((file: AppFile) => ( + ))}
    @@ -23,7 +23,7 @@ type IFProps = { export const FileEntry: FC = ({ file }) => { return ( -
  • +
  • {/* */} folder {file.name} diff --git a/client/src/components/HorizontalCard.tsx b/client/src/components/HorizontalCard.tsx index 791222f..54d611e 100644 --- a/client/src/components/HorizontalCard.tsx +++ b/client/src/components/HorizontalCard.tsx @@ -1,5 +1,4 @@ import React, { FC, MouseEvent } from "react"; -import { AvatarList } from "./AvatarList"; import { Link } from "react-router-dom"; interface IProps { @@ -29,16 +28,16 @@ export const HorizontalCard: FC = ({ Due {remainingDays} days diff --git a/client/src/components/ProgressBar.tsx b/client/src/components/ProgressBar.tsx index a9324bb..1095cc9 100644 --- a/client/src/components/ProgressBar.tsx +++ b/client/src/components/ProgressBar.tsx @@ -1,4 +1,4 @@ -import React, { FC, HTMLAttributes, CSSProperties } from "react"; +import React, { FC, CSSProperties } from "react"; type ProgressBarProps = { value: number; diff --git a/client/src/components/TabRouter.tsx b/client/src/components/TabRouter.tsx index 6623285..9d7e55f 100644 --- a/client/src/components/TabRouter.tsx +++ b/client/src/components/TabRouter.tsx @@ -4,7 +4,7 @@ import { TicketList } from "./TicketList"; import { FileList } from "./AppFileList"; import { Ticket } from "../types/Ticket"; import { AppFile } from "../types/AppFile"; -import { Switch, Route, useRouteMatch, Redirect } from "react-router-dom"; +import { Route, useRouteMatch, Redirect } from "react-router-dom"; import { ActivityList } from "./ActivityList"; import { Activity } from "../types/Activity"; @@ -26,25 +26,23 @@ export const TabRouter: FC = ({ const { url } = useRouteMatch(); return ( <> - -
    - +
    + - + - - - + + + - - - + + + - - - -
    - + + + +
    ); }; diff --git a/client/src/components/TabRouterHeader.tsx b/client/src/components/TabRouterHeader.tsx index 0d8eb8f..5a95261 100644 --- a/client/src/components/TabRouterHeader.tsx +++ b/client/src/components/TabRouterHeader.tsx @@ -3,22 +3,21 @@ 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); - + const [isActive, setIsActive] = useState(0); + const nTabs = tabNames.length; return ( <>
      {tabNames.map((name, i) => ( { ticket: tickets[0] }, { - id: 3, + id: 2, description: " added the task ", date: new Date(), user: users[1], diff --git a/client/src/pages/ProjectPage.tsx b/client/src/pages/ProjectPage.tsx index f98d781..9e5b833 100644 --- a/client/src/pages/ProjectPage.tsx +++ b/client/src/pages/ProjectPage.tsx @@ -13,7 +13,7 @@ export const ProjectPage: FC = ({ viewModel }) => { const { title, description, - avatars, + users, value, tickets, ticketsDone, @@ -28,7 +28,7 @@ export const ProjectPage: FC = ({ viewModel }) => {
      - +
      { description="Research, ideate and present brand concepts for client consideration" title="Brand Concept and Design" /> - + {/* */} {/* // // diff --git a/client/src/types/User.ts b/client/src/types/User.ts index 88deb83..6869cd4 100644 --- a/client/src/types/User.ts +++ b/client/src/types/User.ts @@ -2,4 +2,5 @@ export interface User { id: string; picture: string; firstName: string; + fullName?: string; } diff --git a/client/src/utils/router.tsx b/client/src/utils/router.tsx index a90cafb..c2098ed 100644 --- a/client/src/utils/router.tsx +++ b/client/src/utils/router.tsx @@ -1,11 +1,16 @@ import React from "react"; -import { Router, Route, Switch, Link, NavLink } from "react-router-dom"; +import { + Router, + Route, + Switch + //Link, NavLink +} from "react-router-dom"; import * as creacteHistory from "history"; -import { TicketPage } from "../pages/TicketPage"; -import { HomeController } from "../controllers/HomeController"; +// import { TicketPage } from "../pages/TicketPage"; +// import { HomeController } from "../controllers/HomeController"; import { ProjectController } from "../controllers/ProjectController"; -import { UserController } from "../controllers/UserController"; -import { TicketController } from "../controllers/TicketController"; +// import { UserController } from "../controllers/UserController"; +// import { TicketController } from "../controllers/TicketController"; export const history = creacteHistory.createBrowserHistory(); diff --git a/client/src/viewModels/ProjectVM.ts b/client/src/viewModels/ProjectVM.ts index 490a10a..d660db6 100644 --- a/client/src/viewModels/ProjectVM.ts +++ b/client/src/viewModels/ProjectVM.ts @@ -1,9 +1,10 @@ import { Ticket } from "../types/Ticket"; import { Project } from "../types/Project"; -import { Constants } from "../utils/Constants"; -import { User } from "../types/User"; +// import { Constants } from "../utils/Constants"; +// import { User } from "../types/User"; import { AppFile } from "../types/AppFile"; import { Activity } from "../types/Activity"; +import { User } from "../types/User"; export default class ProjectVM { public id: number; @@ -11,7 +12,8 @@ export default class ProjectVM { public description: string; public value: number; public tickets: Ticket[]; - public avatars: string[]; + // public avatars: string[]; + public users: User[]; public ticketsTotalCount: number; public ticketsDone: number; public remainingDays: number; @@ -33,7 +35,8 @@ export default class ProjectVM { this.id = project.id; this.title = project.title; this.description = project.description; - this.avatars = project.users.map(u => u.picture); + // this.avatars = project.users.map(u => u.picture); + this.users = project.users; this.value = project.progression; this.tickets = project.tickets; this.ticketsTotalCount = this.tickets.length;