Skip to content

OBPIH-6845 Create table component all products tab#4982

Merged
awalkowiak merged 18 commits intodevelopfrom
OBPIH-6845
Dec 19, 2024
Merged

OBPIH-6845 Create table component all products tab#4982
awalkowiak merged 18 commits intodevelopfrom
OBPIH-6845

Conversation

@alannadolny
Copy link
Collaborator

No description provided.

@alannadolny alannadolny self-assigned this Dec 17, 2024
@github-actions github-actions bot added domain: frontend Changes or discussions relating to the frontend UI domain: l10n Changes or discussions relating to localization & Internationalization labels Dec 17, 2024
@codecov
Copy link

codecov bot commented Dec 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 7.68%. Comparing base (c805f61) to head (78dad16).
Report is 149 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff              @@
##             develop   #4982      +/-   ##
============================================
+ Coverage       7.60%   7.68%   +0.07%     
- Complexity       817     834      +17     
============================================
  Files            601     601              
  Lines          42342   42355      +13     
  Branches       10284   10289       +5     
============================================
+ Hits            3222    3254      +32     
+ Misses         38652   38621      -31     
- Partials         468     480      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@kchelstowski kchelstowski left a comment

Choose a reason for hiding this comment

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

Well done 👏

className={`rt-th ${className}`}
>
{children}
{sortable && (
Copy link
Collaborator

Choose a reason for hiding this comment

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

just out of curiosity - how was it hidden in the old version?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there was additional styling applied, but I think the current version is much more straightforward

defaultMessage={
emptyTableMessage?.defaultMessage || defaultEmptyTableMessage.defaultMessage
}
shouldDisplay={!dataLength && !loading}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't mind doing it this way, but the way I would prefer is to conditionally render those, so:

{(!dataLength && !loading) && <DataTableStatus .... />}
{loading && <DataTableStatus />}

but it's not a change request

const data = [
{
// other properties
lastCountDate: '12/11/2024',
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't expect you to waste time to change that now, especially that the backend is almost ready, but this property will be named dateLastCounted

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, it will be changed when integrating with the backend

</TableCell>
),
}),
], []);
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't translate be the dependency here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can add it, but I am not sure how it will work, because translate is a function, so I don't think it will be working properly, it should rather be a selected language

Copy link
Collaborator

@kchelstowski kchelstowski Dec 18, 2024

Choose a reason for hiding this comment

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

good point, I forgot that translate is a function. I think it's good to investigate places where we put it in the dependency, as we might have some unexpected rerenders there (still it's better to have it, than not to have it, as we would have a bug). And yeah, selected language is the option here.


import { getCoreRowModel, getPaginationRowModel, useReactTable } from '@tanstack/react-table';

const useDataTable = ({ pageSize, columns, data }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we have two similar hooks now - useTableData and useDataTable - can we easily say what the differences are and maybe come up with a better name for this one?
P.S. I don't expect you to explain it to me, because I see the difference, but I rather meant when someone tackled this for the first time and started wondering what the differences are.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't have any better idea for this hook

@awalkowiak awalkowiak merged commit dfade8c into develop Dec 19, 2024
@awalkowiak awalkowiak deleted the OBPIH-6845 branch December 19, 2024 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: frontend Changes or discussions relating to the frontend UI domain: l10n Changes or discussions relating to localization & Internationalization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants