From b3351bf3a923da5fc1a1ec9bf31ca366fde4b944 Mon Sep 17 00:00:00 2001 From: Himanshu Sharma Date: Sat, 13 Jul 2024 00:52:30 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=AD=20Basic=20Sprint=20Details=20Page?= =?UTF-8?q?=20done?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mango-frontend/src/Pages/SprintDetail.tsx | 9 +- .../src/components/Issue Table/IssueTable.tsx | 4 +- .../src/components/SprintDetail/Details.tsx | 96 +++++++++++++++ .../src/components/sidebar/desktop.tsx | 3 +- .../src/components/ui/breadcrumb.tsx | 115 ++++++++++++++++++ mango-frontend/src/components/ui/table.tsx | 2 +- mango-frontend/src/types/index.ts | 10 +- 7 files changed, 225 insertions(+), 14 deletions(-) create mode 100644 mango-frontend/src/components/SprintDetail/Details.tsx create mode 100644 mango-frontend/src/components/ui/breadcrumb.tsx diff --git a/mango-frontend/src/Pages/SprintDetail.tsx b/mango-frontend/src/Pages/SprintDetail.tsx index 680624f..a3aa6e4 100644 --- a/mango-frontend/src/Pages/SprintDetail.tsx +++ b/mango-frontend/src/Pages/SprintDetail.tsx @@ -1,8 +1,15 @@ import React from 'react' +import { Sidebar } from '@/components/sidebar/sidebar'; +import Details from '@/components/SprintDetail/Details'; + + const SprintDetail: React.FC = () => { return ( -
SprintDetail
+
+ +
+
) } diff --git a/mango-frontend/src/components/Issue Table/IssueTable.tsx b/mango-frontend/src/components/Issue Table/IssueTable.tsx index 95aba43..da68ea5 100644 --- a/mango-frontend/src/components/Issue Table/IssueTable.tsx +++ b/mango-frontend/src/components/Issue Table/IssueTable.tsx @@ -40,7 +40,7 @@ export function IssueTable({ {headerGroup.headers.map((header) => { return ( - + {header.isPlaceholder ? null : flexRender( @@ -61,7 +61,7 @@ export function IssueTable({ data-state={row.getIsSelected() && "selected"} > {row.getVisibleCells().map((cell) => ( - + {flexRender(cell.column.columnDef.cell, cell.getContext())} ))} diff --git a/mango-frontend/src/components/SprintDetail/Details.tsx b/mango-frontend/src/components/SprintDetail/Details.tsx new file mode 100644 index 0000000..e031f44 --- /dev/null +++ b/mango-frontend/src/components/SprintDetail/Details.tsx @@ -0,0 +1,96 @@ +import React, { useEffect } from 'react' +import { + Breadcrumb, + BreadcrumbItem, + BreadcrumbLink, + BreadcrumbList, + BreadcrumbPage, + BreadcrumbSeparator, +} from "@/components/ui/breadcrumb"; +import { Link, useParams } from 'react-router-dom'; +import { useDispatch, useSelector } from 'react-redux'; +import { AppDispatch, RootState } from '@/redux/store'; +import { fetchSprints } from '@/redux/slices/sprintSlice'; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip" +import { Button } from "@/components/ui/button" +import { UseDialog } from '@/hooks/useDialog'; +import { CreateIssue } from '../Create Issue/CreateIssue'; +import { Separator } from "@/components/ui/separator" +import { IssueTable } from '../Issue Table/IssueTable'; +import { columns } from '../Issue Table/Columns'; +import { IssueType } from '@/types'; + + +const Details: React.FC = () => { + + const { sprint_id } = useParams<{ sprint_id: string }>(); + const dispatch = useDispatch(); + + const { isOpen, openDialog, closeDialog } = UseDialog(); + + useEffect(() => { + async function fetchData() { + await dispatch(fetchSprints()); + } + fetchData(); + }, [dispatch]) + const { sprints } = useSelector((state: RootState) => state.sprints); + + const sprint = sprints.find((sprint) => sprint.sprint_id === Number(sprint_id)); + console.log(sprint); + + const issues: IssueType[] = sprint?.issue || []; + + const issueCount = sprint?.issue?.length || 0; + + return ( + <> +
+
+ + + + 🥭 Mango + + + + + Sprints + + + + + {sprint?.name}   + + + + {issueCount} + +

This sprint has {issueCount} issue

+
+
+
+ +
+
+
+
+
+ +
+ + +
+ + + ) +} + +export default Details \ No newline at end of file diff --git a/mango-frontend/src/components/sidebar/desktop.tsx b/mango-frontend/src/components/sidebar/desktop.tsx index 5e3345d..0bf0b28 100644 --- a/mango-frontend/src/components/sidebar/desktop.tsx +++ b/mango-frontend/src/components/sidebar/desktop.tsx @@ -78,6 +78,7 @@ export function SidebarDesktop() { - + + ); } diff --git a/mango-frontend/src/components/ui/breadcrumb.tsx b/mango-frontend/src/components/ui/breadcrumb.tsx new file mode 100644 index 0000000..71a5c32 --- /dev/null +++ b/mango-frontend/src/components/ui/breadcrumb.tsx @@ -0,0 +1,115 @@ +import * as React from "react" +import { Slot } from "@radix-ui/react-slot" +import { ChevronRight, MoreHorizontal } from "lucide-react" + +import { cn } from "@/lib/utils" + +const Breadcrumb = React.forwardRef< + HTMLElement, + React.ComponentPropsWithoutRef<"nav"> & { + separator?: React.ReactNode + } +>(({ ...props }, ref) =>