-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add filter by sectors. Update filter by blockchains and some UI changes.
- Loading branch information
Showing
15 changed files
with
305 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
.../UnstoppableWallet/Modules/Market/AdvancedSearch/MarketAdvancedSearchCategoriesView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import MarketKit | ||
import SwiftUI | ||
|
||
struct MarketAdvancedSearchCategoriesView: View { | ||
@ObservedObject var viewModel: MarketAdvancedSearchViewModel | ||
@Binding var isPresented: Bool | ||
|
||
var body: some View { | ||
VStack(spacing: 0) { | ||
HStack(spacing: .margin16) { | ||
Image("circle_portfolio_24").themeIcon(color: .themeJacob) | ||
Text("market.advanced_search.categories".localized).themeHeadline2() | ||
Button(action: { isPresented = false }) { Image("close_3_24").themeIcon() } | ||
} | ||
.padding(.horizontal, .margin32) | ||
.padding(.vertical, .margin24) | ||
|
||
BottomGradientWrapper(backgroundColor: .themeLawrence) { | ||
ScrollView { | ||
VStack(spacing: .margin24) { | ||
ListSection { | ||
switch viewModel.allCategoriesState { | ||
case .loading: EmptyView() | ||
case .failed: EmptyView() | ||
case let .loaded(categories): | ||
ClickableRow { | ||
viewModel.categories = .any | ||
} content: { | ||
Text("selector.any".localized).themeBody(color: .themeGray) | ||
|
||
if viewModel.categories == .any { | ||
Image("check_1_20").themeIcon(color: .themeJacob) | ||
} | ||
} | ||
|
||
ForEach(categories) { category in | ||
ClickableRow { | ||
switch viewModel.categories { | ||
case .any: viewModel.categories = .list([category.id]) | ||
case var .list(array): | ||
if let index = array.firstIndex(of: category.id) { | ||
array.remove(at: index) | ||
} else { | ||
array.append(category.id) | ||
} | ||
viewModel.categories = array.isEmpty ? .any : .list(array) | ||
} | ||
} content: { | ||
Text(category.name).themeBody() | ||
|
||
if viewModel.categories.include(id: category.id) { | ||
Image("check_1_20").themeIcon(color: .themeJacob) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
.themeListStyle(.bordered) | ||
.padding(EdgeInsets(top: 0, leading: .margin16, bottom: .margin24, trailing: .margin16)) | ||
} | ||
} bottomContent: { | ||
Button(buttonTitle()) { | ||
isPresented = false | ||
} | ||
.buttonStyle(PrimaryButtonStyle(style: .yellow)) | ||
} | ||
} | ||
.background(Color.themeLawrence) | ||
} | ||
|
||
func buttonTitle() -> String { | ||
switch viewModel.categories { | ||
case .any: return "button.done".localized | ||
case let .list(categories): return ["button.select".localized, categories.count.description].joined(separator: " ") | ||
} | ||
} | ||
} | ||
|
||
extension CoinCategory: Identifiable {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.