Skip to content

Commit

Permalink
New layout to support evergreen campaigns / weekly budget (#88379)
Browse files Browse the repository at this point in the history
* New layout to support evergreen campaigns / weekly budget

* remove dupe const

* this should be false by default

* Hide the stats when a scheduled evergreen, they don't make sense

* Adds orders to the campaigns overview page under "weekly spend"

* make the order rows more compact, like design

* Adds some mobile styles

* Revert hiding zero stats

* Revert hiding for evergreen

* Fixes:
Calculate campaign total, since orders have multiple campaigns
Fix duration days and order dates
Don't allow budget below zero
Fixes remaining being / 100W
Ordering for non evergreen campaigns
Promo codes not included

---------

Co-authored-by: James Gill <[email protected]>
  • Loading branch information
j6ll and j6ll authored Mar 20, 2024
1 parent de2d745 commit 3fcd217
Show file tree
Hide file tree
Showing 4 changed files with 306 additions and 83 deletions.
42 changes: 42 additions & 0 deletions client/data/promote-post/use-promote-post-campaigns-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,49 @@ export type CampaignResponse = {
currency: string;
total: number;
card_name: string;
orders: Order[];
};
is_evergreen?: boolean;
};

export type Order = {
id: number;
orderKey: string;
userId: number;
customerId: number;
status: 'COMPLETED' | 'PENDING' | 'FAILED' | string;
currency: string;
total: string;
totalTax: string;
paymentMethod: string;
failedPaymentCounter: number;
paymentMethodTitle: string;
dateCreatedGmt: string;
dateModifiedGmt: string;
dateCompletedGmt: string;
datePaidGmt: string;
createdAt: string;
updatedAt: string;
lineItems: LineItem[];
feeItems: FeeItem[];
credits: number;
subtotal: number;
};

type LineItem = {
id: number;
orderId: number;
campaignId: number;
name: string;
subtotal: string;
total: string;
};

type FeeItem = {
id: number;
orderId: number;
name: string;
total: string;
};

const useCampaignsQuery = ( siteId: number, campaignId: number, queryOptions = {} ) => {
Expand Down
Loading

0 comments on commit 3fcd217

Please sign in to comment.