Minor fixes to gift card list (#2218)
* Fix paginator interface * Fix link to product * Fix dropdown in gift card tags * Do not pass trash to components
This commit is contained in:
parent
f5f309d38f
commit
8e2a3e0c75
9 changed files with 32 additions and 22 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -27216,7 +27216,7 @@
|
||||||
"request-progress": {
|
"request-progress": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/request-progress/-/request-progress-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/request-progress/-/request-progress-3.0.0.tgz",
|
||||||
"integrity": "sha1-TKdUCBx/7GP1BeT6qCWqBs1mnb4=",
|
"integrity": "sha512-MnWzEHHaxHO2iWiQuHrUPBi/1WeBf5PkxQqNyNvLl9VAYSdXkP8tQ3pBSeCPD+yw0v0Aq1zosWLz0BdeXpWwZg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"throttleit": "^1.0.0"
|
"throttleit": "^1.0.0"
|
||||||
|
|
|
@ -235,7 +235,7 @@ const MultiAutocompleteSelectFieldComponent: React.FC<MultiAutocompleteSelectFie
|
||||||
open={isOpen}
|
open={isOpen}
|
||||||
style={{
|
style={{
|
||||||
width: anchor.current.clientWidth,
|
width: anchor.current.clientWidth,
|
||||||
zIndex: 10,
|
zIndex: 1301,
|
||||||
}}
|
}}
|
||||||
placement={popperPlacement}
|
placement={popperPlacement}
|
||||||
>
|
>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { makeStyles } from "@saleor/macaw-ui";
|
||||||
const useStyles = makeStyles(
|
const useStyles = makeStyles(
|
||||||
theme => ({
|
theme => ({
|
||||||
popper: {
|
popper: {
|
||||||
zIndex: 11,
|
zIndex: 1302,
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
// TO-FIX
|
// TO-FIX
|
||||||
|
|
|
@ -36,15 +36,15 @@ export const TablePaginationWithContext = (
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { prevPageHref, nextPageHref } = paginationProps;
|
const { nextHref, prevHref } = paginationProps;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TablePagination
|
<TablePagination
|
||||||
{...props}
|
{...props}
|
||||||
|
nextHref={nextHref}
|
||||||
hasNextPage={hasNextPage}
|
hasNextPage={hasNextPage}
|
||||||
|
prevHref={prevHref}
|
||||||
hasPreviousPage={hasPreviousPage}
|
hasPreviousPage={hasPreviousPage}
|
||||||
prevHref={prevPageHref}
|
|
||||||
nextHref={nextPageHref}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -309,8 +309,8 @@ export const paginatorContextValues: PaginatorContextValues = {
|
||||||
startCursor: "",
|
startCursor: "",
|
||||||
hasNextPage: false,
|
hasNextPage: false,
|
||||||
hasPreviousPage: false,
|
hasPreviousPage: false,
|
||||||
nextPageHref: "",
|
nextHref: "",
|
||||||
prevPageHref: "",
|
prevHref: "",
|
||||||
paginatorType: "link",
|
paginatorType: "link",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -64,10 +64,6 @@ const GiftCardsListTable: React.FC = () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const onLinkClick: React.MouseEventHandler = event => {
|
|
||||||
event.stopPropagation();
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
<GiftCardListSearchAndFilters />
|
<GiftCardListSearchAndFilters />
|
||||||
|
@ -141,9 +137,13 @@ const GiftCardsListTable: React.FC = () => {
|
||||||
{product ? (
|
{product ? (
|
||||||
<TableButtonWrapper>
|
<TableButtonWrapper>
|
||||||
<PillLink
|
<PillLink
|
||||||
|
className={classes.pill}
|
||||||
component={RouterLink}
|
component={RouterLink}
|
||||||
to={productUrl(product?.id)}
|
to={productUrl(product?.id)}
|
||||||
onClick={onLinkClick}
|
onClick={event => {
|
||||||
|
event.stopPropagation();
|
||||||
|
navigate(productUrl(product?.id));
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{product?.name}
|
{product?.name}
|
||||||
</PillLink>
|
</PillLink>
|
||||||
|
|
|
@ -101,7 +101,7 @@ const GiftCardsListTableHeader: React.FC<GiftCardsListTableHeaderProps> = ({
|
||||||
<col />
|
<col />
|
||||||
<col className={classes.colCardCode} />
|
<col className={classes.colCardCode} />
|
||||||
<col className={classes.colBase} />
|
<col className={classes.colBase} />
|
||||||
<col className={classes.colBase} />
|
<col className={classes.colProduct} />
|
||||||
<col className={classes.colBase} />
|
<col className={classes.colBase} />
|
||||||
<col className={classes.colBalance} />
|
<col className={classes.colBalance} />
|
||||||
<col className={classes.colDelete} />
|
<col className={classes.colDelete} />
|
||||||
|
|
|
@ -16,9 +16,19 @@ export const useTableStyles = makeStyles(
|
||||||
colBalance: {
|
colBalance: {
|
||||||
width: 135,
|
width: 135,
|
||||||
},
|
},
|
||||||
|
colProduct: {
|
||||||
|
width: 250,
|
||||||
|
},
|
||||||
colBase: {
|
colBase: {
|
||||||
width: 150,
|
width: 150,
|
||||||
},
|
},
|
||||||
|
pill: {
|
||||||
|
display: "block",
|
||||||
|
textOverflow: "ellipsis",
|
||||||
|
whiteSpace: "nowrap",
|
||||||
|
maxWidth: "min-content",
|
||||||
|
overflow: "hidden",
|
||||||
|
},
|
||||||
row: {
|
row: {
|
||||||
cursor: "pointer",
|
cursor: "pointer",
|
||||||
height: 70,
|
height: 70,
|
||||||
|
|
|
@ -60,7 +60,7 @@ function usePaginator({
|
||||||
[paginationState, pageInfo],
|
[paginationState, pageInfo],
|
||||||
);
|
);
|
||||||
|
|
||||||
const nextPageHref = useMemo(() => {
|
const nextHref = useMemo(() => {
|
||||||
if (!newPageInfo?.hasNextPage || !pageInfo?.endCursor) {
|
if (!newPageInfo?.hasNextPage || !pageInfo?.endCursor) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ function usePaginator({
|
||||||
);
|
);
|
||||||
}, [pageInfo?.endCursor, newPageInfo?.hasNextPage, queryString]);
|
}, [pageInfo?.endCursor, newPageInfo?.hasNextPage, queryString]);
|
||||||
|
|
||||||
const prevPageHref = useMemo(() => {
|
const prevHref = useMemo(() => {
|
||||||
if (!newPageInfo?.hasPreviousPage || !pageInfo?.startCursor) {
|
if (!newPageInfo?.hasPreviousPage || !pageInfo?.startCursor) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -90,8 +90,8 @@ function usePaginator({
|
||||||
}, [pageInfo?.startCursor, newPageInfo?.hasPreviousPage, queryString]);
|
}, [pageInfo?.startCursor, newPageInfo?.hasPreviousPage, queryString]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
nextPageHref,
|
nextHref,
|
||||||
prevPageHref,
|
prevHref,
|
||||||
paginatorType: "link" as const,
|
paginatorType: "link" as const,
|
||||||
...newPageInfo,
|
...newPageInfo,
|
||||||
};
|
};
|
||||||
|
@ -110,15 +110,15 @@ export type PaginatorContextValues = PaginatorContextValuesCommon &
|
||||||
(
|
(
|
||||||
| {
|
| {
|
||||||
paginatorType: "link";
|
paginatorType: "link";
|
||||||
nextPageHref?: string;
|
nextHref?: string;
|
||||||
prevPageHref?: string;
|
prevHref?: string;
|
||||||
loadNextPage?: never;
|
loadNextPage?: never;
|
||||||
loadPreviousPage?: never;
|
loadPreviousPage?: never;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
paginatorType: "click";
|
paginatorType: "click";
|
||||||
nextPageHref?: never;
|
nextHref?: never;
|
||||||
prevPageHref?: never;
|
prevHref?: never;
|
||||||
loadNextPage: () => void;
|
loadNextPage: () => void;
|
||||||
loadPreviousPage: () => void;
|
loadPreviousPage: () => void;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue