-
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
Nv 1787 notifications page placeholder #2954
Nv 1787 notifications page placeholder #2954
Conversation
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. |
<script> | ||
window._env_ = { | ||
SKIP_PREFLIGHT_CHECK: 'true', | ||
}; | ||
</script> |
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.
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) { |
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 noEnvironment
was not used...
if noTemplates
flag is set we won't create the templates in Cypress e2e tests...
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'); | ||
}); |
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.
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[] }) { |
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 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'>) { |
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.
allow to override the width and height like we do in other icons
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.
Wasn't working before?
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 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' }} />; |
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.
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, |
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.
allow to pass the table placeholder
@@ -79,7 +100,7 @@ export function Table({ | |||
: {}), | |||
} as any, | |||
usePagination | |||
); | |||
) as UseTableProps; |
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.
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 = () => { |
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 the Try Digest Workflow
button is clicked we do create an example Digest 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.
Not sure if this should be driven (the example workflow content) by the backend. 🤔
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.
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} |
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 this logic should be moved to inside handleOnClick
.
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'>) { |
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.
Wasn't working before?
); | ||
}; | ||
|
||
const DigestGradientIcon = () => <DigestGradient style={{ height: '40px', width: '40px' }} />; |
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.
Shouldn't this live as a reusable component within the new FE structure?
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 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 = () => { |
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.
Not sure if this should be driven (the example workflow content) by the backend. 🤔
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)