Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix visibility card on product
Krzysztof Bialoglowicz7753a9660508
diff --git a/saleor/static/dashboard-next/components/ControlledSwitch.tsx b/saleor/static/dashboard-next/components/ControlledSwitch.tsxindex b13a4b28ed..6b0b341fd0 100644--- a/saleor/static/dashboard-next/components/ControlledSwitch.tsx+++ b/saleor/static/dashboard-next/components/ControlledSwitch.tsx@@ -15,6 +15,7 @@ interface ControlledSwitchProps extends WithStyles<typeof styles> {disabled?: boolean;label: string | React.ReactNode;name: string;+ secondLabel?: string;uncheckedLabel?: string | React.ReactNode;onChange?(event: React.ChangeEvent<any>);}@@ -29,6 +30,7 @@ export const ControlledSwitch = withStyles(styles, {onChange,label,name,+ secondLabel,uncheckedLabel}: ControlledSwitchProps) => (<FormControlLabel@@ -45,6 +47,7 @@ export const ControlledSwitch = withStyles(styles, {label={<div className={classes.label}>{uncheckedLabel ? (checked ? label : uncheckedLabel) : label}+ <div>{secondLabel ? secondLabel : null}</div></div>}disabled={disabled}diff --git a/saleor/static/dashboard-next/products/components/ProductAvailabilityForm/ProductAvailabilityForm.tsx b/saleor/static/dashboard-next/products/components/ProductAvailabilityForm/ProductAvailabilityForm.tsxindex 871977b3f3..8f5bf7948c 100644--- a/saleor/static/dashboard-next/products/components/ProductAvailabilityForm/ProductAvailabilityForm.tsx+++ b/saleor/static/dashboard-next/products/components/ProductAvailabilityForm/ProductAvailabilityForm.tsx@@ -16,7 +16,10 @@ import i18n from "../../../i18n";const styles = (theme: Theme) =>createStyles({date: {- marginTop: theme.spacing.unit+ marginTop: theme.spacing.unit * 4,+ "& svg": {+ fill: theme.palette.primary.main+ }},expandedSwitchContainer: {marginBottom: 0@@ -47,7 +50,7 @@ export const ProductAvailabilityForm = withStyles(styles, {onChange}: ProductAvailabilityFormProps) => (<Card>- <CardTitle title={i18n.t("Availability")} />+ <CardTitle title={i18n.t("Visibility")} /><CardContent><divclassName={@@ -58,18 +61,26 @@ export const ProductAvailabilityForm = withStyles(styles, {><ControlledSwitchname="available"- label={i18n.t("Published in storefront")}+ label={i18n.t("Visible")}+ uncheckedLabel={i18n.t("Hidden")}+ secondLabel={+ publicationDate+ ? available+ ? i18n.t("since ") + publicationDate+ : i18n.t("will be visible on ") + publicationDate+ : null+ }checked={available}onChange={onChange}disabled={loading}/></div>- {available && (+ {!available && (<><TextFielderror={!!errors.publicationDate}disabled={loading}- label={i18n.t("Publish product on")}+ label={i18n.t("Publish on")}name="publicationDate"type="date"fullWidth={true}