Skip to content

Commit

Permalink
feat: filter NTT by default (#1026)
Browse files Browse the repository at this point in the history
  • Loading branch information
IanKrieger authored Jan 25, 2024
1 parent 2813428 commit a0d5fbe
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/components/Datagrid/stringFilterOperators.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {
getGridStringOperators,
GridFilterInputValue,
GridFilterItem,
} from "@mui/x-data-grid";

export function stringFilterOperators() {
return [
{
label: "is not",
value: "not",
getApplyFilterFn: (field: GridFilterItem) => (params: any) =>
params.value !== field.value,
InputComponentProps: { type: "string" },
InputComponent: GridFilterInputValue,
},
...getGridStringOperators(),
];
}
9 changes: 9 additions & 0 deletions src/user/campaignList/CampaignList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { EditButton } from "user/campaignList/EditButton";
import { calculateMetric } from "user/analytics/analyticsOverview/lib/overview.library";
import { StatsMetric } from "user/analytics/analyticsOverview/types";
import { uiLabelsForCampaignFormat } from "util/campaign";
import { stringFilterOperators } from "components/Datagrid/stringFilterOperators";

interface Props {
advertiser?: AdvertiserCampaignsFragment | null;
Expand Down Expand Up @@ -87,6 +88,7 @@ export function CampaignList({ advertiser }: Props) {
align: "left",
headerAlign: "left",
width: 150,
filterOperators: stringFilterOperators(),
},
{
field: "state",
Expand Down Expand Up @@ -256,6 +258,13 @@ export function CampaignList({ advertiser }: Props) {
pageSize: 10,
},
},
filter: {
filterModel: {
items: [
{ field: "format", operator: "not", value: "New tab takeover" },
],
},
},
}}
/>
);
Expand Down

0 comments on commit a0d5fbe

Please sign in to comment.