Refactor staff section translations (#128)

This commit is contained in:
Dominik Żegleń 2019-08-26 23:43:29 +02:00 committed by dominik-zeglen
parent 81c6efc474
commit f3b04aef8a
11 changed files with 536 additions and 251 deletions

View file

@ -1,6 +1,6 @@
msgid "" msgid ""
msgstr "" msgstr ""
"POT-Creation-Date: 2019-08-26T21:32:40.783Z\n" "POT-Creation-Date: 2019-08-26T21:41:35.304Z\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -35,6 +35,22 @@ msgctxt "attribute value edit error"
msgid "A value named {name} already exists" msgid "A value named {name} already exists"
msgstr "" msgstr ""
#: build/locale/src/staff/components/StaffStatus/StaffStatus.json
#. [src.staff.components.StaffStatus.2183517419] - section header
#. defaultMessage is:
#. Account Status
msgctxt "section header"
msgid "Account Status"
msgstr ""
#: build/locale/src/staff/components/StaffList/StaffList.json
#. [src.staff.components.StaffList.3247064221] - staff member status
#. defaultMessage is:
#. Active
msgctxt "staff member status"
msgid "Active"
msgstr ""
#: build/locale/src/discounts/components/VoucherDates/VoucherDates.json #: build/locale/src/discounts/components/VoucherDates/VoucherDates.json
#. [src.discounts.components.VoucherDates.1662220323] - time during voucher is active, header #. [src.discounts.components.VoucherDates.1662220323] - time during voucher is active, header
#. defaultMessage is: #. defaultMessage is:
@ -131,6 +147,14 @@ msgctxt "button"
msgid "Add Sale" msgid "Add Sale"
msgstr "" msgstr ""
#: build/locale/src/staff/components/StaffAddMemberDialog/StaffAddMemberDialog.json
#. [src.staff.components.StaffAddMemberDialog.3490059488] - dialog header
#. defaultMessage is:
#. Add Staff Member
msgctxt "dialog header"
msgid "Add Staff Member"
msgstr ""
#: build/locale/src/attributes/components/AttributeValueEditDialog/AttributeValueEditDialog.json #: build/locale/src/attributes/components/AttributeValueEditDialog/AttributeValueEditDialog.json
#. [src.attributes.components.AttributeValueEditDialog.1841790893] - add attribute value #. [src.attributes.components.AttributeValueEditDialog.1841790893] - add attribute value
#. defaultMessage is: #. defaultMessage is:
@ -343,6 +367,14 @@ msgctxt "button"
msgid "Add shipping zone" msgid "Add shipping zone"
msgstr "" msgstr ""
#: build/locale/src/staff/components/StaffListPage/StaffListPage.json
#. [src.staff.components.StaffListPage.802625341] - button
#. defaultMessage is:
#. Add staff member
msgctxt "button"
msgid "Add staff member"
msgstr ""
#: build/locale/src/categories/components/CategoryList/CategoryList.json #: build/locale/src/categories/components/CategoryList/CategoryList.json
#. [src.categories.components.CategoryList.435697837] - button #. [src.categories.components.CategoryList.435697837] - button
#. defaultMessage is: #. defaultMessage is:
@ -895,6 +927,22 @@ msgctxt "unassign country"
msgid "Are you sure you want to remove {countryName} from this shipping zone?" msgid "Are you sure you want to remove {countryName} from this shipping zone?"
msgstr "" msgstr ""
#: build/locale/src/staff/views/StaffDetails.json
#. [src.staff.views.3945766678]
#. defaultMessage is:
#. Are you sure you want to remove {email} avatar?
msgctxt "description"
msgid "Are you sure you want to remove {email} avatar?"
msgstr ""
#: build/locale/src/staff/views/StaffDetails.json
#. [src.staff.views.2728048444]
#. defaultMessage is:
#. Are you sure you want to remove {email} from staff members?
msgctxt "description"
msgid "Are you sure you want to remove {email} from staff members?"
msgstr ""
#: build/locale/src/productTypes/components/ProductTypeAttributeUnassignDialog/ProductTypeAttributeUnassignDialog.json #: build/locale/src/productTypes/components/ProductTypeAttributeUnassignDialog/ProductTypeAttributeUnassignDialog.json
#. [src.productTypes.components.ProductTypeAttributeUnassignDialog.722498450] #. [src.productTypes.components.ProductTypeAttributeUnassignDialog.722498450]
#. defaultMessage is: #. defaultMessage is:
@ -1423,6 +1471,14 @@ msgctxt "description"
msgid "Category name" msgid "Category name"
msgstr "" msgstr ""
#: build/locale/src/staff/components/StaffProperties/StaffProperties.json
#. [src.staff.components.StaffProperties.2771097267] - button
#. defaultMessage is:
#. Change photo
msgctxt "button"
msgid "Change photo"
msgstr ""
#: build/locale/src/products/views/ProductList/ProductList.json #: build/locale/src/products/views/ProductList/ProductList.json
#. [src.products.views.ProductList.224127438] - product status update notification #. [src.products.views.ProductList.224127438] - product status update notification
#. defaultMessage is: #. defaultMessage is:
@ -2219,6 +2275,14 @@ msgctxt "dialog header"
msgid "Delete Shipping Zones" msgid "Delete Shipping Zones"
msgstr "" msgstr ""
#: build/locale/src/staff/views/StaffDetails.json
#. [src.staff.views.701332676] - dialog header
#. defaultMessage is:
#. Delete Staff User Avatar
msgctxt "dialog header"
msgid "Delete Staff User Avatar"
msgstr ""
#: build/locale/src/products/components/ProductVariantCreatePage/ProductVariantCreatePage.json #: build/locale/src/products/components/ProductVariantCreatePage/ProductVariantCreatePage.json
#. [src.products.components.ProductVariantCreatePage.3726089650] - button #. [src.products.components.ProductVariantCreatePage.3726089650] - button
#. defaultMessage is: #. defaultMessage is:
@ -2351,6 +2415,14 @@ msgctxt "dialog header"
msgid "Delete menus" msgid "Delete menus"
msgstr "" msgstr ""
#: build/locale/src/staff/components/StaffProperties/StaffProperties.json
#. [src.staff.components.StaffProperties.457748370] - button
#. defaultMessage is:
#. Delete photo
msgctxt "button"
msgid "Delete photo"
msgstr ""
#: build/locale/src/categories/views/CategoryDetails.json #: build/locale/src/categories/views/CategoryDetails.json
#. [src.categories.views.2507763081] - dialog title #. [src.categories.views.2507763081] - dialog title
#. defaultMessage is: #. defaultMessage is:
@ -2627,6 +2699,14 @@ msgctxt "section header"
msgid "Eligible Products" msgid "Eligible Products"
msgstr "" msgstr ""
#: build/locale/src/staff/components/StaffList/StaffList.json
#. [src.staff.components.StaffList.1789607185]
#. defaultMessage is:
#. Email Address
msgctxt "description"
msgid "Email Address"
msgstr ""
#: build/locale/src/intl.json #: build/locale/src/intl.json
#. [src.endDate] #. [src.endDate]
#. defaultMessage is: #. defaultMessage is:
@ -2667,6 +2747,22 @@ msgctxt "description"
msgid "Enter any extra infotmation regarding this customer." msgid "Enter any extra infotmation regarding this customer."
msgstr "" msgstr ""
#: build/locale/src/staff/components/StaffPermissions/StaffPermissions.json
#. [src.staff.components.StaffPermissions.3639008725]
#. defaultMessage is:
#. Expand or restrict user's permissions to access certain part of saleor system.
msgctxt "description"
msgid "Expand or restrict user's permissions to access certain part of saleor system."
msgstr ""
#: build/locale/src/staff/components/StaffAddMemberDialog/StaffAddMemberDialog.json
#. [src.staff.components.StaffAddMemberDialog.351138560]
#. defaultMessage is:
#. Expand or restrict users permissions to access certain part of saleor system.
msgctxt "description"
msgid "Expand or restrict users permissions to access certain part of saleor system."
msgstr ""
#: build/locale/src/collections/components/CollectionDetailsPage/CollectionDetailsPage.json #: build/locale/src/collections/components/CollectionDetailsPage/CollectionDetailsPage.json
#. [src.collections.components.CollectionDetailsPage.2906897537] - switch button #. [src.collections.components.CollectionDetailsPage.2906897537] - switch button
#. defaultMessage is: #. defaultMessage is:
@ -2899,6 +2995,14 @@ msgctxt "description"
msgid "If this option is disabled, discount will be counted for every eligible product" msgid "If this option is disabled, discount will be counted for every eligible product"
msgstr "" msgstr ""
#: build/locale/src/staff/components/StaffStatus/StaffStatus.json
#. [src.staff.components.StaffStatus.2683780981]
#. defaultMessage is:
#. If you want to disable this account uncheck the box below
msgctxt "description"
msgid "If you want to disable this account uncheck the box below"
msgstr ""
#: build/locale/src/products/components/ProductVariantImageSelectDialog/ProductVariantImageSelectDialog.json #: build/locale/src/products/components/ProductVariantImageSelectDialog/ProductVariantImageSelectDialog.json
#. [src.products.components.ProductVariantImageSelectDialog.3196043669] - dialog header #. [src.products.components.ProductVariantImageSelectDialog.3196043669] - dialog header
#. defaultMessage is: #. defaultMessage is:
@ -2919,6 +3023,14 @@ msgctxt "section header"
msgid "Images" msgid "Images"
msgstr "" msgstr ""
#: build/locale/src/staff/components/StaffList/StaffList.json
#. [src.staff.components.StaffList.1004218338] - staff member status
#. defaultMessage is:
#. Inactive
msgctxt "staff member status"
msgid "Inactive"
msgstr ""
#: build/locale/src/products/components/ProductStock/ProductStock.json #: build/locale/src/products/components/ProductStock/ProductStock.json
#. [productStockHeader] - product stock, section header #. [productStockHeader] - product stock, section header
#. defaultMessage is: #. defaultMessage is:
@ -3323,6 +3435,14 @@ msgctxt "shipping zone"
msgid "Name" msgid "Name"
msgstr "" msgstr ""
#: build/locale/src/staff/components/StaffList/StaffList.json
#. [src.staff.components.StaffList.636461959] - staff member full name
#. defaultMessage is:
#. Name
msgctxt "staff member full name"
msgid "Name"
msgstr ""
#: build/locale/src/siteSettings/components/SiteSettingsDetails/SiteSettingsDetails.json #: build/locale/src/siteSettings/components/SiteSettingsDetails/SiteSettingsDetails.json
#. [src.siteSettings.components.SiteSettingsDetails.2286355060] #. [src.siteSettings.components.SiteSettingsDetails.2286355060]
#. defaultMessage is: #. defaultMessage is:
@ -3591,6 +3711,14 @@ msgctxt "description"
msgid "No shipping zones found" msgid "No shipping zones found"
msgstr "" msgstr ""
#: build/locale/src/staff/components/StaffList/StaffList.json
#. [src.staff.components.StaffList.480166346]
#. defaultMessage is:
#. No staff members found
msgctxt "description"
msgid "No staff members found"
msgstr ""
#: build/locale/src/categories/components/CategoryList/CategoryList.json #: build/locale/src/categories/components/CategoryList/CategoryList.json
#. [src.categories.components.CategoryList.2155313053] #. [src.categories.components.CategoryList.2155313053]
#. defaultMessage is: #. defaultMessage is:
@ -4103,6 +4231,22 @@ msgctxt "voucher discount type"
msgid "Percentage" msgid "Percentage"
msgstr "" msgstr ""
#: build/locale/src/staff/components/StaffAddMemberDialog/StaffAddMemberDialog.json
#. [src.staff.components.StaffAddMemberDialog.2690176844]
#. defaultMessage is:
#. Permissions
msgctxt "description"
msgid "Permissions"
msgstr ""
#: build/locale/src/staff/components/StaffPermissions/StaffPermissions.json
#. [src.staff.components.StaffPermissions.2690176844] - dialog header
#. defaultMessage is:
#. Permissions
msgctxt "dialog header"
msgid "Permissions"
msgstr ""
#: build/locale/src/siteSettings/components/SiteSettingsAddress/SiteSettingsAddress.json #: build/locale/src/siteSettings/components/SiteSettingsAddress/SiteSettingsAddress.json
#. [src.siteSettings.components.SiteSettingsAddress.1271289966] #. [src.siteSettings.components.SiteSettingsAddress.1271289966]
#. defaultMessage is: #. defaultMessage is:
@ -4947,6 +5091,14 @@ msgctxt "description"
msgid "Selling price override" msgid "Selling price override"
msgstr "" msgstr ""
#: build/locale/src/staff/components/StaffAddMemberDialog/StaffAddMemberDialog.json
#. [src.staff.components.StaffAddMemberDialog.449055697] - button
#. defaultMessage is:
#. Send invite
msgctxt "button"
msgid "Send invite"
msgstr ""
#: build/locale/src/customers/components/CustomerAddress/CustomerAddress.json #: build/locale/src/customers/components/CustomerAddress/CustomerAddress.json
#. [src.customers.components.CustomerAddress.3096438859] - button #. [src.customers.components.CustomerAddress.3096438859] - button
#. defaultMessage is: #. defaultMessage is:
@ -5159,6 +5311,14 @@ msgctxt "description"
msgid "Specific Price" msgid "Specific Price"
msgstr "" msgstr ""
#: build/locale/src/staff/components/StaffProperties/StaffProperties.json
#. [src.staff.components.StaffProperties.2650522200] - section header
#. defaultMessage is:
#. Staff Member Information
msgctxt "section header"
msgid "Staff Member Information"
msgstr ""
#: build/locale/src/intl.json #: build/locale/src/intl.json
#. [src.staff] - staff section name #. [src.staff] - staff section name
#. defaultMessage is: #. defaultMessage is:
@ -6035,6 +6195,30 @@ msgctxt "check to mark this account as active"
msgid "User account active" msgid "User account active"
msgstr "" msgstr ""
#: build/locale/src/staff/components/StaffAddMemberDialog/StaffAddMemberDialog.json
#. [src.staff.components.StaffAddMemberDialog.1570990296]
#. defaultMessage is:
#. User has full access
msgctxt "description"
msgid "User has full access"
msgstr ""
#: build/locale/src/staff/components/StaffPermissions/StaffPermissions.json
#. [src.staff.components.StaffPermissions.1848599267] - checkbox label
#. defaultMessage is:
#. User has full access to the store
msgctxt "checkbox label"
msgid "User has full access to the store"
msgstr ""
#: build/locale/src/staff/components/StaffStatus/StaffStatus.json
#. [src.staff.components.StaffStatus.881953347] - checkbox label
#. defaultMessage is:
#. User is active
msgctxt "checkbox label"
msgid "User is active"
msgstr ""
#: build/locale/src/discounts/components/VoucherList/VoucherList.json #: build/locale/src/discounts/components/VoucherList/VoucherList.json
#. [src.discounts.components.VoucherList.3917820600] - voucher uses #. [src.discounts.components.VoucherList.3917820600] - voucher uses
#. defaultMessage is: #. defaultMessage is:
@ -6351,6 +6535,14 @@ msgctxt "product status is set as"
msgid "is set as" msgid "is set as"
msgstr "" msgstr ""
#: build/locale/src/staff/views/StaffDetails.json
#. [src.staff.views.2240444792] - dialog header
#. defaultMessage is:
#. remove Staff User
msgctxt "dialog header"
msgid "remove Staff User"
msgstr ""
#: build/locale/src/home/components/HomeProductListCard/HomeProductListCard.json #: build/locale/src/home/components/HomeProductListCard/HomeProductListCard.json
#. [homeProductListCardOrders] - number of ordered products #. [homeProductListCardOrders] - number of ordered products
#. defaultMessage is: #. defaultMessage is:

View file

@ -12,6 +12,7 @@ import {
import TextField from "@material-ui/core/TextField"; import TextField from "@material-ui/core/TextField";
import Typography from "@material-ui/core/Typography"; import Typography from "@material-ui/core/Typography";
import React from "react"; import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import ConfirmButton, { import ConfirmButton, {
ConfirmButtonTransitionState ConfirmButtonTransitionState
@ -19,7 +20,7 @@ import ConfirmButton, {
import { ControlledCheckbox } from "@saleor/components/ControlledCheckbox"; import { ControlledCheckbox } from "@saleor/components/ControlledCheckbox";
import Form from "@saleor/components/Form"; import Form from "@saleor/components/Form";
import FormSpacer from "@saleor/components/FormSpacer"; import FormSpacer from "@saleor/components/FormSpacer";
import i18n from "../../../i18n"; import { buttonMessages, commonMessages } from "@saleor/intl";
import { UserError } from "../../../types"; import { UserError } from "../../../types";
export interface FormData { export interface FormData {
@ -74,18 +75,26 @@ const StaffAddMemberDialog = withStyles(styles, {
open, open,
onClose, onClose,
onConfirm onConfirm
}: StaffAddMemberDialogProps) => ( }: StaffAddMemberDialogProps) => {
const intl = useIntl();
return (
<Dialog onClose={onClose} open={open}> <Dialog onClose={onClose} open={open}>
<Form errors={errors} initial={initialForm} onSubmit={onConfirm}> <Form errors={errors} initial={initialForm} onSubmit={onConfirm}>
{({ change, data, errors: formErrors, hasChanged }) => ( {({ change, data, errors: formErrors, hasChanged }) => (
<> <>
<DialogTitle>{i18n.t("Add Staff Member")}</DialogTitle> <DialogTitle>
<FormattedMessage
defaultMessage="Add Staff Member"
description="dialog header"
/>
</DialogTitle>
<DialogContent> <DialogContent>
<div className={classes.textFieldGrid}> <div className={classes.textFieldGrid}>
<TextField <TextField
error={!!formErrors.firstName} error={!!formErrors.firstName}
helperText={formErrors.firstName} helperText={formErrors.firstName}
label={i18n.t("First Name")} label={intl.formatMessage(commonMessages.firstName)}
name="firstName" name="firstName"
type="text" type="text"
value={data.firstName} value={data.firstName}
@ -94,7 +103,7 @@ const StaffAddMemberDialog = withStyles(styles, {
<TextField <TextField
error={!!formErrors.lastName} error={!!formErrors.lastName}
helperText={formErrors.lastName} helperText={formErrors.lastName}
label={i18n.t("Last Name")} label={intl.formatMessage(commonMessages.lastName)}
name="lastName" name="lastName"
type="text" type="text"
value={data.lastName} value={data.lastName}
@ -106,7 +115,7 @@ const StaffAddMemberDialog = withStyles(styles, {
error={!!formErrors.email} error={!!formErrors.email}
fullWidth fullWidth
helperText={formErrors.email} helperText={formErrors.email}
label={i18n.t("Email address")} label={intl.formatMessage(commonMessages.email)}
name="email" name="email"
type="email" type="email"
value={data.email} value={data.email}
@ -116,23 +125,23 @@ const StaffAddMemberDialog = withStyles(styles, {
<hr className={classes.hr} /> <hr className={classes.hr} />
<DialogContent> <DialogContent>
<Typography className={classes.sectionTitle}> <Typography className={classes.sectionTitle}>
{i18n.t("Permissions")} <FormattedMessage defaultMessage="Permissions" />
</Typography> </Typography>
<Typography> <Typography>
{i18n.t( <FormattedMessage defaultMessage="Expand or restrict users permissions to access certain part of saleor system." />
"Expand or restrict users permissions to access certain part of saleor system."
)}
</Typography> </Typography>
<ControlledCheckbox <ControlledCheckbox
checked={data.fullAccess} checked={data.fullAccess}
label={i18n.t("User has full access")} label={intl.formatMessage({
defaultMessage: "User has full access"
})}
name="fullAccess" name="fullAccess"
onChange={change} onChange={change}
/> />
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
<Button onClick={onClose}> <Button onClick={onClose}>
{i18n.t("Cancel", { context: "button" })} <FormattedMessage {...buttonMessages.cancel} />
</Button> </Button>
<ConfirmButton <ConfirmButton
color="primary" color="primary"
@ -141,14 +150,18 @@ const StaffAddMemberDialog = withStyles(styles, {
type="submit" type="submit"
transitionState={confirmButtonState} transitionState={confirmButtonState}
> >
{i18n.t("Send invite", { context: "button" })} <FormattedMessage
defaultMessage="Send invite"
description="button"
/>
</ConfirmButton> </ConfirmButton>
</DialogActions> </DialogActions>
</> </>
)} )}
</Form> </Form>
</Dialog> </Dialog>
) );
}
); );
StaffAddMemberDialog.displayName = "StaffAddMemberDialog"; StaffAddMemberDialog.displayName = "StaffAddMemberDialog";
export default StaffAddMemberDialog; export default StaffAddMemberDialog;

View file

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import { useIntl } from "react-intl";
import AppHeader from "@saleor/components/AppHeader"; import AppHeader from "@saleor/components/AppHeader";
import CardSpacer from "@saleor/components/CardSpacer"; import CardSpacer from "@saleor/components/CardSpacer";
@ -8,7 +9,7 @@ import Form from "@saleor/components/Form";
import Grid from "@saleor/components/Grid"; import Grid from "@saleor/components/Grid";
import PageHeader from "@saleor/components/PageHeader"; import PageHeader from "@saleor/components/PageHeader";
import SaveButtonBar from "@saleor/components/SaveButtonBar"; import SaveButtonBar from "@saleor/components/SaveButtonBar";
import i18n from "../../../i18n"; import { sectionNames } from "@saleor/intl";
import { getUserName, maybe } from "../../../misc"; import { getUserName, maybe } from "../../../misc";
import { PermissionEnum } from "../../../types/globalTypes"; import { PermissionEnum } from "../../../types/globalTypes";
import { import {
@ -57,6 +58,8 @@ const StaffDetailsPage: React.StatelessComponent<StaffDetailsPageProps> = ({
onImageUpload, onImageUpload,
onSubmit onSubmit
}: StaffDetailsPageProps) => { }: StaffDetailsPageProps) => {
const intl = useIntl();
const initialForm: FormData = { const initialForm: FormData = {
email: maybe(() => staffMember.email, ""), email: maybe(() => staffMember.email, ""),
firstName: maybe(() => staffMember.firstName, ""), firstName: maybe(() => staffMember.firstName, ""),
@ -78,7 +81,9 @@ const StaffDetailsPage: React.StatelessComponent<StaffDetailsPageProps> = ({
<Form initial={initialForm} onSubmit={onSubmit} confirmLeave> <Form initial={initialForm} onSubmit={onSubmit} confirmLeave>
{({ data, change, hasChanged, submit }) => ( {({ data, change, hasChanged, submit }) => (
<Container> <Container>
<AppHeader onBack={onBack}>{i18n.t("Staff Members")}</AppHeader> <AppHeader onBack={onBack}>
{intl.formatMessage(sectionNames.staff)}
</AppHeader>
<PageHeader title={getUserName(staffMember)} /> <PageHeader title={getUserName(staffMember)} />
<Grid> <Grid>
<div> <div>

View file

@ -14,10 +14,10 @@ import TableRow from "@material-ui/core/TableRow";
import Typography from "@material-ui/core/Typography"; import Typography from "@material-ui/core/Typography";
import classNames from "classnames"; import classNames from "classnames";
import React from "react"; import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import Skeleton from "@saleor/components/Skeleton"; import Skeleton from "@saleor/components/Skeleton";
import TablePagination from "@saleor/components/TablePagination"; import TablePagination from "@saleor/components/TablePagination";
import i18n from "@saleor/i18n";
import { import {
getUserInitials, getUserInitials,
getUserName, getUserName,
@ -80,16 +80,22 @@ const StaffList = withStyles(styles, { name: "StaffList" })(
onRowClick, onRowClick,
pageInfo, pageInfo,
staffMembers staffMembers
}: StaffListProps) => ( }: StaffListProps) => {
const intl = useIntl();
return (
<Card> <Card>
<Table> <Table>
<TableHead> <TableHead>
<TableRow> <TableRow>
<TableCell className={classes.wideColumn}> <TableCell className={classes.wideColumn}>
{i18n.t("Name", { context: "object" })} <FormattedMessage
defaultMessage="Name"
description="staff member full name"
/>
</TableCell> </TableCell>
<TableCell> <TableCell>
{i18n.t("Email Address", { context: "object" })} <FormattedMessage defaultMessage="Email Address" />
</TableCell> </TableCell>
</TableRow> </TableRow>
</TableHead> </TableHead>
@ -119,7 +125,9 @@ const StaffList = withStyles(styles, { name: "StaffList" })(
[classes.tableRow]: !!staffMember [classes.tableRow]: !!staffMember
})} })}
hover={!!staffMember} hover={!!staffMember}
onClick={!!staffMember ? onRowClick(staffMember.id) : undefined} onClick={
!!staffMember ? onRowClick(staffMember.id) : undefined
}
key={staffMember ? staffMember.id : "skeleton"} key={staffMember ? staffMember.id : "skeleton"}
> >
<TableCell> <TableCell>
@ -131,7 +139,9 @@ const StaffList = withStyles(styles, { name: "StaffList" })(
/> />
) : ( ) : (
<div className={classes.avatarDefault}> <div className={classes.avatarDefault}>
<Typography>{getUserInitials(staffMember)}</Typography> <Typography>
{getUserInitials(staffMember)}
</Typography>
</div> </div>
)} )}
</div> </div>
@ -145,8 +155,14 @@ const StaffList = withStyles(styles, { name: "StaffList" })(
{maybe<React.ReactNode>( {maybe<React.ReactNode>(
() => () =>
staffMember.isActive staffMember.isActive
? i18n.t("Active", { context: "status" }) ? intl.formatMessage({
: i18n.t("Inactive", { context: "status" }), defaultMessage: "Active",
description: "staff member status"
})
: intl.formatMessage({
defaultMessage: "Inactive",
description: "staff member status"
}),
<Skeleton /> <Skeleton />
)} )}
</Typography> </Typography>
@ -162,7 +178,7 @@ const StaffList = withStyles(styles, { name: "StaffList" })(
() => ( () => (
<TableRow> <TableRow>
<TableCell colSpan={3}> <TableCell colSpan={3}>
{i18n.t("No staff members found")} <FormattedMessage defaultMessage="No staff members found" />
</TableCell> </TableCell>
</TableRow> </TableRow>
) )
@ -170,7 +186,8 @@ const StaffList = withStyles(styles, { name: "StaffList" })(
</TableBody> </TableBody>
</Table> </Table>
</Card> </Card>
) );
}
); );
StaffList.displayName = "StaffList"; StaffList.displayName = "StaffList";
export default StaffList; export default StaffList;

View file

@ -1,11 +1,12 @@
import Button from "@material-ui/core/Button"; import Button from "@material-ui/core/Button";
import AddIcon from "@material-ui/icons/Add"; import AddIcon from "@material-ui/icons/Add";
import React from "react"; import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import AppHeader from "@saleor/components/AppHeader"; import AppHeader from "@saleor/components/AppHeader";
import { Container } from "@saleor/components/Container"; import { Container } from "@saleor/components/Container";
import PageHeader from "@saleor/components/PageHeader"; import PageHeader from "@saleor/components/PageHeader";
import i18n from "@saleor/i18n"; import { sectionNames } from "@saleor/intl";
import { ListProps } from "@saleor/types"; import { ListProps } from "@saleor/types";
import { StaffList_staffUsers_edges_node } from "../../types/StaffList"; import { StaffList_staffUsers_edges_node } from "../../types/StaffList";
import StaffList from "../StaffList/StaffList"; import StaffList from "../StaffList/StaffList";
@ -21,22 +22,31 @@ const StaffListPage: React.StatelessComponent<StaffListPageProps> = ({
onAdd, onAdd,
onBack, onBack,
...listProps ...listProps
}) => ( }) => {
const intl = useIntl();
return (
<Container> <Container>
<AppHeader onBack={onBack}>{i18n.t("Configuration")}</AppHeader> <AppHeader onBack={onBack}>
<PageHeader title={i18n.t("Staff members", { context: "page title" })}> {intl.formatMessage(sectionNames.configuration)}
</AppHeader>
<PageHeader title={intl.formatMessage(sectionNames.staff)}>
<Button <Button
color="primary" color="primary"
disabled={disabled} disabled={disabled}
variant="contained" variant="contained"
onClick={onAdd} onClick={onAdd}
> >
{i18n.t("Add staff member", { context: "button" })} <FormattedMessage
defaultMessage="Add staff member"
description="button"
/>
<AddIcon /> <AddIcon />
</Button> </Button>
</PageHeader> </PageHeader>
<StaffList disabled={disabled} {...listProps} /> <StaffList disabled={disabled} {...listProps} />
</Container> </Container>
); );
};
StaffListPage.displayName = "StaffListPage"; StaffListPage.displayName = "StaffListPage";
export default StaffListPage; export default StaffListPage;

View file

@ -8,11 +8,11 @@ import {
} from "@material-ui/core/styles"; } from "@material-ui/core/styles";
import Typography from "@material-ui/core/Typography"; import Typography from "@material-ui/core/Typography";
import React from "react"; import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import CardTitle from "@saleor/components/CardTitle"; import CardTitle from "@saleor/components/CardTitle";
import { ControlledCheckbox } from "@saleor/components/ControlledCheckbox"; import { ControlledCheckbox } from "@saleor/components/ControlledCheckbox";
import Skeleton from "@saleor/components/Skeleton"; import Skeleton from "@saleor/components/Skeleton";
import i18n from "../../../i18n";
import { StaffMemberDetails_shop_permissions } from "../../types/StaffMemberDetails"; import { StaffMemberDetails_shop_permissions } from "../../types/StaffMemberDetails";
const styles = (theme: Theme) => const styles = (theme: Theme) =>
@ -47,6 +47,8 @@ const StaffPermissions = withStyles(styles, { name: "StaffPermissions" })(
permissions, permissions,
onChange onChange
}: StaffPermissionsProps) => { }: StaffPermissionsProps) => {
const intl = useIntl();
const handleFullAccessChange = (event: React.ChangeEvent<any>) => const handleFullAccessChange = (event: React.ChangeEvent<any>) =>
onChange(event, () => onChange(event, () =>
onChange({ onChange({
@ -68,19 +70,23 @@ const StaffPermissions = withStyles(styles, { name: "StaffPermissions" })(
}; };
return ( return (
<Card> <Card>
<CardTitle title={i18n.t("Permissions")} /> <CardTitle
title={intl.formatMessage({
defaultMessage: "Permissions",
description: "dialog header"
})}
/>
<CardContent> <CardContent>
<Typography> <Typography>
{i18n.t( <FormattedMessage defaultMessage="Expand or restrict user's permissions to access certain part of saleor system." />
"Expand or restrict user's permissions to access certain part of saleor system."
)}
</Typography> </Typography>
<div className={classes.checkboxContainer}> <div className={classes.checkboxContainer}>
<ControlledCheckbox <ControlledCheckbox
checked={data.hasFullAccess} checked={data.hasFullAccess}
disabled={disabled} disabled={disabled}
label={i18n.t("User has full access to the store", { label={intl.formatMessage({
context: "checkbox label" defaultMessage: "User has full access to the store",
description: "checkbox label"
})} })}
name="hasFullAccess" name="hasFullAccess"
onChange={handleFullAccessChange} onChange={handleFullAccessChange}

View file

@ -10,10 +10,11 @@ import TextField from "@material-ui/core/TextField";
import Typography from "@material-ui/core/Typography"; import Typography from "@material-ui/core/Typography";
import React from "react"; import React from "react";
import SVG from "react-inlinesvg"; import SVG from "react-inlinesvg";
import { FormattedMessage, useIntl } from "react-intl";
import photoIcon from "@assets/images/photo-icon.svg"; import photoIcon from "@assets/images/photo-icon.svg";
import CardTitle from "@saleor/components/CardTitle"; import CardTitle from "@saleor/components/CardTitle";
import i18n from "../../../i18n"; import { commonMessages } from "@saleor/intl";
import { getUserInitials, maybe } from "../../../misc"; import { getUserInitials, maybe } from "../../../misc";
import { StaffMemberDetails_user } from "../../types/StaffMemberDetails"; import { StaffMemberDetails_user } from "../../types/StaffMemberDetails";
@ -120,11 +121,19 @@ const StaffProperties = withStyles(styles, { name: "StaffProperties" })(
onImageDelete, onImageDelete,
onImageUpload onImageUpload
}: StaffPropertiesProps) => { }: StaffPropertiesProps) => {
const intl = useIntl();
const imgInputAnchor = React.createRef<HTMLInputElement>(); const imgInputAnchor = React.createRef<HTMLInputElement>();
const clickImgInput = () => imgInputAnchor.current.click(); const clickImgInput = () => imgInputAnchor.current.click();
return ( return (
<Card className={className}> <Card className={className}>
<CardTitle title={i18n.t("Staff Member Information")} /> <CardTitle
title={intl.formatMessage({
defaultMessage: "Staff Member Information",
description: "section header"
})}
/>
<CardContent> <CardContent>
<div className={classes.root}> <div className={classes.root}>
<div> <div>
@ -143,10 +152,16 @@ const StaffProperties = withStyles(styles, { name: "StaffProperties" })(
<div className={classes.avatarHover}> <div className={classes.avatarHover}>
<SVG src={photoIcon} /> <SVG src={photoIcon} />
<Typography onClick={clickImgInput}> <Typography onClick={clickImgInput}>
{i18n.t("Change photo")} <FormattedMessage
defaultMessage="Change photo"
description="button"
/>
</Typography> </Typography>
<Typography onClick={onImageDelete}> <Typography onClick={onImageDelete}>
{i18n.t("Delete photo")} <FormattedMessage
defaultMessage="Delete photo"
description="button"
/>
</Typography> </Typography>
<input <input
className={classes.fileField} className={classes.fileField}
@ -163,7 +178,7 @@ const StaffProperties = withStyles(styles, { name: "StaffProperties" })(
<div className={classes.propGrid}> <div className={classes.propGrid}>
<div className={classes.prop}> <div className={classes.prop}>
<TextField <TextField
label={i18n.t("First Name")} label={intl.formatMessage(commonMessages.firstName)}
value={data.firstName} value={data.firstName}
name="firstName" name="firstName"
onChange={onChange} onChange={onChange}
@ -172,7 +187,7 @@ const StaffProperties = withStyles(styles, { name: "StaffProperties" })(
</div> </div>
<div className={classes.prop}> <div className={classes.prop}>
<TextField <TextField
label={i18n.t("Last Name")} label={intl.formatMessage(commonMessages.lastName)}
value={data.lastName} value={data.lastName}
name="lastName" name="lastName"
onChange={onChange} onChange={onChange}
@ -181,7 +196,7 @@ const StaffProperties = withStyles(styles, { name: "StaffProperties" })(
</div> </div>
<div className={classes.prop}> <div className={classes.prop}>
<TextField <TextField
label={i18n.t("E-mail")} label={intl.formatMessage(commonMessages.email)}
value={data.email} value={data.email}
name="email" name="email"
onChange={onChange} onChange={onChange}

View file

@ -2,10 +2,10 @@ import Card from "@material-ui/core/Card";
import CardContent from "@material-ui/core/CardContent"; import CardContent from "@material-ui/core/CardContent";
import Typography from "@material-ui/core/Typography"; import Typography from "@material-ui/core/Typography";
import React from "react"; import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import CardTitle from "@saleor/components/CardTitle"; import CardTitle from "@saleor/components/CardTitle";
import { ControlledCheckbox } from "@saleor/components/ControlledCheckbox"; import { ControlledCheckbox } from "@saleor/components/ControlledCheckbox";
import i18n from "../../../i18n";
interface StaffStatusProps { interface StaffStatusProps {
data: { data: {
@ -19,22 +19,34 @@ const StaffStatus: React.StatelessComponent<StaffStatusProps> = ({
data, data,
disabled, disabled,
onChange onChange
}) => ( }) => {
const intl = useIntl();
return (
<Card> <Card>
<CardTitle title={i18n.t("Account Status")} /> <CardTitle
title={intl.formatMessage({
defaultMessage: "Account Status",
description: "section header"
})}
/>
<CardContent> <CardContent>
<Typography> <Typography>
{i18n.t("If you want to disable this account uncheck the box below")} <FormattedMessage defaultMessage="If you want to disable this account uncheck the box below" />
</Typography> </Typography>
<ControlledCheckbox <ControlledCheckbox
checked={data.isActive} checked={data.isActive}
disabled={disabled} disabled={disabled}
label={i18n.t("User is active", { context: "checkbox label" })} label={intl.formatMessage({
defaultMessage: "User is active",
description: "checkbox label"
})}
name="isActive" name="isActive"
onChange={onChange} onChange={onChange}
/> />
</CardContent> </CardContent>
</Card> </Card>
); );
};
StaffStatus.displayName = "StaffStatus"; StaffStatus.displayName = "StaffStatus";
export default StaffStatus; export default StaffStatus;

View file

@ -1,9 +1,10 @@
import { parse as parseQs } from "qs"; import { parse as parseQs } from "qs";
import React from "react"; import React from "react";
import { useIntl } from "react-intl";
import { Route, RouteComponentProps, Switch } from "react-router-dom"; import { Route, RouteComponentProps, Switch } from "react-router-dom";
import { sectionNames } from "@saleor/intl";
import { WindowTitle } from "../components/WindowTitle"; import { WindowTitle } from "../components/WindowTitle";
import i18n from "../i18n";
import { import {
staffListPath, staffListPath,
StaffListUrlQueryParams, StaffListUrlQueryParams,
@ -38,14 +39,18 @@ const StaffDetails: React.StatelessComponent<
); );
}; };
const Component = () => ( const Component = () => {
const intl = useIntl();
return (
<> <>
<WindowTitle title={i18n.t("Staff")} /> <WindowTitle title={intl.formatMessage(sectionNames.staff)} />
<Switch> <Switch>
<Route exact path={staffListPath} component={StaffList} /> <Route exact path={staffListPath} component={StaffList} />
<Route path={staffMemberDetailsPath(":id")} component={StaffDetails} /> <Route path={staffMemberDetailsPath(":id")} component={StaffDetails} />
</Switch> </Switch>
</> </>
); );
};
export default Component; export default Component;

View file

@ -1,12 +1,13 @@
import DialogContentText from "@material-ui/core/DialogContentText"; import DialogContentText from "@material-ui/core/DialogContentText";
import React from "react"; import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import ActionDialog from "@saleor/components/ActionDialog"; import ActionDialog from "@saleor/components/ActionDialog";
import { WindowTitle } from "@saleor/components/WindowTitle"; import { WindowTitle } from "@saleor/components/WindowTitle";
import useNavigator from "@saleor/hooks/useNavigator"; import useNavigator from "@saleor/hooks/useNavigator";
import useNotifier from "@saleor/hooks/useNotifier"; import useNotifier from "@saleor/hooks/useNotifier";
import useUser from "@saleor/hooks/useUser"; import useUser from "@saleor/hooks/useUser";
import i18n from "../../i18n"; import { commonMessages } from "@saleor/intl";
import { getMutationState, maybe } from "../../misc"; import { getMutationState, maybe } from "../../misc";
import StaffDetailsPage from "../components/StaffDetailsPage/StaffDetailsPage"; import StaffDetailsPage from "../components/StaffDetailsPage/StaffDetailsPage";
import { import {
@ -38,6 +39,7 @@ export const StaffDetails: React.StatelessComponent<OrderListProps> = ({
const navigate = useNavigator(); const navigate = useNavigator();
const notify = useNotifier(); const notify = useNotifier();
const user = useUser(); const user = useUser();
const intl = useIntl();
return ( return (
<TypedStaffMemberDetailsQuery <TypedStaffMemberDetailsQuery
@ -49,14 +51,14 @@ export const StaffDetails: React.StatelessComponent<OrderListProps> = ({
const handleStaffMemberUpdate = (data: StaffMemberUpdate) => { const handleStaffMemberUpdate = (data: StaffMemberUpdate) => {
if (!maybe(() => data.staffUpdate.errors.length !== 0)) { if (!maybe(() => data.staffUpdate.errors.length !== 0)) {
notify({ notify({
text: i18n.t("Succesfully updated staff member account") text: intl.formatMessage(commonMessages.savedChanges)
}); });
} }
}; };
const handleStaffMemberDelete = (data: StaffMemberDelete) => { const handleStaffMemberDelete = (data: StaffMemberDelete) => {
if (!maybe(() => data.staffDelete.errors.length !== 0)) { if (!maybe(() => data.staffDelete.errors.length !== 0)) {
notify({ notify({
text: i18n.t("Succesfully removed staff member") text: intl.formatMessage(commonMessages.savedChanges)
}); });
navigate(staffListUrl()); navigate(staffListUrl());
} }
@ -64,14 +66,14 @@ export const StaffDetails: React.StatelessComponent<OrderListProps> = ({
const handleStaffMemberAvatarUpdate = (data: StaffAvatarUpdate) => { const handleStaffMemberAvatarUpdate = (data: StaffAvatarUpdate) => {
if (!maybe(() => data.userAvatarUpdate.errors.length !== 0)) { if (!maybe(() => data.userAvatarUpdate.errors.length !== 0)) {
notify({ notify({
text: i18n.t("Succesfully updated staff member avatar") text: intl.formatMessage(commonMessages.savedChanges)
}); });
} }
}; };
const handleStaffMemberAvatarDelete = (data: StaffAvatarDelete) => { const handleStaffMemberAvatarDelete = (data: StaffAvatarDelete) => {
if (!maybe(() => data.userAvatarDelete.errors.length !== 0)) { if (!maybe(() => data.userAvatarDelete.errors.length !== 0)) {
notify({ notify({
text: i18n.t("Succesfully removed staff member avatar") text: intl.formatMessage(commonMessages.savedChanges)
}); });
navigate(staffMemberDetailsUrl(id)); navigate(staffMemberDetailsUrl(id));
} }
@ -167,7 +169,10 @@ export const StaffDetails: React.StatelessComponent<OrderListProps> = ({
/> />
<ActionDialog <ActionDialog
open={params.action === "remove"} open={params.action === "remove"}
title={i18n.t("Remove staff user")} title={intl.formatMessage({
defaultMessage: "remove Staff User",
description: "dialog header"
})}
confirmButtonState={deleteTransitionState} confirmButtonState={deleteTransitionState}
variant="delete" variant="delete"
onClose={() => onClose={() =>
@ -175,20 +180,21 @@ export const StaffDetails: React.StatelessComponent<OrderListProps> = ({
} }
onConfirm={deleteStaffMember} onConfirm={deleteStaffMember}
> >
<DialogContentText <DialogContentText>
dangerouslySetInnerHTML={{ <FormattedMessage
__html: i18n.t( defaultMessage="Are you sure you want to remove {email} from staff members?"
"Are you sure you want to remove <strong>{{ email }}</strong> from staff members?", values={{
{ email: maybe(() => data.user.email, "...")
email: maybe(() => data.user.email)
}
)
}} }}
/> />
</DialogContentText>
</ActionDialog> </ActionDialog>
<ActionDialog <ActionDialog
open={params.action === "remove-avatar"} open={params.action === "remove-avatar"}
title={i18n.t("Remove staff user avatar")} title={intl.formatMessage({
defaultMessage: "Delete Staff User Avatar",
description: "dialog header"
})}
confirmButtonState={deleteAvatarTransitionState} confirmButtonState={deleteAvatarTransitionState}
variant="delete" variant="delete"
onClose={() => onClose={() =>
@ -196,16 +202,18 @@ export const StaffDetails: React.StatelessComponent<OrderListProps> = ({
} }
onConfirm={deleteStaffAvatar} onConfirm={deleteStaffAvatar}
> >
<DialogContentText <DialogContentText>
dangerouslySetInnerHTML={{ <FormattedMessage
__html: i18n.t( defaultMessage="Are you sure you want to remove {email} avatar?"
"Are you sure you want to remove <strong>{{ email }}</strong> avatar?", values={{
{ email: (
email: maybe(() => data.user.email) <strong>
} {maybe(() => data.user.email, "...")}
</strong>
) )
}} }}
/> />
</DialogContentText>
</ActionDialog> </ActionDialog>
</> </>
); );

View file

@ -6,9 +6,10 @@ import useNotifier from "@saleor/hooks/useNotifier";
import usePaginator, { import usePaginator, {
createPaginationState createPaginationState
} from "@saleor/hooks/usePaginator"; } from "@saleor/hooks/usePaginator";
import { useIntl } from "react-intl";
import { configurationMenuUrl } from "@saleor/configuration"; import { configurationMenuUrl } from "@saleor/configuration";
import i18n from "@saleor/i18n"; import { commonMessages } from "@saleor/intl";
import { getMutationState, maybe } from "@saleor/misc"; import { getMutationState, maybe } from "@saleor/misc";
import { ListViews } from "@saleor/types"; import { ListViews } from "@saleor/types";
import StaffAddMemberDialog, { import StaffAddMemberDialog, {
@ -37,6 +38,7 @@ export const StaffList: React.StatelessComponent<StaffListProps> = ({
const { updateListSettings, settings } = useListSettings( const { updateListSettings, settings } = useListSettings(
ListViews.STAFF_MEMBERS_LIST ListViews.STAFF_MEMBERS_LIST
); );
const intl = useIntl();
const closeModal = () => const closeModal = () =>
navigate( navigate(
@ -55,7 +57,7 @@ export const StaffList: React.StatelessComponent<StaffListProps> = ({
const handleStaffMemberAddSuccess = (data: StaffMemberAdd) => { const handleStaffMemberAddSuccess = (data: StaffMemberAdd) => {
if (data.staffCreate.errors.length === 0) { if (data.staffCreate.errors.length === 0) {
notify({ notify({
text: i18n.t("Succesfully added staff member") text: intl.formatMessage(commonMessages.savedChanges)
}); });
navigate(staffMemberDetailsUrl(data.staffCreate.user.id)); navigate(staffMemberDetailsUrl(data.staffCreate.user.id));
} }