Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRCL-3683 Add new filter items #245

Merged
merged 5 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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
}
Loading