-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
225 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<AppDispatch>(); | ||
|
||
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 ( | ||
<> | ||
<div className=' w-full my-5'> | ||
<div className='flex mx-7 justify-between items-center'> | ||
<Breadcrumb> | ||
<BreadcrumbList> | ||
<BreadcrumbItem> | ||
🥠Mango | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem> | ||
<BreadcrumbLink> | ||
<Link to="/sprints">Sprints</Link> | ||
</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem> | ||
<BreadcrumbPage className='border px-2 rounded-sm'>{sprint?.name} | ||
<span className='bg-blue-300 px-1 rounded-lg text-white '> | ||
<TooltipProvider> | ||
<Tooltip> | ||
<TooltipTrigger> {issueCount}</TooltipTrigger> | ||
<TooltipContent> | ||
<p>This sprint has {issueCount} issue</p> | ||
</TooltipContent> | ||
</Tooltip> | ||
</TooltipProvider> | ||
|
||
</span> | ||
</BreadcrumbPage> | ||
</BreadcrumbItem> | ||
</BreadcrumbList> | ||
</Breadcrumb> | ||
<Button onClick={openDialog} size={'md'} className='border bg-blue-400 text-white hover:bg-blue-500'> | ||
Add Issue | ||
</Button> | ||
</div> | ||
<Separator className='mt-[2px]' /> | ||
<IssueTable columns={columns} data={issues} /> | ||
</div> | ||
<CreateIssue isOpen={isOpen} onClose={closeDialog} /> | ||
</> | ||
) | ||
} | ||
|
||
export default Details |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) => <nav ref={ref} aria-label="breadcrumb" {...props} />) | ||
Breadcrumb.displayName = "Breadcrumb" | ||
|
||
const BreadcrumbList = React.forwardRef< | ||
HTMLOListElement, | ||
React.ComponentPropsWithoutRef<"ol"> | ||
>(({ className, ...props }, ref) => ( | ||
<ol | ||
ref={ref} | ||
className={cn( | ||
"flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5", | ||
className | ||
)} | ||
{...props} | ||
/> | ||
)) | ||
BreadcrumbList.displayName = "BreadcrumbList" | ||
|
||
const BreadcrumbItem = React.forwardRef< | ||
HTMLLIElement, | ||
React.ComponentPropsWithoutRef<"li"> | ||
>(({ className, ...props }, ref) => ( | ||
<li | ||
ref={ref} | ||
className={cn("inline-flex items-center gap-1.5", className)} | ||
{...props} | ||
/> | ||
)) | ||
BreadcrumbItem.displayName = "BreadcrumbItem" | ||
|
||
const BreadcrumbLink = React.forwardRef< | ||
HTMLAnchorElement, | ||
React.ComponentPropsWithoutRef<"a"> & { | ||
asChild?: boolean | ||
} | ||
>(({ asChild, className, ...props }, ref) => { | ||
const Comp = asChild ? Slot : "a" | ||
|
||
return ( | ||
<Comp | ||
ref={ref} | ||
className={cn("transition-colors hover:text-foreground", className)} | ||
{...props} | ||
/> | ||
) | ||
}) | ||
BreadcrumbLink.displayName = "BreadcrumbLink" | ||
|
||
const BreadcrumbPage = React.forwardRef< | ||
HTMLSpanElement, | ||
React.ComponentPropsWithoutRef<"span"> | ||
>(({ className, ...props }, ref) => ( | ||
<span | ||
ref={ref} | ||
role="link" | ||
aria-disabled="true" | ||
aria-current="page" | ||
className={cn("font-normal text-foreground", className)} | ||
{...props} | ||
/> | ||
)) | ||
BreadcrumbPage.displayName = "BreadcrumbPage" | ||
|
||
const BreadcrumbSeparator = ({ | ||
children, | ||
className, | ||
...props | ||
}: React.ComponentProps<"li">) => ( | ||
<li | ||
role="presentation" | ||
aria-hidden="true" | ||
className={cn("[&>svg]:size-3.5", className)} | ||
{...props} | ||
> | ||
{children ?? <ChevronRight />} | ||
</li> | ||
) | ||
BreadcrumbSeparator.displayName = "BreadcrumbSeparator" | ||
|
||
const BreadcrumbEllipsis = ({ | ||
className, | ||
...props | ||
}: React.ComponentProps<"span">) => ( | ||
<span | ||
role="presentation" | ||
aria-hidden="true" | ||
className={cn("flex h-9 w-9 items-center justify-center", className)} | ||
{...props} | ||
> | ||
<MoreHorizontal className="h-4 w-4" /> | ||
<span className="sr-only">More</span> | ||
</span> | ||
) | ||
BreadcrumbEllipsis.displayName = "BreadcrumbElipssis" | ||
|
||
export { | ||
Breadcrumb, | ||
BreadcrumbList, | ||
BreadcrumbItem, | ||
BreadcrumbLink, | ||
BreadcrumbPage, | ||
BreadcrumbSeparator, | ||
BreadcrumbEllipsis, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters