feat(dashboard,draft-order): Remove hardcoded strings and replace with translations in draft orders list page (#14400)
## Summary
**What** — What changes are introduced in this PR?
Add translations management to draft orders list page.
**Why** — Why are these changes relevant or necessary?
We were using hardcoded English strings.
**How** — How have these changes been implemented?
Remove hardcoded strings and replace them with dynamic translations.
**Testing** — How have these changes been tested, or how can the reviewer test the feature?
*Please provide answer here*
---
## Examples
Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.
This helps with documentation and ensures maintainers can quickly understand and verify the change.
```ts
// Example usage
```
---
## Checklist
Please ensure the following before requesting a review:
- [x] I have added a **changeset** for this PR
- Every non-breaking change should be marked as a **patch**
- To add a changeset, run `yarn changeset` and follow the prompts
- [ ] The changes are covered by relevant **tests**
- [x] I have verified the code works as intended locally
- [x] I have linked the related issue(s) if applicable
---
## Additional Context
Add any additional context, related issues, or references that might help the reviewer understand this PR.
closes #14377
This commit is contained in:
6
.changeset/smart-kiwis-fold.md
Normal file
6
.changeset/smart-kiwis-fold.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@medusajs/draft-order": patch
|
||||
"@medusajs/dashboard": patch
|
||||
---
|
||||
|
||||
feat(dashboard,draft-order): Remove hardcoded strings and replace with translations in draft orders list page
|
||||
@@ -5860,6 +5860,32 @@
|
||||
"required": ["open", "completed"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"list": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"noRecordsMessage": {
|
||||
"type": "string"
|
||||
},
|
||||
"filtered": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"heading": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["heading", "description"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": ["description", "noRecordsMessage", "filtered"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"create": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -1569,6 +1569,14 @@
|
||||
"sendNotificationLabel": "Send notification",
|
||||
"sendNotificationHint": "Send a notification to the customer when the draft order is created."
|
||||
},
|
||||
"list": {
|
||||
"noRecordsMessage": "No draft orders found",
|
||||
"description": "Create a new draft order to get started.",
|
||||
"filtered": {
|
||||
"heading": "No results found",
|
||||
"description": "No draft orders match your filter criteria."
|
||||
}
|
||||
},
|
||||
"validation": {
|
||||
"requiredEmailOrCustomer": "Email or customer is required.",
|
||||
"requiredItems": "At least one item is required.",
|
||||
|
||||
@@ -1504,6 +1504,14 @@
|
||||
},
|
||||
"draftOrders": {
|
||||
"domain": "Pedidos Borradores",
|
||||
"list": {
|
||||
"description": "Crea un nuevo pedido borrador para empezar.",
|
||||
"noRecordsMessage": "No se encontraron pedidos borradores",
|
||||
"filtered": {
|
||||
"heading": "No se encontraron resultados",
|
||||
"description": "No hay pedidos borradores que coincidan con los criterios de filtro."
|
||||
}
|
||||
},
|
||||
"deleteWarning": "Estás a punto de eliminar el pedido borrador {{id}}. Esta acción no puede deshacerse.",
|
||||
"paymentLinkLabel": "Enlace de pago",
|
||||
"cartIdLabel": "ID del carrito",
|
||||
|
||||
@@ -18,6 +18,7 @@ import { useSalesChannels } from "../../hooks/api/sales-channels"
|
||||
import { useDataTableDateFilters } from "../../hooks/common/use-data-table-date-filters"
|
||||
import { useQueryParams } from "../../hooks/common/use-query-params"
|
||||
import { getFullDate } from "../../lib/utils/date-utils"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
const PAGE_SIZE = 20
|
||||
|
||||
@@ -26,6 +27,7 @@ export const handle = {
|
||||
}
|
||||
|
||||
const List = () => {
|
||||
const { t } = useTranslation()
|
||||
const queryParams = useDraftOrderTableQuery({
|
||||
pageSize: PAGE_SIZE,
|
||||
})
|
||||
@@ -60,20 +62,20 @@ const List = () => {
|
||||
isLoading={isPending}
|
||||
pageSize={PAGE_SIZE}
|
||||
rowCount={count}
|
||||
heading="Draft Orders"
|
||||
heading={t("draftOrders.domain")}
|
||||
action={{
|
||||
label: "Create",
|
||||
label: t("actions.create"),
|
||||
to: "create",
|
||||
}}
|
||||
rowHref={(row) => `${row.id}`}
|
||||
emptyState={{
|
||||
empty: {
|
||||
heading: "No draft orders found",
|
||||
description: "Create a new draft order to get started.",
|
||||
heading: t("draftOrders.list.noRecordsMessage"),
|
||||
description: t("draftOrders.list.description"),
|
||||
},
|
||||
filtered: {
|
||||
heading: "No results found",
|
||||
description: "No draft orders match your filter criteria.",
|
||||
heading: t("draftOrders.list.filtered.heading"),
|
||||
description: t("draftOrders.list.filtered.description"),
|
||||
},
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user