Skip to content

Commit

Permalink
Add limit operator to smart search dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasva82 committed Sep 26, 2023
1 parent c6aa98a commit 03430ba
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Call,
CheckBoxOutlined,
Event,
FilterAlt,
LocalOfferOutlined,
PersonAddAlt,
PersonOutlined,
Expand Down Expand Up @@ -64,6 +65,8 @@ export default function getFilterComponents(
filterOperatorIcon = undefined;
} else if (filter.op === OPERATION.SUB) {
filterOperatorIcon = <Remove color="secondary" fontSize="small" />;
} else if (filter.op === OPERATION.LIMIT) {
filterOperatorIcon = <FilterAlt color="secondary" fontSize="small" />;
}

//Uses CALL_BLOCKED as default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ const CampaignParticipation = ({
<MenuItem key={OPERATION.SUB} value={OPERATION.SUB}>
<Msg id={messageIds.operators.sub} />
</MenuItem>
<MenuItem key={OPERATION.LIMIT} value={OPERATION.LIMIT}>
<Msg id={messageIds.operators.limit} />
</MenuItem>
</StyledSelect>
),
bookedSelect: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ const MostActive = ({
<MenuItem key={OPERATION.SUB} value={OPERATION.SUB}>
<Msg id={messageIds.operators.sub} />
</MenuItem>
<MenuItem key={OPERATION.LIMIT} value={OPERATION.LIMIT}>
<Msg id={messageIds.operators.limit} />
</MenuItem>
</StyledSelect>
),
numPeople: filter.config?.size,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ const PersonData = ({
<MenuItem key={OPERATION.SUB} value={OPERATION.SUB}>
<Msg id={messageIds.operators.sub} />
</MenuItem>
<MenuItem key={OPERATION.SUB} value={OPERATION.LIMIT}>
<Msg id={messageIds.operators.limit} />
</MenuItem>
</StyledSelect>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ const PersonView = ({
<MenuItem key={OPERATION.SUB} value={OPERATION.SUB}>
<Msg id={messageIds.operators.sub} />
</MenuItem>
<MenuItem key={OPERATION.LIMIT} value={OPERATION.LIMIT}>
<Msg id={messageIds.operators.limit} />
</MenuItem>
</StyledSelect>
),
inSelect: (
Expand Down
3 changes: 3 additions & 0 deletions src/features/smartSearch/components/filters/Random/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ const Random = ({
<MenuItem key={OPERATION.SUB} value={OPERATION.SUB}>
<Msg id={localMessageIds.addLimitRemoveSelect.sub} />
</MenuItem>
<MenuItem key={OPERATION.LIMIT} value={OPERATION.LIMIT}>
<Msg id={localMessageIds.addLimitRemoveSelect.limit} />
</MenuItem>
</StyledSelect>
),
quantity: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ const SurveyResponse = ({
<MenuItem key={OPERATION.SUB} value={OPERATION.SUB}>
<Msg id={messageIds.operators.sub} />
</MenuItem>
<MenuItem key={OPERATION.LIMIT} value={OPERATION.LIMIT}>
<Msg id={messageIds.operators.limit} />
</MenuItem>
</StyledSelect>
),
freeTextInput: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ const SurveySubmission = ({
<MenuItem key={OPERATION.SUB} value={OPERATION.SUB}>
<Msg id={messageIds.operators.sub} />
</MenuItem>
<MenuItem key={OPERATION.LIMIT} value={OPERATION.LIMIT}>
<Msg id={messageIds.operators.limit} />
</MenuItem>
</StyledSelect>
),
surveySelect: (
Expand Down
3 changes: 3 additions & 0 deletions src/features/smartSearch/components/filters/User/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ const User = ({
<MenuItem key={OPERATION.SUB} value={OPERATION.SUB}>
<Msg id={messageIds.operators.sub} />
</MenuItem>
<MenuItem key={OPERATION.LIMIT} value={OPERATION.LIMIT}>
<Msg id={messageIds.operators.limit} />
</MenuItem>
</StyledSelect>
),
connectedSelect: (
Expand Down
1 change: 1 addition & 0 deletions src/features/smartSearch/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export enum CALL_OPERATOR {
export enum OPERATION {
ADD = 'add',
SUB = 'sub',
LIMIT = 'limit',
}

export enum QUANTITY {
Expand Down
2 changes: 2 additions & 0 deletions src/features/smartSearch/l10n/messageIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ export default makeMessages('feat.smartSearch', {
random: {
addLimitRemoveSelect: {
add: m('add'),
limit: m('limit to'),
sub: m('remove'),
},
examples: {
Expand Down Expand Up @@ -568,6 +569,7 @@ export default makeMessages('feat.smartSearch', {
},
operators: {
add: m('Add'),
limit: m('Limit to'),
sub: m('Remove'),
},
quantity: {
Expand Down

0 comments on commit 03430ba

Please sign in to comment.