Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Disable sort controls when fetching data #507

Merged
merged 3 commits into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions Emitron/Emitron/Assets.xcassets/Colours/Text/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
18 changes: 12 additions & 6 deletions Emitron/Emitron/UI/Library/LibraryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
// THE SOFTWARE.

import SwiftUI
import Combine
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this import still necessary?


private extension CGFloat {
static let filterButtonSide: CGFloat = 27
Expand All @@ -50,7 +51,7 @@ struct LibraryView: View {
.background(Color.backgroundColor.edgesIgnoringSafeArea(.all))
}
}

private var contentControlsSection: some View {
VStack {
searchAndFilterControls
Expand Down Expand Up @@ -104,12 +105,17 @@ struct LibraryView: View {
HStack {
Image("sort")
.foregroundColor(.textButtonText)

Text(filters.sortFilter.name)
.font(.uiLabelBold)
.foregroundColor(.textButtonText)
if [.loading, .loadingAdditional].contains(libraryRepository.state) {
Text(filters.sortFilter.name)
.font(.uiLabel)
.foregroundColor(Color.gray)
} else {
Text(filters.sortFilter.name)
.font(.uiLabelBold)
.foregroundColor(.textButtonText)
}
}
}
}.disabled(libraryRepository.state == .loading || libraryRepository.state == .loadingAdditional)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be consistent with line 108. So either this, or switch 108 to match this || statement, whichever you feel is clearer.

Suggested change
}.disabled(libraryRepository.state == .loading || libraryRepository.state == .loadingAdditional)
}.disabled([.loading, .loadingAdditional].contains(libraryRepository.state))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good - I've updated the PR with your suggestions. Thanks!

}
}

Expand Down