Skip to content

Commit eb4ce4c

Browse files
authored
Merge pull request #46 from blackcandy-org/ui-issue
Fix some UI issues
2 parents 5a4d079 + c47a494 commit eb4ce4c

6 files changed

+42
-15
lines changed

BlackCandy/Utils/CustomStyle.swift

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct CustomStyle {
2828

2929
enum Style {
3030
case largeSymbol
31+
case extraLargeSymbol
3132
case smallFont
3233
case mediumFont
3334
case playerProgressLoader
@@ -56,6 +57,9 @@ extension View {
5657
case .largeSymbol:
5758
font(.system(size: CustomStyle.spacing(.wide)))
5859

60+
case .extraLargeSymbol:
61+
font(.system(size: CustomStyle.spacing(.extraWide)))
62+
5963
case .smallFont:
6064
font(.system(size: CustomStyle.fontSize(.small)))
6165

BlackCandy/ViewControllers/PlayerViewController.swift

+13-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,17 @@ class PlayerViewController: UIHostingController<PlayerView> {
1212

1313
init(store: StoreOf<PlayerReducer>) {
1414
self.store = store
15-
super.init(rootView: PlayerView(store: store))
15+
super.init(
16+
rootView: PlayerView(
17+
store: store,
18+
padding: .init(
19+
top: CustomStyle.spacing(.medium),
20+
leading: 0,
21+
bottom: CustomStyle.spacing(.narrow),
22+
trailing: 0
23+
)
24+
)
25+
)
1626
}
1727

1828
override func viewDidLoad() {
@@ -31,9 +41,11 @@ class PlayerViewController: UIHostingController<PlayerView> {
3141

3242
pauseButton.isEnabled = state.hasCurrentSong
3343
pauseButton.tintColor = .label
44+
pauseButton.width = CustomStyle.spacing(.ultraWide)
3445

3546
playButton.isEnabled = state.hasCurrentSong
3647
playButton.tintColor = .label
48+
playButton.width = CustomStyle.spacing(.ultraWide)
3749

3850
nextButton.isEnabled = state.hasCurrentSong
3951
nextButton.tintColor = .label

BlackCandy/ViewControllers/SideBarViewController.swift

+9-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@ class SideBarViewController: UIViewController {
1212
playerViewController = UIHostingController(
1313
rootView: VStack {
1414
Divider()
15-
PlayerView(store: store)
15+
PlayerView(
16+
store: store,
17+
padding: .init(
18+
top: CustomStyle.spacing(.tiny),
19+
leading: CustomStyle.spacing(.tiny),
20+
bottom: 0,
21+
trailing: CustomStyle.spacing(.tiny)
22+
)
23+
)
1624
}
1725
)
1826

BlackCandy/Views/Player/PlayerActionsView.swift

+7-9
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ struct PlayerActionsView: View {
1616
.tint(viewStore.mode == .noRepeat ? .primary : .white)
1717
}
1818
)
19-
.padding(CustomStyle.spacing(.tiny))
19+
.padding(CustomStyle.spacing(.narrow))
2020
.background(viewStore.mode == .noRepeat ? .clear : .accentColor)
2121
.cornerRadius(CustomStyle.cornerRadius(.medium))
22-
.disabled(viewStore.isPlaylistVisible)
2322

2423
Spacer()
2524

@@ -37,8 +36,8 @@ struct PlayerActionsView: View {
3736
}
3837
}
3938
)
40-
.padding(CustomStyle.spacing(.tiny))
41-
.disabled(viewStore.isPlaylistVisible || !viewStore.hasCurrentSong)
39+
.padding(CustomStyle.spacing(.narrow))
40+
.disabled(!viewStore.hasCurrentSong)
4241

4342
Spacer()
4443

@@ -48,15 +47,14 @@ struct PlayerActionsView: View {
4847
},
4948
label: {
5049
Image(systemName: "list.bullet")
51-
.tint(.primary)
50+
.tint(viewStore.isPlaylistVisible ? .white : .primary)
5251
}
5352
)
54-
.padding(CustomStyle.spacing(.tiny))
55-
.background(viewStore.isPlaylistVisible ? Color.init(.systemGray3) : Color.clear)
56-
.cornerRadius(CustomStyle.cornerRadius(.small))
53+
.padding(CustomStyle.spacing(.narrow))
54+
.background(viewStore.isPlaylistVisible ? Color.accentColor : .clear)
55+
.cornerRadius(CustomStyle.cornerRadius(.medium))
5756
}
5857
})
59-
.padding(.horizontal, CustomStyle.spacing(.large))
6058
}
6159
}
6260

BlackCandy/Views/Player/PlayerControlView.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ struct PlayerControlView: View {
4242
if viewStore.isPlaying {
4343
Image(systemName: "pause.fill")
4444
.tint(.primary)
45-
.customStyle(.largeSymbol)
45+
.customStyle(.extraLargeSymbol)
4646
} else {
4747
Image(systemName: "play.fill")
4848
.tint(.primary)
49-
.customStyle(.largeSymbol)
49+
.customStyle(.extraLargeSymbol)
5050
}
5151
}
5252
)

BlackCandy/Views/PlayerView.swift

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import ComposableArchitecture
33

44
struct PlayerView: View {
55
let store: StoreOf<PlayerReducer>
6+
var padding: EdgeInsets = .init()
67

78
struct ViewState: Equatable {
89
let isPlaylistVisible: Bool
@@ -23,18 +24,22 @@ struct PlayerView: View {
2324

2425
if viewStore.isPlaylistVisible {
2526
PlayerPlaylistView(store: store)
27+
.padding(.horizontal, CustomStyle.spacing(.tiny))
28+
2629
} else {
2730
PlayerSongInfoView(currentSong: viewStore.currentSong)
2831
PlayerControlView(store: store)
2932
.disabled(!viewStore.hasCurrentSong)
33+
.padding(.horizontal, CustomStyle.spacing(.small))
3034
}
3135

3236
Spacer()
3337

3438
PlayerActionsView(store: store)
39+
.padding(.vertical, CustomStyle.spacing(.medium))
40+
.padding(.horizontal, CustomStyle.spacing(.large))
3541
}
36-
.padding()
37-
.padding(.bottom, CustomStyle.spacing(.wide))
42+
.padding(padding)
3843
.frame(maxWidth: CustomStyle.playerMaxWidth)
3944
.task {
4045
await viewStore.send(.getLivingStates).finish()

0 commit comments

Comments
 (0)