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

Nv 1787 notifications page placeholder #2954

Merged

Conversation

LetItRock
Copy link
Contributor

What change does this PR introduce?

The Notifications page table placeholder will be shown when there are no templates created yet.
The "Try Digest Playground" tile creates the example "Digest Workflow" and currently it redirects to the Workflow Editor but will navigate to the Digest Workflow Playground later on.

Why was this change needed?

Other information (Screenshots)

Screenshot 2023-03-06 at 11 20 34

@LetItRock LetItRock self-assigned this Mar 6, 2023
@linear
Copy link

linear bot commented Mar 6, 2023

NV-1787 Implement the Notifications page Empty State

When the user doesn't have any workflows setup yet or he has removed all the workflows we want in that case to show the placeholder with two buttons to create a new workflow or to try the digest playground.

Screenshot 2023-03-03 at 11.33.22.png

Comment on lines 4 to 8
<script>
window._env_ = {
SKIP_PREFLIGHT_CHECK: 'true',
};
</script>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix for the storybook, it was failing because this env did not exist

@@ -85,7 +89,7 @@ module.exports = (on, config) => {
);

let templates;
if (!settings?.noEnvironment) {
if (!settings?.noTemplates) {
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 noEnvironment was not used...
if noTemplates flag is set we won't create the templates in Cypress e2e tests...

Comment on lines +28 to +50
it('when no workflow templates created it should show the page placeholder', function () {
cy.initializeSession({ noTemplates: true }).as('session');
cy.intercept('**/notification-templates**').as('notificationTemplates');
cy.visit('/templates');
cy.wait('@notificationTemplates');

cy.getByTestId('no-workflow-templates-placeholder').should('be.visible');
cy.getByTestId('create-workflow-tile').should('not.be.disabled');
cy.getByTestId('try-digest-playground-tile').should('not.be.disabled');
});

it('when clicking on create workflow it should redirect to create template page', function () {
cy.initializeSession({ noTemplates: true }).as('session');
cy.intercept('**/notification-templates**').as('notificationTemplates');
cy.visit('/templates');
cy.wait('@notificationTemplates');

cy.getByTestId('no-workflow-templates-placeholder').should('be.visible');
cy.getByTestId('create-workflow-tile').should('not.be.disabled');
cy.getByTestId('create-workflow-tile').click();

cy.url().should('include', '/templates/create');
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for now only two tests...
I'll add the test for the Try Digest Workflow tile a little later when it will point to the appropriate page

imagePath?: string;
href?: string;
disabled?: boolean;
testId?: string;
}

export function Cards({ cells }: { cells: ICardCell[] }) {
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 component to the design-system folder and adjusted it a little to be more close with the designs

}
/* eslint-disable */
export function DigestGradient({ width = '30', height = '31' }: IIconProps) {
export function DigestGradient(props: React.ComponentPropsWithoutRef<'svg'>) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow to override the width and height like we do in other icons

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't working before?

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 was only allowing for the width/height, but not for ex. styles

@@ -39,6 +38,8 @@ export function Quickstart() {
);
}

const BellGradientIcon = () => <BellGradient style={{ width: '40px', height: '40px' }} />;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our icons are looking wrong when you do inspect its viewBox... that's why I had to do this hack in order to have them look the same... I'll talk to Nikolay about it

@@ -25,6 +45,7 @@ export function Table({
pagination = false,
loading = false,
onRowClick,
noDataPlaceholder,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow to pass the table placeholder

@@ -79,7 +100,7 @@ export function Table({
: {}),
} as any,
usePagination
);
) as UseTableProps;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjusted types for the useTable hook... casted it here to the UseTableProps because there is no another way to do this when the hook uses other plugins, like usePagination

@@ -31,6 +51,39 @@ function NotificationList() {
navigate(ROUTES.TEMPLATES_CREATE);
};

const handleTryDigestClick = () => {
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 the Try Digest Workflow button is clicked we do create an example Digest Workflow

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this should be driven (the example workflow content) by the backend. 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do the same for the in-app workflow and I think that for now, it's ok to have it like this...
I feel like we should use what is available to accomplish the goal and not overengineer with the FE needs...

<StyledCard dark={colorScheme === 'dark'} onClick={handleOnClick}>
<StyledCard
dark={colorScheme === 'dark'}
onClick={cell.onClick ?? handleOnClick}
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 this logic should be moved to inside handleOnClick.

Suggested change
onClick={cell.onClick ?? handleOnClick}
onClick={handleOnClick}

And inside of the method:

const handleOnClick = () => {
    if (cell.onClick) {
       onClick();
       return;
     }
     
     if (cell.navigateTo) {
       navigate(cell.navigateTo);
     }
  };

}
/* eslint-disable */
export function DigestGradient({ width = '30', height = '31' }: IIconProps) {
export function DigestGradient(props: React.ComponentPropsWithoutRef<'svg'>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't working before?

);
};

const DigestGradientIcon = () => <DigestGradient style={{ height: '40px', width: '40px' }} />;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this live as a reusable component within the new FE structure?

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 DigestGradient is imported from the design system and is supposed to be a reusable icon, but its viewport is broken so the icon is not looking good everywhere, that's why I've hacked it like this to look similar in size to the other icon... talked about this with Nikolay and we plan to update the icons soon

@@ -31,6 +51,39 @@ function NotificationList() {
navigate(ROUTES.TEMPLATES_CREATE);
};

const handleTryDigestClick = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this should be driven (the example workflow content) by the backend. 🤔

Base automatically changed from nv-1786-refactor-workflow-editor-state to getting-started-flow March 6, 2023 15:22
@LetItRock LetItRock merged commit d6a555a into getting-started-flow Mar 6, 2023
@LetItRock LetItRock deleted the nv-1787-notifications-page-placeholder branch March 6, 2023 17:12
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