Fix non interactive book controls

This commit is contained in:
Reckless_Satoshi 2022-11-17 12:24:55 -08:00
parent 74364fd522
commit 19796c7c50
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
2 changed files with 14 additions and 19 deletions

View File

@ -148,7 +148,7 @@ const BookControl = ({
</Grid> </Grid>
) : null} ) : null}
{width > mediumToolbarWidth && window.NativeRobosats === undefined ? ( {width > mediumToolbarWidth ? (
<Grid item> <Grid item>
<AutocompletePayments <AutocompletePayments
sx={{ sx={{
@ -176,9 +176,7 @@ const BookControl = ({
</Grid> </Grid>
) : null} ) : null}
{/* Native Android app must always show the Select, as the on display keyboard does not play well with the book table component */} {width > smallestToolbarWidth && width < mediumToolbarWidth ? (
{(width > smallestToolbarWidth && width < mediumToolbarWidth) ||
window.NativeRobosats != undefined ? (
<Grid item> <Grid item>
<Select <Select
sx={{ sx={{

View File

@ -694,20 +694,6 @@ const BookTable = ({
); );
}; };
const Controls = function () {
return (
<BookControl
width={width}
type={fav.type}
currency={fav.currency}
onCurrencyChange={onCurrencyChange}
onTypeChange={onTypeChange}
paymentMethod={paymentMethods}
setPaymentMethods={setPaymentMethods}
/>
);
};
const gridComponents = function () { const gridComponents = function () {
const components: GridComponentProps = { const components: GridComponentProps = {
LoadingOverlay: LinearProgress, LoadingOverlay: LinearProgress,
@ -721,7 +707,7 @@ const BookTable = ({
components.Footer = Footer; components.Footer = Footer;
} }
if (showControls) { if (showControls) {
components.Toolbar = Controls; components.Toolbar = BookControl;
} }
return components; return components;
}; };
@ -753,6 +739,17 @@ const BookTable = ({
columns={columns} columns={columns}
hideFooter={!showFooter} hideFooter={!showFooter}
components={gridComponents()} components={gridComponents()}
componentsProps={{
toolbar: {
width,
type: fav.type,
currency: fav.currency,
onCurrencyChange,
onTypeChange,
paymentMethod: paymentMethods,
setPaymentMethods,
},
}}
pageSize={book.loading && book.orders.length == 0 ? 0 : pageSize} pageSize={book.loading && book.orders.length == 0 ? 0 : pageSize}
rowsPerPageOptions={width < 22 ? [] : [0, pageSize, defaultPageSize * 2, 50, 100]} rowsPerPageOptions={width < 22 ? [] : [0, pageSize, defaultPageSize * 2, 50, 100]}
onPageSizeChange={(newPageSize) => { onPageSizeChange={(newPageSize) => {