-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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(web): templates list page - create template dropdown button #3462
Conversation
NV-2236 🏪 [Template store] New Workflow Button
Why?When a user is creating a workflow, help him by reducing the amount of time to set up a base for his workflow. What?Create a dropdown menu on the "Create Workflow" Button. SolutionSort templates by "the most popular".
Workflow list - Template store (Figma) White theme |
it('should show the create template dropdown', function () { | ||
cy.intercept('**/notification-templates**').as('notificationTemplates'); | ||
cy.visit('/templates'); | ||
cy.wait('@notificationTemplates'); | ||
|
||
cy.getByTestId('create-template-btn').should('not.be.disabled').click(); | ||
cy.getByTestId('create-workfolow-all-templates').contains('All templates'); | ||
cy.getByTestId('create-workfolow-blank').contains('Blank workflow'); | ||
}); |
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.
right now we only check for All templates
and Blank workflow
, but in the near future we will initialize test with blueprints and then will check the most popular items in the dropdown
@@ -183,6 +183,7 @@ export function HeaderNav({}: Props) { | |||
<NotificationCenterWidget user={currentUser} /> | |||
<Dropdown | |||
position="bottom-end" | |||
styles={{ dropdown: { minWidth: 220 } }} |
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.
moved this style from the Dropdown
component to this specific for that style place - user header dropdown
divider: { | ||
margin: '10px', | ||
borderTop: `0.0625rem solid ${colors.B30}`, | ||
}, |
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.
dropdown divider styles
@@ -32,3 +45,4 @@ export function Dropdown({ control, children, ...props }: IDropdownProps) { | |||
|
|||
Dropdown.Item = Menu.Item; | |||
Dropdown.Label = Menu.Label; | |||
Dropdown.Divider = Menu.Divider; |
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.
the option to provide the divider in the dropdown
control: React.ReactNode; | ||
children: React.ReactNode; | ||
} | ||
|
||
export function Dropdown({ control, children, ...props }: IDropdownProps) { | ||
export function Dropdown({ control, withArrow = true, offset = 10, children, ...props }: IDropdownProps) { |
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.
moved to defaults which can be overriden
<div> | ||
<ButtonStyled disabled={readonly} icon={<PlusCircle />} data-test-id="create-template-btn"> | ||
Create Workflow | ||
</ButtonStyled> | ||
</div> |
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.
had to wrap it within the div, otherwise, the dropdown is not positioned appropriately
data-test-id="create-template-dropdown" | ||
> | ||
{isLoading | ||
? Array.from({ length: 3 }).map((_, index) => <DropdownItemSkeleton key={index} />) |
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.
when loading show skeleton items for the most popular templates
<Popover | ||
key={template.name} | ||
opened={template.id === templateId} | ||
withArrow | ||
withinPortal | ||
offset={5} | ||
transitionDuration={300} | ||
position="left" | ||
width={300} | ||
target={ | ||
<Dropdown.Item | ||
icon={<FontAwesomeIcon icon={template.iconName} />} | ||
onClick={() => onTemplateClick(template)} | ||
onMouseEnter={() => { | ||
setTemplateId(template.id); | ||
}} | ||
onMouseLeave={() => { | ||
setTemplateId(null); | ||
}} | ||
data-test-id="logout-button" | ||
> | ||
{template.name} | ||
</Dropdown.Item> | ||
} | ||
content={template.description} | ||
/> |
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.
the dropdown items with the most popular templates, wrapped with the popover to show the description
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 think it will be a good idea to wrap all the items including All templates and Blank workflow so the popover will be consistent on all the hovers. and additional info won't hurt.
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'll ask Nikolay about the texts ;)
<Dropdown.Item | ||
disabled={allTemplatesDisabled} | ||
icon={<FontAwesomeIcon icon={faDiagramNext} />} | ||
onClick={onAllTemplatesClick} | ||
data-test-id="create-workfolow-all-templates" | ||
> | ||
All templates | ||
</Dropdown.Item> |
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.
it will open the Templates Store modal
<Dropdown.Item | ||
icon={<FontAwesomeIcon icon={faFile} />} | ||
onClick={onBlankWorkflowClick} | ||
data-test-id="create-workfolow-blank" | ||
> | ||
Blank workflow | ||
</Dropdown.Item> | ||
</Dropdown> |
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.
this one will create the blank template and open the editor
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.
As always look like an awesome chunk of work 🙃
@@ -26,5 +25,9 @@ export default createStyles((theme: MantineTheme) => { | |||
itemHovered: { | |||
backgroundColor: dark ? colors.B30 : colors.B98, | |||
}, | |||
divider: { | |||
margin: '10px', | |||
borderTop: `0.0625rem solid ${colors.B30}`, |
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.
If this one is the divider color here, we need to add 'Light BG' for the light them.
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.
yes, thanks for pointing on that :)
<Popover | ||
key={template.name} | ||
opened={template.id === templateId} | ||
withArrow | ||
withinPortal | ||
offset={5} | ||
transitionDuration={300} | ||
position="left" | ||
width={300} | ||
target={ | ||
<Dropdown.Item | ||
icon={<FontAwesomeIcon icon={template.iconName} />} | ||
onClick={() => onTemplateClick(template)} | ||
onMouseEnter={() => { | ||
setTemplateId(template.id); | ||
}} | ||
onMouseLeave={() => { | ||
setTemplateId(null); | ||
}} | ||
data-test-id="logout-button" | ||
> | ||
{template.name} | ||
</Dropdown.Item> | ||
} | ||
content={template.description} | ||
/> |
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 think it will be a good idea to wrap all the items including All templates and Blank workflow so the popover will be consistent on all the hovers. and additional info won't hurt.
What change does this PR introduce?
On the Templates List page, we introduced the "Create Workflow" dropdown button which will have a few options:
Why was this change needed?
Templates Store PRD.
Other information (Screenshots)
Screen.Recording.2023-05-19.at.12.48.54.mov