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): the table skeleton loading #3628

Merged
merged 2 commits into from
Jun 21, 2023

Conversation

LetItRock
Copy link
Contributor

@LetItRock LetItRock commented Jun 20, 2023

What change does this PR introduce?

This is a preparation for the new Integrations List Page.

The changes:

  • updated the react-table minor version which has better types
  • refactored the Table component to allow having a skeleton loading per cell (according to the latest designs)
  • when column Cell prop is not overridden it will use the default cell loading component
  • fixed the Table column prop types
  • fixed all pages to use the title prop of the PageContainer

Why was this change needed?

Other information (Screenshots)

Screenshot 2023-06-20 at 17 31 24

Screen.Recording.2023-06-20.at.17.24.04.mov

@LetItRock LetItRock self-assigned this Jun 20, 2023
@linear
Copy link

linear bot commented Jun 20, 2023

NV-2425 Implement the Integrations List Page

What?

Implement the new Integrations List page according to the new designs:

  • loading state - skeleton
  • the list with the integrations
  • no pagination - infinite scroll
  • create integration button

The show sidebar functionality on New provider button click and list item click will be implemented in the separate tickets.

The sorting and filtering functionality is out of scope for this cycle, also the conditions column is out of scope.

Do not remove the old page because we will show/hide the old/new page with the feature flag mechanism.

Definition of Done

  • The New Integrations List page is implemented according to the design
  • The old page has not been removed (will be hidden by the feature flag)
  • Loading state - skeleton
  • New provider button
  • E2E tests are implemented

Design spec

List

Integration store / List view - Integration store (Figma)

Starting state

Integration store / List view - Integration store (Figma)

Empty state

Integration store / List view - Integration store (Figma)

Skeleton

Integration store / List view - Integration store (Figma)

Add a provider button

Add a provider/workflow button - Integration store (Figma)

Provider logos

TBD - waiting for Pixel Point. Will be posted here

@@ -64,7 +64,7 @@
"@types/node": "^12.0.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/react-table": "^7.7.9",
"@types/react-table": "^7.7.12",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated slightly react-table and types package, that have more precise types

Comment on lines +4 to +8
const DefaultCellComponent = ({ value }: IExtendedCellProps) => {
return value ?? '';
};

export const DefaultCell = withCellLoading(DefaultCellComponent);
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 is a default table cell component that will show the loading skeleton then the table is in the loading state. This component will be used if we do not override the column Cell property.

Comment on lines +70 to +72
const Template: ComponentStory<typeof Table> = ({ ...args }) => (
<Table columns={columns as any} data={data} {...args} />
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed some ts issues in the storybook

Comment on lines +44 to +46
'& tbody tr[data-disabled="true"]:hover': {
cursor: 'default',
},
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 table row is in the disabled state, remove the cursor pointer

Comment on lines +24 to +28
export type IExtendedCellProps<T extends object = {}> = CellProps<T> & { isLoading: boolean };

export interface ITableProps {
columns?: ColumnWithStrictAccessor<Data>[];
data?: Data[];
export type IExtendedColumn<T extends object = {}> = Column<T> & {
Cell?: (props: IExtendedCellProps<T>) => React.ReactNode;
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the column cell props types. Previously we were only passing the original object and the types were not working when we've been defining the table columns array. Passing only the original object was limiting us, so I've changed it to what the actual library provides + plus additional props like isLoading.

{
accessor: 'name',
Header: 'Name',
Cell: ({ name }: any) => (
<Tooltip label={name}>
Cell: withCellLoading(({ row: { original } }) => (
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 we do override the Cell and want to have a skeleton we would have to wrap the component with the HOC for loading, otherwise we would have to handle the loading state manually, in some cases, it might be useful, for ex. if you want to show the different loading skeletons.

},
{
accessor: 'createdAt',
Header: 'Created At',
Cell: ({ createdAt }: any) => format(new Date(createdAt), 'dd/MM/yyyy HH:mm'),
Cell: withCellLoading(({ row: { original } }) => format(new Date(original.createdAt ?? ''), 'dd/MM/yyyy HH:mm')),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

now the types are fixed and we don't need to use any anymore 🎉

@@ -154,40 +157,39 @@ export function LayoutsListPage({ handleLayoutAnalytics }: LayoutsListPageProps)
<LayoutEditor goBack={goBack} />
</When>
<When truthy={activeScreen === ActivePageEnum.LAYOUTS_LIST}>
<LoadingOverlay visible={isLoading || isLoadingDelete}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed the loading overlay as the table will show the loading state

@@ -49,79 +48,85 @@ export const ChangesTable = ({
});
}, [error]);

const columns: ColumnWithStrictAccessor<Data>[] = [
const columns: IExtendedColumn<any>[] = [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

wasn't able to find the type

Comment on lines 61 to 63
if (isLoading) {
return null;
}
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 statement to outside

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should show a spinner or something if it takes long time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, we can have a loading overlay that we do show everywhere currently :)

@LetItRock LetItRock force-pushed the nv-2425-refactor-table-with-skeleton-loading branch from 5b527c5 to 3227b83 Compare June 20, 2023 16:14
@@ -18,7 +18,7 @@ import LoginPage from './pages/auth/LoginPage';
import SignUpPage from './pages/auth/SignUpPage';
import HomePage from './pages/HomePage';
import TemplateEditorPage from './pages/templates/editor/TemplateEditorPage';
import NotificationList from './pages/templates/TemplatesListPage';
import WorkflowListPage from './pages/templates/WorkflowListPage';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

and renamed this one :P

@@ -25,6 +25,14 @@ interface IChannelDefinition {
type: NodeTypeEnum;
}

export const CHANNEL_TYPE_TO_STRING: Record<ChannelTypeEnum, string> = {
Copy link
Contributor

Choose a reason for hiding this comment

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

is it possible to use this one inside of WorkflowNode as well so we have this mapping only once?

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, just need to lower-case it in the WorkflowNode

Copy link
Contributor

@davidsoderberg davidsoderberg left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@LetItRock LetItRock added this pull request to the merge queue Jun 21, 2023
Merged via the queue into next with commit 4c3e90e Jun 21, 2023
32 checks passed
@LetItRock LetItRock deleted the nv-2425-refactor-table-with-skeleton-loading branch June 21, 2023 09:33
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