-
-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add option to hide member map pins on load
- Loading branch information
Showing
7 changed files
with
87 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { describe, expect, it } from 'vitest' | ||
|
||
import { setDefaultPinFilters } from './setDefaultPinFilters' | ||
|
||
describe('setDefaultPinFilters', () => { | ||
const filterOptions = [ | ||
{ | ||
_id: 'workspace', | ||
filterType: 'profileType', | ||
label: 'Workspace', | ||
}, | ||
{ | ||
_id: 'member', | ||
filterType: 'profileType', | ||
label: 'Member', | ||
}, | ||
] | ||
|
||
it('returns nothing when hideMembers is false', () => { | ||
expect(setDefaultPinFilters(filterOptions, false)).toEqual([]) | ||
}) | ||
|
||
it('returns non-member options when hideMembers is true', () => { | ||
expect(setDefaultPinFilters(filterOptions, true)).toEqual([ | ||
filterOptions[0], | ||
]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { VITE_HIDE_MEMBER_PINS_BY_DEFAULT } from 'src/config/config' | ||
|
||
import type { MapFilterOptionsList } from 'oa-shared' | ||
|
||
const hideMembersDefault = | ||
VITE_HIDE_MEMBER_PINS_BY_DEFAULT === 'true' ? true : false | ||
|
||
export const setDefaultPinFilters = ( | ||
filterOptions: MapFilterOptionsList, | ||
hideMembers = hideMembersDefault, | ||
) => { | ||
if (hideMembers) { | ||
const options = filterOptions.filter( | ||
({ _id, filterType }) => _id !== 'member' && filterType === 'profileType', | ||
) | ||
return options | ||
} | ||
|
||
return [] | ||
} |