Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dashboard): Migrate Return Reasons table to DataTable #11140

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions packages/admin/dashboard/src/hooks/api/return-reasons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,30 @@ export const useDeleteReturnReason = (
...options,
})
}

export const useDeleteReturnReasonLazy = (
options?: UseMutationOptions<
HttpTypes.AdminReturnReasonDeleteResponse,
FetchError,
string
>
) => {
return useMutation({
mutationFn: (id) => sdk.admin.returnReason.delete(id),
onSuccess: (data, variables, context) => {
queryClient.invalidateQueries({
queryKey: returnReasonsQueryKeys.lists(),
})
queryClient.invalidateQueries({
queryKey: returnReasonsQueryKeys.detail(variables),
})

queryClient.invalidateQueries({
queryKey: returnReasonsQueryKeys.details(),
})

options?.onSuccess?.(data, variables, context)
},
...options,
})
}
2 changes: 0 additions & 2 deletions packages/admin/dashboard/src/hooks/table/columns/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ export * from "./use-product-table-columns"
export * from "./use-product-tag-table-columns"
export * from "./use-product-type-table-columns"
export * from "./use-region-table-columns"
export * from "./use-return-reason-table-columns"
export * from "./use-sales-channel-table-columns"
export * from "./use-tax-rates-table-columns"

This file was deleted.

1 change: 0 additions & 1 deletion packages/admin/dashboard/src/hooks/table/query/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export * from "./use-product-table-query"
export * from "./use-product-tag-table-query"
export * from "./use-product-type-table-query"
export * from "./use-region-table-query"
export * from "./use-return-reason-table-query"
export * from "./use-sales-channel-table-query"
export * from "./use-shipping-option-table-query"
export * from "./use-tax-rate-table-query"
Expand Down

This file was deleted.

34 changes: 34 additions & 0 deletions packages/admin/dashboard/src/i18n/translations/$schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -9528,6 +9528,39 @@
"subtitle": {
"type": "string"
},
"list": {
"type": "object",
"properties": {
"empty": {
"type": "object",
"properties": {
"heading": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": ["heading", "description"],
"additionalProperties": false
},
"filtered": {
"type": "object",
"properties": {
"heading": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": ["heading", "description"],
"additionalProperties": false
}
},
"required": ["empty", "filtered"],
"additionalProperties": false
},
"calloutHint": {
"type": "string"
},
Expand Down Expand Up @@ -9635,6 +9668,7 @@
"required": [
"domain",
"subtitle",
"list",
"calloutHint",
"editReason",
"create",
Expand Down
10 changes: 10 additions & 0 deletions packages/admin/dashboard/src/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2556,6 +2556,16 @@
"returnReasons": {
"domain": "Return Reasons",
"subtitle": "Manage reasons for returned items.",
"list": {
"empty": {
"heading": "No return reasons",
"description": "There are no return reasons to display."
},
"filtered": {
"heading": "No results",
"description": "No return reasons match the current filter criteria."
}
},
"calloutHint": "Manage the reasons to categorize returns.",
"editReason": "Edit Return Reason",
"create": {
Expand Down

This file was deleted.

Loading
Loading