forked from opencollective/opencollective-frontend-template
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove collectives without activity (#23)
- Loading branch information
1 parent
bab1104
commit 6120d23
Showing
12 changed files
with
103 additions
and
115 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
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,31 @@ | ||
import { uniq } from 'lodash'; | ||
|
||
import { tagTransforms } from './tag-transforms'; | ||
|
||
// Transform tags to grouped tags, i.e. if a tag is in a group, return the group key otherwise return the tag | ||
export const getGroupTagKeys = (tags: string[], groupTags: { [key: string]: string[] }) => { | ||
const groupedTagKey = Object.entries(groupTags).reduce((acc, [key, value]) => { | ||
value.forEach(tag => { | ||
acc[tag] = key; | ||
}); | ||
return acc; | ||
}, {}); | ||
return uniq(tags?.map(tag => groupedTagKey[tag] || tag)) ?? null; | ||
}; | ||
|
||
// This is used to reverse the group tags AND the tag transforms when querying the API | ||
export const getAllPossibleTagValues = (tag: string, groupTags: { [key: string]: string[] }): string[] => { | ||
const tags = groupTags[tag] || [tag]; | ||
const acc = [...tags]; | ||
|
||
const reverseTagTransforms = Object.entries(tagTransforms).reduce((acc, [key, value]) => { | ||
if (tags.includes(value)) { | ||
acc.push(key); | ||
} | ||
return acc; | ||
}, []); | ||
|
||
acc.push(...reverseTagTransforms); | ||
|
||
return acc; | ||
}; |
Oops, something went wrong.
6120d23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
horizons – ./
horizons-opencollective.vercel.app
discover.opencollective.com
horizons-git-main-opencollective.vercel.app