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