Skip to content

Commit

Permalink
Merge pull request #846 from PrimeDAO/chore/sc-1370/add-logic-to-hide…
Browse files Browse the repository at this point in the history
…-seeds-on-mainnet

Chore/sc 1370/add logic to hide seeds on mainnet
  • Loading branch information
hiaux0 authored Oct 31, 2022
2 parents 759d8aa + b6aea35 commit 2d7cc37
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
23 changes: 23 additions & 0 deletions src/launches/launches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export class Launches {

this.launches = (this.seedService.seedsArray as Array<ILaunch>)
.concat(this.lbpManagerService.lbpManagersArray as Array<ILaunch>);
this.launches = filterOutTestLaunches(this.launches);

this.loading = false;
}
Expand Down Expand Up @@ -109,3 +110,25 @@ export class Launches {
}
}
}


/**
* On Production, we don't want to show "Test" launches.
* We have the case of test launches in production due to:
* 1. Actually want to perform real tests on production env
* 2. Certain networks only have Gnosis Safe on production (ie. Celo)
*/
export function filterOutTestLaunches(launches: ILaunch[]): ILaunch[] {
const productionUrl = "launch.prime.xyz";
const isProductionUrl = window.location.host === productionUrl;
if (!isProductionUrl) return launches;

const filteredLaunches = launches.filter((launch) => {
const testIdentifier = "Test";
const isTest = launch.metadata.general.projectName.includes(testIdentifier);
const isAccepted = !isTest;
return isAccepted;
});

return filteredLaunches;
}
5 changes: 4 additions & 1 deletion src/resources/elements/featuredLaunches/featuredLaunches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { LbpManagerService } from "services/LbpManagerService";
import { SeedService } from "services/SeedService";
import { SortService } from "services/SortService";
import { bindable } from "aurelia-typed-observable-plugin";
import { filterOutTestLaunches } from "launches/launches";

// for webpack
PLATFORM.moduleName("../launchCards/seedCard.html");
Expand Down Expand Up @@ -35,7 +36,9 @@ export class FeaturedLaunches {
this.launches = (this.seedService.seedsArray as Array<ILaunch>)
.filter((seed: Seed) => { return !seed.uninitialized && !seed.corrupt && (seed.hasNotStarted || seed.contributingIsOpen); })
.concat((this.lbpManagerService.lbpManagersArray as Array<ILaunch>)
.filter((lbpMgr: LbpManager) => { return !lbpMgr.uninitialized && !lbpMgr.corrupt && !lbpMgr.isDead; }))
.filter((lbpMgr: LbpManager) => { return !lbpMgr.uninitialized && !lbpMgr.corrupt && !lbpMgr.isDead; }));
this.launches = filterOutTestLaunches(this.launches);
this.launches = this.launches
.sort((a: ILaunch, b: ILaunch) => SortService.evaluateDateTimeAsDate(a.startTime, b.startTime))
.slice(0, 3)
;
Expand Down
2 changes: 2 additions & 0 deletions src/services/launchTypes.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ILaunchConfig } from "newLaunch/launchConfig";
import { Address } from "services/EthereumService";

export enum LaunchType {
Expand All @@ -21,4 +22,5 @@ export interface ILaunch {
uninitialized: boolean;
canGoToDashboard: boolean;
userHydrated: boolean;
metadata: ILaunchConfig;
}
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"target": "es2019",
"lib": [
"es2019",
"ESNext"
"ESNext",
"DOM"
],
"moduleResolution": "node",
"baseUrl": "src",
Expand Down

0 comments on commit 2d7cc37

Please sign in to comment.