Skip to content

Commit

Permalink
fix: missed flags in different fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
IanKrieger committed Oct 12, 2023
1 parent 96f19f9 commit 4c44de3
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 37 deletions.
2 changes: 1 addition & 1 deletion src/components/Drawer/MiniSideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function MiniSideBar({ children }: PropsWithChildren) {
sx={{ color: "text.secondary" }}
/>
),
disabled: !advertiser.selfServiceCreate,
disabled: !advertiser.selfServiceManageCampaign,
},
{
label: "Audiences",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navigation/NewCreativeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function NewCreativeButton() {
const { advertiser } = useAdvertiser();
const isNewCreativePage = url.includes(newUrl);

if (!advertiser.selfServiceCreate) {
if (!advertiser.selfServiceManageCampaign) {
return null;
}

Expand Down
9 changes: 3 additions & 6 deletions src/graphql/advertiser.generated.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions src/graphql/advertiser.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ mutation updateAdvertiser($updateAdvertiserInput: UpdateAdvertiserInput!) {
fragment AdvertiserCampaigns on Advertiser {
id
name
selfServiceEdit
selfServiceCreate
selfServiceManageCampaign
selfServiceSetPrice
campaigns {
...CampaignSummary
Expand Down
56 changes: 29 additions & 27 deletions src/user/campaignList/CampaignList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,6 @@ export function CampaignList({
});

const columns: ColumnDescriptor<CampaignSummaryFragment>[] = [
{
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,
Expand Down Expand Up @@ -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) => (
<CampaignCheckBox
campaign={r}
selectedCampaigns={selectedCampaigns}
onCampaignSelect={onCampaignSelect}
/>
),
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) => (
<CampaignCheckBox
campaign={r}
selectedCampaigns={selectedCampaigns}
onCampaignSelect={onCampaignSelect}
/>
),
align: "center",
sx: { width: "1px" },
},
);
}

return (
Expand Down

0 comments on commit 4c44de3

Please sign in to comment.