-
Notifications
You must be signed in to change notification settings - Fork 202
/
Copy pathutils.ts
46 lines (42 loc) · 1.33 KB
/
utils.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { BadgesCollection } from "topics/badge";
import { Flow } from "topics/flow";
import { RegistryTreeConfiguration } from "topics/registry-tree";
export const standardizedSubtitleForFlow = (name: string) => {
return "Mint " + name;
};
export const createFlows = ({
badgesCollection,
customizedFlows,
registryTreeConfiguration,
}: {
badgesCollection: BadgesCollection;
customizedFlows: Flow[];
registryTreeConfiguration: RegistryTreeConfiguration;
}) => {
const flows: Flow[] = [...customizedFlows];
for (const badge of badgesCollection.badges) {
if (flows.length >= badgesCollection.badges.length) {
return flows;
}
if (flows.find((flow: Flow) => flow.path === badge.groupSnapshot.groupName)) {
continue;
}
flows.push({
path: badge.groupSnapshot.groupName,
registryTree: registryTreeConfiguration.name,
networks: badge.networks,
registryTreeType: "hydra-s1",
badgesCollection: badgesCollection,
badgesInternalCollectionsIds: [badge.internalCollectionId],
title: "",
logoUrl: null,
// subtitle with groupName capitalized after each "-"
subtitle: standardizedSubtitleForFlow(badge.name),
onboardingDescription: "",
ctaLabel: "",
ctaUrl: "",
congratulationTexts: ["Congrats!"],
} as Flow);
}
return flows;
};