Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
final touches
Browse files Browse the repository at this point in the history
  • Loading branch information
olivermrbl committed Feb 2, 2022
1 parent 0cf54a8 commit 4fc9702
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 630 deletions.
4 changes: 4 additions & 0 deletions src/components/templates/order-table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ const OrderTable: React.FC<RouteComponentProps> = () => {
if (query) {
setFreeText(query)
gotoPage(0)
} else {
// if we delete query string, we reset the table view
reset()
}
}, 400)

Expand Down Expand Up @@ -120,6 +123,7 @@ const OrderTable: React.FC<RouteComponentProps> = () => {

const clearFilters = () => {
reset()
setQuery("")
}

useEffect(() => {
Expand Down
6 changes: 4 additions & 2 deletions src/components/templates/order-table/use-order-filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const reducer = (
payment: action.payload.payment,
status: action.payload.status,
date: action.payload.date,
query: action?.payload?.query,
}
}
case "setQuery": {
Expand Down Expand Up @@ -182,6 +183,7 @@ export const useOrderFilters = (
open: false,
filter: null,
},
query: null,
},
})
}
Expand All @@ -201,7 +203,7 @@ export const useOrderFilters = (
toQuery["q"] = value
} else if (key === "offset" || key === "limit") {
toQuery[key] = value
} else if (value.open) {
} else if (value?.open) {
if (key === "date") {
toQuery[stateFilterMap[key]] = formatDateFilter(
value.filter as OrderDateFilter
Expand All @@ -227,7 +229,7 @@ export const useOrderFilters = (
toQuery["q"] = value
} else if (key === "offset" || key === "limit") {
toQuery[key] = value
} else if (value.open) {
} else if (value?.open) {
toQuery[stateFilterMap[key]] = value.filter
}
}
Expand Down
Loading

0 comments on commit 4fc9702

Please sign in to comment.