Skip to content

Commit

Permalink
Merge pull request #1267 from brave/master
Browse files Browse the repository at this point in the history
Production Release 2024-07-23
  • Loading branch information
IanKrieger authored Jul 23, 2024
2 parents 0952bf7 + a4115b3 commit d159dea
Show file tree
Hide file tree
Showing 19 changed files with 1,381 additions and 726 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function LaunchCampaignButton() {
trackMatomoEvent("basic-attention-token", "launch-campaign")
}
sx={{
width: "250px",
width: "300px",
maxHeight: { xs: "40px", md: "60px" },
mb: 1,
fontSize: "16px",
Expand Down
4 changes: 1 addition & 3 deletions src/components/Campaigns/CloneCampaign.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { useContext, useState } from "react";
import { createCampaignFromFragment } from "@/form/fragmentUtil";
import { useAdvertiser } from "@/auth/hooks/queries/useAdvertiser";
import ContentCopyIcon from "@mui/icons-material/ContentCopy";
import { useUser } from "@/auth/hooks/queries/useUser";
import { FilterContext } from "@/state/context";
import {
AdvertiserCampaignsDocument,
Expand All @@ -36,7 +35,6 @@ interface Props {
export function CloneCampaign({ campaign, disabled }: Props) {
const { advertiser } = useAdvertiser();
const { fromDate } = useContext(FilterContext);
const { userId } = useUser();
const history = useHistory();
const [open, setOpen] = useState(false);
const { _ } = useLingui();
Expand Down Expand Up @@ -72,7 +70,7 @@ export function CloneCampaign({ campaign, disabled }: Props) {
if (data.campaign) {
copyCampaign({
variables: {
input: createCampaignFromFragment(data.campaign, userId),
input: createCampaignFromFragment(data.campaign),
},
});
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/components/Datagrid/renderers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
AdSetState,
AdvertiserCampaignsDocument,
CampaignSource,
CampaignState,
CampaignSummaryFragment,
LoadCampaignAdsDocument,
LoadCampaignDocument,
Expand Down Expand Up @@ -103,7 +104,7 @@ export function campaignOnOffState(
<OnOff
onChange={(s) => {
updateCampaign({
variables: { input: { id: c.id, state: s } },
variables: { input: { id: c.id, state: s as CampaignState } },
});
}}
loading={loading}
Expand Down
5 changes: 2 additions & 3 deletions src/form/fragmentUtil.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import {
AdSetFragment,
CampaignFragment,
CampaignState,
CreateAdSetInput,
CreateCampaignInput,
} from "@/graphql-client/graphql";
import dayjs from "dayjs";

export function createCampaignFromFragment(
data: CampaignFragment,
userId?: string,
): CreateCampaignInput {
const adSets: CreateAdSetInput[] = data.adSets.map((adSet) =>
createAdSetFromFragment(adSet),
);

const two = dayjs().utc().add(3, "days");
return {
userId,
adSets: adSets && adSets.length > 0 ? adSets : undefined,
advertiserId: data.advertiser.id,
budget: data.budget,
Expand All @@ -40,7 +39,7 @@ export function createCampaignFromFragment(
name: `${data.name} - Copy`,
pacingStrategy: data.pacingStrategy,
source: data.source.toLowerCase(),
state: "draft",
state: CampaignState.Draft,
type: data.type,
paymentType: data.paymentType,
};
Expand Down
101 changes: 74 additions & 27 deletions src/graphql-client/graphql.ts

Large diffs are not rendered by default.

Loading

0 comments on commit d159dea

Please sign in to comment.