ral-facilities / inventory-management-system

Apache License 2.0
2 stars 0 forks source link

No catalogue items message off centred when loading/using cached results #180

Closed joshuadkitenge closed 3 days ago

joshuadkitenge commented 11 months ago

categoryItemsTableFormattingChange Not sure why but the position of the no results text changes when the error is shown.

_Originally posted by @joelvdavies in https://github.com/ral-facilities/inventory-management-system/pull/177#discussion_r1422594143_

joelvdavies commented 11 months ago

Another alternative I just found is using a custom component to force it to the center e.g.

    renderEmptyRowsFallback: (props) => {
      return (
        <Box justifyContent="center" alignItems="center" textAlign="center">
          {noResultsTxt}
        </Box>
      );
    },

The styling would need some slight adjusting though, e.g. the text colour would probably need to be text.secondary to get the lighter grey. Then we can at least keep the same component, and the centering will need to be via the window width instead of the table width to avoid image

joelvdavies commented 11 months ago

We managed to trace it to enableTopToolbar: false - A value of undefined defaults to true which works fine, but with a value of false it breaks. The above comment can fix it partially however while loading the message reverts back to the default component with the same issue so its not a suitable solution. The catalogueCategoryTableView is fine, even though it too has a value of false. Ultimately it appears to be due to this line in MRT https://github.com/KevinVandy/material-react-table/blob/e6531fcd287fae2d4e39aba930be256a3a75453a/packages/material-react-table/src/body/MRT_TableBody.tsx#L260.

joshuadkitenge commented 3 days ago

not an issue anymore as we use TopToolbar in all tables

joelvdavies commented 2 days ago

@joshuadkitenge It's still in the dense items table or is that fixed as well now?

joshuadkitenge commented 2 days ago

The items dense table isn't used anywhere. The dense view was meant to be use for the items table in systems. I don't think it worth removing. I know another feature I can use this view for later.

joelvdavies commented 2 days ago

The items dense table isn't used anywhere. The dense view was meant to be use for the items table in systems. I don't think it worth removing. I know another feature I can use this view for later.

Sure as long as we don't forget about this if we use it again. It may be fixed by MRT at some point and then we can be sure.