Skip to content

Commit

Permalink
TRCL-3683 Add new filter items (#245)
Browse files Browse the repository at this point in the history
* Bump Abacus

* Turn on static_typing as default

* WIP

* Fix ordering
  • Loading branch information
ruixhuang authored Sep 13, 2024
1 parent a528dd7 commit c1512e0
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public enum dydxBoolFeatureFlag: String, CaseIterable {
case .showPredictionMarketsUI:
return false
case .abacus_static_typing:
return false
return Installation.source == .debug
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,10 @@ struct FilterAction {
dydxFavoriteStore().isFavorite(marketId: market.id)
}),

FilterAction(type: .layer1,
content: .text(DataLocalizer.localize(path: "APP.GENERAL.LAYER_1")),
action: { market, assetMap in
assetMap[market.assetId]?.tags?.contains("Layer 1") ?? false
}),

FilterAction(type: .defi,
content: .text(DataLocalizer.localize(path: "APP.GENERAL.DEFI")),
action: { market, assetMap in
assetMap[market.assetId]?.tags?.contains("Defi") ?? false
FilterAction(type: .new,
content: .text(DataLocalizer.localize(path: "APP.GENERAL.RECENTLY_LISTED")),
action: { market, _ in
market.perpetual?.isNew ?? false
})
]
if dydxBoolFeatureFlag.showPredictionMarketsUI.isEnabled {
Expand All @@ -255,8 +249,66 @@ struct FilterAction {
action: { market, assetMap in
assetMap[market.assetId]?.tags?.contains("Prediction Market") ?? false
})
actions.insert(predictionMarketsAction, at: 2)
actions.append(predictionMarketsAction)
}
actions.append(contentsOf: [
FilterAction(type: .layer1,
content: .text(DataLocalizer.localize(path: "APP.GENERAL.LAYER_1")),
action: { market, assetMap in
assetMap[market.assetId]?.tags?.contains("Layer 1") ?? false
}),

FilterAction(type: .layer2,
content: .text(DataLocalizer.localize(path: "APP.GENERAL.LAYER_2")),
action: { market, assetMap in
assetMap[market.assetId]?.tags?.contains("Layer 2") ?? false
}),

FilterAction(type: .defi,
content: .text(DataLocalizer.localize(path: "APP.GENERAL.DEFI")),
action: { market, assetMap in
assetMap[market.assetId]?.tags?.contains("Defi") ?? false
}),

FilterAction(type: .ai,
content: .text(DataLocalizer.localize(path: "APP.GENERAL.AI")),
action: { market, assetMap in
if market.assetId == "RENDER" {
print(assetMap[market.assetId]?.tags?.first ?? "aa")
}
return assetMap[market.assetId]?.tags?.contains("AI") ?? false
}),

FilterAction(type: .nft,
content: .text(DataLocalizer.localize(path: "APP.GENERAL.NFT")),
action: { market, assetMap in
assetMap[market.assetId]?.tags?.contains("NFT") ?? false
}),

FilterAction(type: .gaming,
content: .text(DataLocalizer.localize(path: "APP.GENERAL.GAMING")),
action: { market, assetMap in
assetMap[market.assetId]?.tags?.contains("Gaming") ?? false
}),

FilterAction(type: .meme,
content: .text(DataLocalizer.localize(path: "APP.GENERAL.MEME")),
action: { market, assetMap in
assetMap[market.assetId]?.tags?.contains("Meme") ?? false
}),

FilterAction(type: .rwa,
content: .text(DataLocalizer.localize(path: "APP.GENERAL.REAL_WORLD_ASSET_SHORT")),
action: { market, assetMap in
assetMap[market.assetId]?.tags?.contains("RWA") ?? false
}),

FilterAction(type: .ent,
content: .text(DataLocalizer.localize(path: "APP.GENERAL.ENTERTAINMENT")),
action: { market, assetMap in
assetMap[market.assetId]?.tags?.contains("ENT") ?? false
})
])
return actions
}

Expand Down Expand Up @@ -284,4 +336,11 @@ enum MarketFiltering {
case layer1
case layer2
case defi
case new
case ai
case nft
case gaming
case meme
case rwa
case ent
}

0 comments on commit c1512e0

Please sign in to comment.