-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DRY up getProjectColor between explore pages
- Loading branch information
Morgan Brown
committed
Jan 13, 2025
1 parent
9ca204d
commit bc128ba
Showing
3 changed files
with
17 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { DefaultExplorePageFeaturedProjectFragment } from './__generated__/gql.generated'; | ||
import filterCurrentChainData from '../../../../../lib/utils/filter-current-chain-data'; | ||
import isClaimed from '../../../../../lib/utils/project/is-claimed'; | ||
|
||
// This would be a great utility, but so far we rely on the generated DefaultExplorePageFeaturedProjectFragment | ||
// type, so I'm keeping it near the type's generation. | ||
export default function getProjectColor(project: DefaultExplorePageFeaturedProjectFragment) { | ||
const chainData = filterCurrentChainData(project.chainData); | ||
|
||
if (!isClaimed(chainData)) { | ||
return; | ||
} | ||
|
||
return chainData.color; | ||
} |