-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create pipe to convert value to label
- Loading branch information
Showing
11 changed files
with
81 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './lib/challenge-search.routes'; | ||
export * from './lib/challenge-search-filters'; |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './lib/challenge.routes'; | ||
export * from './lib/challenge-overview/challenge-property-labels'; |
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
22 changes: 0 additions & 22 deletions
22
libs/openchallenges/ui/src/lib/challenge-card/challenge-property-labels.ts
This file was deleted.
Oops, something went wrong.
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
37 changes: 37 additions & 0 deletions
37
libs/openchallenges/util/src/lib/pipe/challenge-property-label.pipe.ts
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,37 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import { | ||
ChallengeIncentive, | ||
ChallengeSubmissionType, | ||
} from '@sagebionetworks/openchallenges/api-client-angular'; | ||
// Directly import challenge filters from the challenge-search module to avoid circular dependencies. | ||
// Do not import these from a index file that might cause circular import paths. | ||
import { | ||
challengeIncentivesFilter, | ||
challengeSubmissionTypesFilter, | ||
} from '../../../../challenge-search/src/lib/challenge-search-filters'; | ||
|
||
@Pipe({ | ||
name: 'incentiveLabel', | ||
standalone: true, | ||
}) | ||
export class IncentiveLabelPipe implements PipeTransform { | ||
transform(incentive: ChallengeIncentive): string | undefined { | ||
const filterItem = challengeIncentivesFilter.find( | ||
(item) => item.value === incentive | ||
); | ||
return filterItem ? filterItem.label : undefined; | ||
} | ||
} | ||
|
||
@Pipe({ | ||
name: 'submissionTypeLabel', | ||
standalone: true, | ||
}) | ||
export class SubmissionTypeLabelPipe implements PipeTransform { | ||
transform(submissionType: ChallengeSubmissionType): string | undefined { | ||
const filterItem = challengeSubmissionTypesFilter.find( | ||
(item) => item.value === submissionType | ||
); | ||
return filterItem ? filterItem.label : undefined; | ||
} | ||
} |