From 2083043534a9106030d10eb6d86d72984f38d19b Mon Sep 17 00:00:00 2001 From: seaerchin Date: Thu, 29 Sep 2022 03:00:48 +0800 Subject: [PATCH] chore(dashboard): remove hook --- .../ReviewRequest/Dashboard.stories.tsx | 6 +++++ src/layouts/ReviewRequest/Dashboard.tsx | 23 ++++++++----------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/layouts/ReviewRequest/Dashboard.stories.tsx b/src/layouts/ReviewRequest/Dashboard.stories.tsx index 53b537ac0a..fd03a69db9 100644 --- a/src/layouts/ReviewRequest/Dashboard.stories.tsx +++ b/src/layouts/ReviewRequest/Dashboard.stories.tsx @@ -1,5 +1,7 @@ import { ComponentMeta, Story } from "@storybook/react" +import { MOCK_ITEMS } from "mocks/constants" + import { ReviewRequestDashboard, ReviewRequestDashboardProps, @@ -16,6 +18,10 @@ export const Playground: Story = Template.bind({}) Playground.args = { siteName: "MOCK_ADMINS", reviewUrl: "Copied to your clipboard kekw", + title: "Update STCCED hyperlink, customs duty", + requestor: "seaerchin", + reviewers: ["nat mae tan", "jiachin er"], + changedItems: MOCK_ITEMS, } export default dashboardMeta diff --git a/src/layouts/ReviewRequest/Dashboard.tsx b/src/layouts/ReviewRequest/Dashboard.tsx index 7c64bf15d6..2c345aaef3 100644 --- a/src/layouts/ReviewRequest/Dashboard.tsx +++ b/src/layouts/ReviewRequest/Dashboard.tsx @@ -21,31 +21,26 @@ import { import { useState } from "react" import { BiLink } from "react-icons/bi" -import { MOCK_ITEMS } from "mocks/constants" import { extractInitials, getDateTimeFromUnixTime } from "utils" -import { RequestOverview } from "./components/RequestOverview" - -const useGetPullRequest = (siteName: string) => { - return { - title: "Update STCCED hyperlink, customs duty", - requestor: "seaerchin", - reviewers: ["nat mae tan", "jiachin er"], - changedItems: MOCK_ITEMS, - } -} +import { RequestOverview, EditedItemProps } from "./components/RequestOverview" export interface ReviewRequestDashboardProps { siteName: string reviewUrl: string + title: string + requestor: string + reviewers: string[] + changedItems: EditedItemProps[] } export const ReviewRequestDashboard = ({ siteName, reviewUrl, + title, + requestor, + reviewers, + changedItems, }: ReviewRequestDashboardProps): JSX.Element => { - const { title, requestor, reviewers, changedItems } = useGetPullRequest( - siteName - ) const { onCopy, hasCopied } = useClipboard(reviewUrl) return (