Skip to content

Commit 3578e02

Browse files
committed
fix: use dynamic colors for overlays in TagDetailPage and UserDetailPage
- Replace primaryText overlay with dynamic(light: .black, dark: .white) to maintain proper darkening effect in light mode and lightening in dark mode - Fixes build issues by moving SettingActions into SettingState temporarily - Restores original overlay opacity values (0.3/0.1)
1 parent 4813bca commit 3578e02

File tree

5 files changed

+26
-36
lines changed

5 files changed

+26
-36
lines changed

V2er/State/DataFlow/Actions/SettingActions.swift

Lines changed: 0 additions & 33 deletions
This file was deleted.

V2er/State/DataFlow/Reducers/SettingReducer.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,20 @@
99
import Foundation
1010

1111
func settingStateReducer(_ state: SettingState, _ action: Action) -> (SettingState, Action?) {
12-
return (SettingState(), nil)
12+
var state = state
13+
var followingAction: Action? = action
14+
15+
switch action {
16+
case let action as SettingActions.ChangeAppearanceAction:
17+
state.appearance = action.appearance
18+
// Save to UserDefaults
19+
UserDefaults.standard.set(action.appearance.rawValue, forKey: "appearanceMode")
20+
followingAction = nil
21+
default:
22+
break
23+
}
24+
25+
return (state, followingAction)
1326
}
1427

1528

V2er/State/DataFlow/State/SettingState.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,14 @@ enum AppearanceMode: String, CaseIterable {
4747
return nil
4848
}
4949
}
50+
}
51+
52+
// Temporary: Define actions here until SettingActions.swift is properly added to project
53+
struct SettingActions {
54+
private static let R: Reducer = .setting
55+
56+
struct ChangeAppearanceAction: Action {
57+
var target: Reducer = R
58+
let appearance: AppearanceMode
59+
}
5060
}

V2er/View/Me/UserDetailPage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct UserDetailPage: StateView {
7777
.fade(duration: 0.25)
7878
.resizable()
7979
.blur(radius: 80, opaque: true)
80-
.overlay(Color.primaryText.opacity(withAnimation {shouldHideNavbar ? 0.6 : 0.2}))
80+
.overlay(Color.dynamic(light: .black, dark: .white).opacity(withAnimation {shouldHideNavbar ? 0.3 : 0.1}))
8181
.frame(maxWidth: .infinity, maxHeight: height)
8282
Spacer().background(.clear)
8383
}

V2er/View/Tag/TagDetailPage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct TagDetailPage: StateView, InstanceIdentifiable {
7777
.fade(duration: 0.25)
7878
.resizable()
7979
.blur(radius: 80, opaque: true)
80-
.overlay(Color.primaryText.opacity(withAnimation {shouldHideNavbar ? 0.6 : 0.2}))
80+
.overlay(Color.dynamic(light: .black, dark: .white).opacity(withAnimation {shouldHideNavbar ? 0.3 : 0.1}))
8181
.frame(height: bannerViewHeight * 1.2 + max(scrollY, 0))
8282
Spacer()
8383
}

0 commit comments

Comments
 (0)