feat: 实现DetailView头像点击功能并优化MeView

- 在DetailView中添加头像点击功能,支持展示非当前用户的主页。
- 更新OptimizedDynamicCardView以支持头像点击回调。
- 修改DetailFeature以管理用户主页显示状态。
- 在MeView中添加关闭按钮支持,优化用户体验。
- 确保其他页面的兼容性,未影响现有功能。
This commit is contained in:
edwinQQQ
2025-08-01 16:12:24 +08:00
parent 57ba103996
commit fa544139c1
11 changed files with 214 additions and 51 deletions

View File

@@ -6,6 +6,15 @@ struct MeView: View {
//
@State private var previewItem: PreviewItem? = nil
@State private var previewCurrentIndex: Int = 0
//
let showCloseButton: Bool
// dismiss
@Environment(\.dismiss) private var dismiss
init(store: StoreOf<MeFeature>, showCloseButton: Bool = false) {
self.store = store
self.showCloseButton = showCloseButton
}
var body: some View {
WithPerceptionTracking {
@@ -22,16 +31,35 @@ struct MeView: View {
//
VStack {
HStack {
Spacer()
Button(action: {
store.send(.settingButtonTapped)
}) {
Image(systemName: "gearshape")
.font(.system(size: 33, weight: .medium))
.foregroundColor(.white)
// present
if showCloseButton {
Button(action: {
dismiss()
}) {
Image(systemName: "xmark")
.font(.system(size: 20, weight: .medium))
.foregroundColor(.white)
.frame(width: 44, height: 44)
.background(Color.black.opacity(0.3))
.clipShape(Circle())
}
.padding(.leading, 16)
.padding(.top, 8)
}
Spacer()
if !store.isDisplayingOtherUser {
Button(action: {
store.send(.settingButtonTapped)
}) {
Image(systemName: "gearshape")
.font(.system(size: 33, weight: .medium))
.foregroundColor(.white)
}
.padding(.trailing, 16)
.padding(.top, 8)
}
.padding(.trailing, 16)
.padding(.top, 8)
}
Spacer()
}
@@ -111,7 +139,7 @@ struct MeView: View {
.foregroundColor(.white)
// ID
UserIDDisplay(uid: store.userInfo?.uid ?? 0)
UserIDDisplay(uid: store.userInfo?.uid ?? 0, isDisplayCopy: true)
}
.padding(.horizontal, 32)
}
@@ -184,7 +212,8 @@ struct MeView: View {
},
onCardTap: {
store.send(.showDetail(moment))
}
},
onAvatarTap: nil // MeView
)
.padding(.horizontal, 12)
}