Skip to content

Commit

Permalink
Merge pull request #224 from TogetherCrew/feat/change-breakdown-api
Browse files Browse the repository at this point in the history
update role api to sortBy name
  • Loading branch information
mehdi-torabiv authored Dec 17, 2023
2 parents ec30194 + daae269 commit d314cef
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/components/global/FilterPopover/FilterRolesPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,14 @@ function FilterRolesPopover({ handleSelectedRoles }: IFilterRolesPopover) {
);

if (isRoleSelected) {
setFilteredRolesByName('');
return prevSelectedRoles.filter(
(selectedRole) => selectedRole.id !== role.id
);
} else {
setFilteredRolesByName('');
return [...prevSelectedRoles, role];
}
});
setFilteredRolesByName('');
};

const [isAutocompleteOpen, setAutocompleteOpen] = useState<boolean>(false);
Expand Down Expand Up @@ -312,6 +311,11 @@ function FilterRolesPopover({ handleSelectedRoles }: IFilterRolesPopover) {
handleClearAll();
}
}}
onInputChange={(event, value, reason) => {
if (reason === 'clear') {
handleClearAll();
}
}}
getOptionLabel={(option) => option.name}
renderTags={(value, getTagProps) =>
value.map((option, index) => (
Expand Down Expand Up @@ -350,10 +354,6 @@ function FilterRolesPopover({ handleSelectedRoles }: IFilterRolesPopover) {
placeholder="Select one or more roles"
value={filteredRolesByName}
onChange={handleSearchChange}
onClick={(e) => {
e.stopPropagation();
setAutocompleteOpen(false);
}}
/>
)}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/context/ChannelContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const ChannelProvider = ({ children }: ChannelProviderProps) => {
...prevSelectedSubChannels,
};

allChannels.forEach((channel) => {
allChannels?.forEach((channel) => {
const channelUpdates: { [subChannelId: string]: boolean } = {};

channel?.subChannels?.forEach((subChannel) => {
Expand Down
3 changes: 2 additions & 1 deletion src/store/slices/platformSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ const createPlatfromSlice: StateCreator<IPlatfrom> = (set, get) => ({

params.append('property', property);

// Only append sortBy if it's not undefined
if (sortBy !== undefined) {
params.append('sortBy', sortBy);
} else if (property === 'role') {
params.append('sortBy', 'name:asc');
}

if (name) params.append('name', name);
Expand Down

0 comments on commit d314cef

Please sign in to comment.