From 4c44de3ed61398e60615df632c02e973d6a73646 Mon Sep 17 00:00:00 2001 From: Ian Krieger Date: Thu, 12 Oct 2023 10:04:56 -0400 Subject: [PATCH] fix: missed flags in different fragment --- src/components/Drawer/MiniSideBar.tsx | 2 +- .../Navigation/NewCreativeButton.tsx | 2 +- src/graphql/advertiser.generated.tsx | 9 +-- src/graphql/advertiser.graphql | 3 +- src/user/campaignList/CampaignList.tsx | 56 ++++++++++--------- 5 files changed, 35 insertions(+), 37 deletions(-) diff --git a/src/components/Drawer/MiniSideBar.tsx b/src/components/Drawer/MiniSideBar.tsx index 9c46d1e1..f6deb44e 100644 --- a/src/components/Drawer/MiniSideBar.tsx +++ b/src/components/Drawer/MiniSideBar.tsx @@ -65,7 +65,7 @@ export default function MiniSideBar({ children }: PropsWithChildren) { sx={{ color: "text.secondary" }} /> ), - disabled: !advertiser.selfServiceCreate, + disabled: !advertiser.selfServiceManageCampaign, }, { label: "Audiences", diff --git a/src/components/Navigation/NewCreativeButton.tsx b/src/components/Navigation/NewCreativeButton.tsx index d95529a9..b8573c70 100644 --- a/src/components/Navigation/NewCreativeButton.tsx +++ b/src/components/Navigation/NewCreativeButton.tsx @@ -8,7 +8,7 @@ export function NewCreativeButton() { const { advertiser } = useAdvertiser(); const isNewCreativePage = url.includes(newUrl); - if (!advertiser.selfServiceCreate) { + if (!advertiser.selfServiceManageCampaign) { return null; } diff --git a/src/graphql/advertiser.generated.tsx b/src/graphql/advertiser.generated.tsx index 088b0155..26c792a2 100644 --- a/src/graphql/advertiser.generated.tsx +++ b/src/graphql/advertiser.generated.tsx @@ -57,8 +57,7 @@ export type UpdateAdvertiserMutation = { export type AdvertiserCampaignsFragment = { id: string; name: string; - selfServiceEdit: boolean; - selfServiceCreate: boolean; + selfServiceManageCampaign: boolean; selfServiceSetPrice: boolean; campaigns: Array<{ id: string; @@ -94,8 +93,7 @@ export type AdvertiserCampaignsQuery = { advertiserCampaigns?: { id: string; name: string; - selfServiceEdit: boolean; - selfServiceCreate: boolean; + selfServiceManageCampaign: boolean; selfServiceSetPrice: boolean; campaigns: Array<{ id: string; @@ -209,8 +207,7 @@ export const AdvertiserCampaignsFragmentDoc = gql` fragment AdvertiserCampaigns on Advertiser { id name - selfServiceEdit - selfServiceCreate + selfServiceManageCampaign selfServiceSetPrice campaigns { ...CampaignSummary diff --git a/src/graphql/advertiser.graphql b/src/graphql/advertiser.graphql index f4565a98..d455607b 100644 --- a/src/graphql/advertiser.graphql +++ b/src/graphql/advertiser.graphql @@ -42,8 +42,7 @@ mutation updateAdvertiser($updateAdvertiserInput: UpdateAdvertiserInput!) { fragment AdvertiserCampaigns on Advertiser { id name - selfServiceEdit - selfServiceCreate + selfServiceManageCampaign selfServiceSetPrice campaigns { ...CampaignSummary diff --git a/src/user/campaignList/CampaignList.tsx b/src/user/campaignList/CampaignList.tsx index 01e3c81f..97c3738e 100644 --- a/src/user/campaignList/CampaignList.tsx +++ b/src/user/campaignList/CampaignList.tsx @@ -53,17 +53,6 @@ export function CampaignList({ }); const columns: ColumnDescriptor[] = [ - { - title: "On/Off", - value: (c) => c.state, - extendedRenderer: (r) => - campaignOnOffState({ - ...r, - advertiserId: advertiser?.id ?? "", - }), - sx: { width: "1px", p: 0 }, - sortable: false, - }, { title: "Campaign", value: (c) => c.name, @@ -137,22 +126,35 @@ export function CampaignList({ }, ]; - if (advertiser?.selfServiceCreate && advertiser.selfServiceEdit) { - initialSort += 1; - columns.unshift({ - title: "", - value: (c) => c.id, - sortable: false, - extendedRenderer: (r) => ( - - ), - align: "center", - sx: { width: "1px" }, - }); + if (advertiser?.selfServiceManageCampaign) { + initialSort += 2; + columns.unshift( + { + title: "On/Off", + value: (c) => c.state, + extendedRenderer: (r) => + campaignOnOffState({ + ...r, + advertiserId: advertiser?.id ?? "", + }), + sx: { width: "1px", p: 0 }, + sortable: false, + }, + { + title: "", + value: (c) => c.id, + sortable: false, + extendedRenderer: (r) => ( + + ), + align: "center", + sx: { width: "1px" }, + }, + ); } return (