Merge pull request #689 from mirumee/fix/availability-date
fix availability date
This commit is contained in:
commit
abda7f58da
4 changed files with 27 additions and 18 deletions
|
@ -1437,10 +1437,6 @@
|
|||
"context": "product availability",
|
||||
"string": "Available for purchase"
|
||||
},
|
||||
"src_dot_components_dot_AvailabilityCard_dot_2936097346": {
|
||||
"context": "product unavailability",
|
||||
"string": "Unvailable for purchase"
|
||||
},
|
||||
"src_dot_components_dot_AvailabilityCard_dot_2938074852": {
|
||||
"context": "product available for purchase date",
|
||||
"string": "will become available on {date}"
|
||||
|
@ -1449,6 +1445,10 @@
|
|||
"context": "product availability date label",
|
||||
"string": "Set availability date"
|
||||
},
|
||||
"src_dot_components_dot_AvailabilityCard_dot_825317195": {
|
||||
"context": "product unavailability",
|
||||
"string": "Unavailable for purchase"
|
||||
},
|
||||
"src_dot_components_dot_ColumnPicker_dot_1483881697": {
|
||||
"context": "button",
|
||||
"string": "Reset"
|
||||
|
|
|
@ -42,7 +42,7 @@ export const AvailabilityCard: React.FC<AvailabilityCardProps> = props => {
|
|||
description: "product availability date label"
|
||||
}),
|
||||
unavailableLabel: intl.formatMessage({
|
||||
defaultMessage: "Unvailable for purchase",
|
||||
defaultMessage: "Unavailable for purchase",
|
||||
description: "product unavailability"
|
||||
})
|
||||
}}
|
||||
|
|
|
@ -8,6 +8,7 @@ import ControlledCheckbox from "@saleor/components/ControlledCheckbox";
|
|||
import Hr from "@saleor/components/Hr";
|
||||
import RadioSwitchField from "@saleor/components/RadioSwitchField";
|
||||
import useDateLocalize from "@saleor/hooks/useDateLocalize";
|
||||
import { ChangeEvent } from "@saleor/hooks/useForm";
|
||||
import { UserError } from "@saleor/types";
|
||||
import { getFieldError } from "@saleor/utils/errors";
|
||||
import classNames from "classnames";
|
||||
|
@ -82,7 +83,7 @@ export interface VisibilityCardProps {
|
|||
errors: UserError[];
|
||||
disabled?: boolean;
|
||||
messages: Message;
|
||||
onChange: (event: React.ChangeEvent<any>) => void;
|
||||
onChange: (event: ChangeEvent) => void;
|
||||
}
|
||||
|
||||
export const VisibilityCard: React.FC<VisibilityCardProps> = props => {
|
||||
|
@ -236,7 +237,15 @@ export const VisibilityCard: React.FC<VisibilityCardProps> = props => {
|
|||
</>
|
||||
}
|
||||
value={isAvailable}
|
||||
onChange={onChange}
|
||||
onChange={e => {
|
||||
const { value } = e.target;
|
||||
if (!value) {
|
||||
onChange({
|
||||
target: { name: "availableForPurchase", value: null }
|
||||
});
|
||||
}
|
||||
return onChange(e);
|
||||
}}
|
||||
/>
|
||||
{!isAvailable && (
|
||||
<>
|
||||
|
|
|
@ -1549,7 +1549,7 @@ exports[`Storyshots Generics / AvailabilityCard default 1`] = `
|
|||
<p
|
||||
class="VisibilityCard-label-id"
|
||||
>
|
||||
Unvailable for purchase
|
||||
Unavailable for purchase
|
||||
</p>
|
||||
</span>
|
||||
</label>
|
||||
|
@ -133844,7 +133844,7 @@ Ctrl + K"
|
|||
<p
|
||||
class="VisibilityCard-label-id"
|
||||
>
|
||||
Unvailable for purchase
|
||||
Unavailable for purchase
|
||||
</p>
|
||||
</span>
|
||||
</label>
|
||||
|
@ -135003,7 +135003,7 @@ Ctrl + K"
|
|||
<p
|
||||
class="VisibilityCard-label-id"
|
||||
>
|
||||
Unvailable for purchase
|
||||
Unavailable for purchase
|
||||
</p>
|
||||
</span>
|
||||
</label>
|
||||
|
@ -136175,7 +136175,7 @@ Ctrl + K"
|
|||
<p
|
||||
class="VisibilityCard-label-id"
|
||||
>
|
||||
Unvailable for purchase
|
||||
Unavailable for purchase
|
||||
</p>
|
||||
</span>
|
||||
</label>
|
||||
|
@ -141594,7 +141594,7 @@ Ctrl + K"
|
|||
<p
|
||||
class="VisibilityCard-label-id"
|
||||
>
|
||||
Unvailable for purchase
|
||||
Unavailable for purchase
|
||||
</p>
|
||||
</span>
|
||||
</label>
|
||||
|
@ -143596,7 +143596,7 @@ Ctrl + K"
|
|||
<p
|
||||
class="VisibilityCard-label-id"
|
||||
>
|
||||
Unvailable for purchase
|
||||
Unavailable for purchase
|
||||
</p>
|
||||
</span>
|
||||
</label>
|
||||
|
@ -146016,7 +146016,7 @@ Ctrl + K"
|
|||
<p
|
||||
class="VisibilityCard-label-id"
|
||||
>
|
||||
Unvailable for purchase
|
||||
Unavailable for purchase
|
||||
</p>
|
||||
</span>
|
||||
</label>
|
||||
|
@ -148570,7 +148570,7 @@ Ctrl + K"
|
|||
<p
|
||||
class="VisibilityCard-label-id"
|
||||
>
|
||||
Unvailable for purchase
|
||||
Unavailable for purchase
|
||||
</p>
|
||||
</span>
|
||||
</label>
|
||||
|
@ -150831,7 +150831,7 @@ Ctrl + K"
|
|||
<p
|
||||
class="VisibilityCard-label-id"
|
||||
>
|
||||
Unvailable for purchase
|
||||
Unavailable for purchase
|
||||
</p>
|
||||
</span>
|
||||
</label>
|
||||
|
@ -154305,7 +154305,7 @@ Ctrl + K"
|
|||
<p
|
||||
class="VisibilityCard-label-id"
|
||||
>
|
||||
Unvailable for purchase
|
||||
Unavailable for purchase
|
||||
</p>
|
||||
</span>
|
||||
</label>
|
||||
|
@ -156859,7 +156859,7 @@ Ctrl + K"
|
|||
<p
|
||||
class="VisibilityCard-label-id"
|
||||
>
|
||||
Unvailable for purchase
|
||||
Unavailable for purchase
|
||||
</p>
|
||||
</span>
|
||||
</label>
|
||||
|
|
Loading…
Reference in a new issue