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:
Dominik Żegleń 2022-08-18 12:50:09 +02:00 committed by GitHub
parent f5f309d38f
commit 8e2a3e0c75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 32 additions and 22 deletions

2
package-lock.json generated
View file

@ -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"

View file

@ -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}
> >

View file

@ -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

View file

@ -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}
/> />
); );
}; };

View file

@ -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",
}; };

View file

@ -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>

View file

@ -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} />

View file

@ -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,

View file

@ -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;
} }