Skip to content

Commit

Permalink
Fix non interactive book controls
Browse files Browse the repository at this point in the history
  • Loading branch information
Reckless-Satoshi committed Nov 17, 2022
1 parent 74364fd commit 19796c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
6 changes: 2 additions & 4 deletions frontend/src/components/BookTable/BookControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const BookControl = ({
</Grid>
) : null}

{width > mediumToolbarWidth && window.NativeRobosats === undefined ? (
{width > mediumToolbarWidth ? (
<Grid item>
<AutocompletePayments
sx={{
Expand Down Expand Up @@ -176,9 +176,7 @@ const BookControl = ({
</Grid>
) : 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) ||
window.NativeRobosats != undefined ? (
{width > smallestToolbarWidth && width < mediumToolbarWidth ? (
<Grid item>
<Select
sx={{
Expand Down
27 changes: 12 additions & 15 deletions frontend/src/components/BookTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 components: GridComponentProps = {
LoadingOverlay: LinearProgress,
Expand All @@ -721,7 +707,7 @@ const BookTable = ({
components.Footer = Footer;
}
if (showControls) {
components.Toolbar = Controls;
components.Toolbar = BookControl;
}
return components;
};
Expand Down Expand Up @@ -753,6 +739,17 @@ const BookTable = ({
columns={columns}
hideFooter={!showFooter}
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}
rowsPerPageOptions={width < 22 ? [] : [0, pageSize, defaultPageSize * 2, 50, 100]}
onPageSizeChange={(newPageSize) => {
Expand Down

0 comments on commit 19796c7

Please sign in to comment.