Skip to content

Commit

Permalink
fix: allow campaign settings edit if draft
Browse files Browse the repository at this point in the history
  • Loading branch information
IanKrieger committed Jul 21, 2023
1 parent ca60cd9 commit 56a11f0
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ import { CardContainer } from "components/Card/CardContainer";
import { CampaignDateRange } from "components/Campaigns/CampaignDateRange";
import { LocationField } from "user/views/adsManager/views/advanced/components/campaign/fields/LocationField";
import { Typography } from "@mui/material";
import { useFormikContext } from "formik";
import { CampaignForm } from "user/views/adsManager/types";

export function CampaignSettings(props: { isEdit: boolean }) {
const { values } = useFormikContext<CampaignForm>();
const isEdit = props.isEdit && values.state !== "draft";

return (
<>
<CardContainer header="Campaign Settings">
Expand All @@ -15,10 +20,10 @@ export function CampaignSettings(props: { isEdit: boolean }) {

<FormikTextField name="name" label="Campaign Name" sx={{ mb: 1 }} />

<CampaignDateRange isEdit={props.isEdit} />
<CampaignDateRange isEdit={isEdit} />
</CardContainer>

{!props.isEdit && <LocationField />}
{!isEdit && <LocationField />}
</>
);
}

0 comments on commit 56a11f0

Please sign in to comment.