From 4e1b5aed42cbe5016544f386f27e25c712421dbe Mon Sep 17 00:00:00 2001 From: hdn Date: Thu, 20 Oct 2022 16:55:14 +0200 Subject: [PATCH 1/3] feat(launches): filter out launches base on criteria --- src/launches/launches.ts | 23 +++++++++++++++++++ .../featuredLaunches/featuredLaunches.ts | 5 +++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/launches/launches.ts b/src/launches/launches.ts index 106019bd..6618be12 100644 --- a/src/launches/launches.ts +++ b/src/launches/launches.ts @@ -43,6 +43,7 @@ export class Launches { this.launches = (this.seedService.seedsArray as Array) .concat(this.lbpManagerService.lbpManagersArray as Array); + this.launches = filterOutTestLaunches(this.launches); this.loading = false; } @@ -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; +} diff --git a/src/resources/elements/featuredLaunches/featuredLaunches.ts b/src/resources/elements/featuredLaunches/featuredLaunches.ts index bace4c14..726e2da0 100644 --- a/src/resources/elements/featuredLaunches/featuredLaunches.ts +++ b/src/resources/elements/featuredLaunches/featuredLaunches.ts @@ -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"); @@ -35,7 +36,9 @@ export class FeaturedLaunches { this.launches = (this.seedService.seedsArray as Array) .filter((seed: Seed) => { return !seed.uninitialized && !seed.corrupt && (seed.hasNotStarted || seed.contributingIsOpen); }) .concat((this.lbpManagerService.lbpManagersArray as Array) - .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) ; From 9a363da851cbda293eb9f0c3458f4ce1dcd95218 Mon Sep 17 00:00:00 2001 From: hdn Date: Thu, 20 Oct 2022 16:55:26 +0200 Subject: [PATCH 2/3] feat(services): add `metadata` to launchTypes --- src/services/launchTypes.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/services/launchTypes.ts b/src/services/launchTypes.ts index 6032262f..de2b8854 100644 --- a/src/services/launchTypes.ts +++ b/src/services/launchTypes.ts @@ -1,3 +1,4 @@ +import { ILaunchConfig } from "newLaunch/launchConfig"; import { Address } from "services/EthereumService"; export enum LaunchType { @@ -21,4 +22,5 @@ export interface ILaunch { uninitialized: boolean; canGoToDashboard: boolean; userHydrated: boolean; + metadata: ILaunchConfig; } From b6aea35bbf4f12b9d7d1d771d9d3cbec0a03c174 Mon Sep 17 00:00:00 2001 From: hdn Date: Thu, 20 Oct 2022 16:55:58 +0200 Subject: [PATCH 3/3] chore(tsconfig): Add DOM --- tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index f7fcf8e8..09c943c1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,8 @@ "target": "es2019", "lib": [ "es2019", - "ESNext" + "ESNext", + "DOM" ], "moduleResolution": "node", "baseUrl": "src",