-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(dashboard): Nv 4476 workflow editor header navigation #6700
Merged
Merged
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9eaeb06
feat(dashboard): workflow editor layout and route
LetItRock b493402
feat(dashboard): workflow editor render name
LetItRock 779cf08
chore(dashboard): workflow editor rename file
LetItRock a17cfa6
feat: breadcrumbs
BiswaViraj 0fe9966
fix: merge
BiswaViraj 2ee5046
fix: merge
BiswaViraj 22f7f13
fix: typo
BiswaViraj ed90f86
feat: back btn
BiswaViraj d44d8cc
feat: update padding
BiswaViraj 5ad36e5
feat: remove pl
BiswaViraj 0362c92
feat: workflow name
BiswaViraj 32494df
feat: update route
BiswaViraj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,12 @@ | ||
import React from 'react'; | ||
|
||
export function ArrowRight(props: React.ComponentPropsWithoutRef<'svg'>) { | ||
return ( | ||
<svg xmlns="http://www.w3.org/2000/svg" width="8" height="12" viewBox="0 0 8 12" fill="none" {...props}> | ||
<path | ||
d="M3.0452 5.99908L7.5002 10.4541L6.2276 11.7267L0.5 5.99908L6.2276 0.271484L7.5002 1.54408L3.0452 5.99908Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
); | ||
} |
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,12 @@ | ||
import React from 'react'; | ||
|
||
export function RouteFill(props: React.ComponentPropsWithoutRef<'svg'>) { | ||
return ( | ||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 20 20" {...props}> | ||
<path | ||
fill="currentColor" | ||
d="M4 12.25V7.375a3.375 3.375 0 016.75 0v5.25a1.875 1.875 0 103.75 0V7.623a2.25 2.25 0 111.5 0v5.002a3.375 3.375 0 01-6.75 0v-5.25a1.875 1.875 0 10-3.75 0v4.875h2.25l-3 3.75-3-3.75H4z" | ||
></path> | ||
</svg> | ||
); | ||
} |
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 { cn } from '@/utils/ui'; | ||
import { Slot } from '@radix-ui/react-slot'; | ||
import { MoreHorizontal } from 'lucide-react'; | ||
import * as React from 'react'; | ||
import { Link, LinkProps } from 'react-router-dom'; | ||
|
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💯 |
||
ref={ref} | ||
className={cn( | ||
'flex flex-nowrap items-center gap-1.5 break-words text-sm font-medium text-neutral-600 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, | ||
LinkProps & { | ||
asChild?: boolean; | ||
} | ||
>(({ asChild, className, ...props }, ref) => { | ||
const Component = asChild ? Slot : Link; | ||
|
||
return ( | ||
<Component | ||
ref={ref} | ||
className={cn('transition-colors hover:text-neutral-950 hover:underline', 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('flex gap-1.5 font-medium text-neutral-950', className)} | ||
{...props} | ||
/> | ||
) | ||
); | ||
BreadcrumbPage.displayName = 'BreadcrumbPage'; | ||
|
||
const BreadcrumbSeparator = ({ children, className, ...props }: React.ComponentProps<'li'>) => ( | ||
<li role="presentation" aria-hidden="true" className={cn('text-neutral-300', className)} {...props}> | ||
{children ?? '/'} | ||
</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 = 'BreadcrumbEllipsis'; | ||
|
||
export { | ||
Breadcrumb, | ||
BreadcrumbEllipsis, | ||
BreadcrumbItem, | ||
BreadcrumbLink, | ||
BreadcrumbList, | ||
BreadcrumbPage, | ||
BreadcrumbSeparator, | ||
}; |
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 |
---|---|---|
@@ -1,10 +1,73 @@ | ||
import { WorkflowEditor } from '@/components/workflow-editor'; | ||
import { EditWorkflowLayout } from '@/components/edit-workflow-layout'; | ||
import { ArrowRight, RouteFill } from '@/components/icons'; | ||
import { | ||
Breadcrumb, | ||
BreadcrumbItem, | ||
BreadcrumbLink, | ||
BreadcrumbList, | ||
BreadcrumbPage, | ||
BreadcrumbSeparator, | ||
} from '@/components/primitives/breadcrumb'; | ||
import { Button } from '@/components/primitives/button'; | ||
import { WorkflowEditor } from '@/components/workflow-editor'; | ||
import { useEnvironment } from '@/context/environment/hooks'; | ||
import { useFetchWorkflow } from '@/hooks/use-fetch-workflow'; | ||
import { buildRoute, ROUTES } from '@/utils/routes'; | ||
import React from 'react'; | ||
import { useNavigate, useParams } from 'react-router-dom'; | ||
|
||
export const EditWorkflowPage = () => { | ||
return ( | ||
<EditWorkflowLayout headerStartItems={<h1 className="text-foreground-950">Edit Workflow</h1>}> | ||
<EditWorkflowLayout headerStartItems={<StartItems />}> | ||
<WorkflowEditor /> | ||
BiswaViraj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</EditWorkflowLayout> | ||
); | ||
}; | ||
|
||
const StartItems = () => { | ||
const { currentEnvironment } = useEnvironment(); | ||
const { workflowId } = useParams<{ workflowId?: string }>(); | ||
const navigate = useNavigate(); | ||
const workflowsRoute = buildRoute(ROUTES.WORKFLOWS, { environmentId: currentEnvironment?._id ?? '' }); | ||
const { workflow } = useFetchWorkflow({ | ||
workflowId, | ||
}); | ||
|
||
const breadcrumbs = [ | ||
{ label: currentEnvironment?.name, href: '/' }, | ||
{ | ||
label: 'Workflows', | ||
href: workflowsRoute, | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these two will be the same route |
||
]; | ||
|
||
const handleBackNav = () => { | ||
navigate(workflowsRoute); | ||
}; | ||
|
||
return ( | ||
<div className="flex items-center gap-2"> | ||
<Button variant="link" onClick={handleBackNav}> | ||
<ArrowRight className="text-neutral-950" /> | ||
</Button> | ||
<Breadcrumb> | ||
<BreadcrumbList> | ||
{breadcrumbs.map(({ label, href }) => ( | ||
<React.Fragment key={href}> | ||
BiswaViraj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<BreadcrumbItem> | ||
<BreadcrumbLink to={href}>{label}</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
</React.Fragment> | ||
))} | ||
<BreadcrumbItem> | ||
<BreadcrumbPage> | ||
<RouteFill /> | ||
{workflow?.name} | ||
</BreadcrumbPage> | ||
</BreadcrumbItem> | ||
</BreadcrumbList> | ||
</Breadcrumb> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit picky comment: Is breadcrumb a primitive? It's a specific component displayed in one place in the app. Should we remove it from this folder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we will use it in other areas too, like Activity feed, Subscribers list page
< Development / Subscribers / Biswajeet Das