Skip to content
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

Merged
merged 7 commits into from
May 22, 2023

Conversation

LetItRock
Copy link
Contributor

What change does this PR introduce?

On the Templates List page, we introduced the "Create Workflow" dropdown button which will have a few options:

  • to pick one of the popular templates
  • to browse the Templates Store
  • or to start with blank template

Why was this change needed?

Templates Store PRD.

Other information (Screenshots)

Screenshot 2023-05-19 at 12 50 29

Screenshot 2023-05-19 at 12 50 36
Screenshot 2023-05-19 at 12 51 13
Screenshot 2023-05-19 at 12 49 30

Screen.Recording.2023-05-19.at.12.48.54.mov

@LetItRock LetItRock self-assigned this May 19, 2023
@linear
Copy link

linear bot commented May 19, 2023

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.

Solution

Sort templates by "the most popular".

  • Blank Workflow button
  • 3 templates (most popular)
  • All templates button

Workflow list - Template store (Figma)

White theme

Empty state WE - Template store (Figma)

Comment on lines 28 to 36
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');
});
Copy link
Contributor Author

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 } }}
Copy link
Contributor Author

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

Comment on lines 28 to 31
divider: {
margin: '10px',
borderTop: `0.0625rem solid ${colors.B30}`,
},
Copy link
Contributor Author

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;
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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

Comment on lines +53 to +57
<div>
<ButtonStyled disabled={readonly} icon={<PlusCircle />} data-test-id="create-template-btn">
Create Workflow
</ButtonStyled>
</div>
Copy link
Contributor Author

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} />)
Copy link
Contributor Author

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

Comment on lines +64 to +89
<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}
/>
Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor Author

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 ;)

Comment on lines 91 to 98
<Dropdown.Item
disabled={allTemplatesDisabled}
icon={<FontAwesomeIcon icon={faDiagramNext} />}
onClick={onAllTemplatesClick}
data-test-id="create-workfolow-all-templates"
>
All templates
</Dropdown.Item>
Copy link
Contributor Author

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

Comment on lines 100 to 107
<Dropdown.Item
icon={<FontAwesomeIcon icon={faFile} />}
onClick={onBlankWorkflowClick}
data-test-id="create-workfolow-blank"
>
Blank workflow
</Dropdown.Item>
</Dropdown>
Copy link
Contributor Author

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

Base automatically changed from nv-2235-templates-store-empty-templates-screen to next May 19, 2023 15:26
Copy link
Contributor

@djabarovgeorge djabarovgeorge left a 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}`,
Copy link
Contributor

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.

Copy link
Contributor Author

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 :)

Comment on lines +64 to +89
<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}
/>
Copy link
Contributor

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.

@LetItRock LetItRock added this pull request to the merge queue May 22, 2023
Merged via the queue into next with commit 8059892 May 22, 2023
25 checks passed
@LetItRock LetItRock deleted the nv-2236-create-workflow-dropdown-button branch May 22, 2023 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants