Skip to content

Commit 508baed

Browse files
fix: ui issues (#3316)
1 parent 185d080 commit 508baed

File tree

6 files changed

+30
-19
lines changed

6 files changed

+30
-19
lines changed

Horizon/Horizon/Sources/Features/Account/AccountView.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ struct AccountView: View {
9191
)
9292
}
9393
}
94+
.onAppear {
95+
viewModel.getUserName()
96+
}
97+
9498
}
9599

96100
private var divider: some View {

Horizon/Horizon/Sources/Features/Account/AccountViewModel.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ final class AccountViewModel {
3232
// MARK: - Dependencies
3333

3434
private let router: Router
35+
private let getUserInteractor: GetUserInteractor
3536

3637
// MARK: - Private properties
3738

@@ -53,13 +54,7 @@ final class AccountViewModel {
5354
router: Router = AppEnvironment.shared.router
5455
) {
5556
self.router = router
56-
57-
getUserInteractor
58-
.getUser()
59-
.map { $0.name }
60-
.replaceError(with: "")
61-
.assign(to: \.name, on: self)
62-
.store(in: &subscriptions)
57+
self.getUserInteractor = getUserInteractor
6358

6459
confirmLogoutViewModel.userConfirmation()
6560
.sink {
@@ -81,6 +76,15 @@ final class AccountViewModel {
8176
}
8277
}
8378

79+
func getUserName() {
80+
getUserInteractor
81+
.getUser()
82+
.map { $0.name }
83+
.replaceError(with: "")
84+
.assign(to: \.name, on: self)
85+
.store(in: &subscriptions)
86+
}
87+
8488
func passwordDidTap() {}
8589

8690
func notificationsDidTap(viewController: WeakViewController) {

Horizon/Horizon/Sources/Features/Learn/CourseDetails/View/CourseDetailsView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct CourseDetailsView: View {
2424
@State private var viewModel: CourseDetailsViewModel
2525
@Environment(\.viewController) private var viewController
2626
@Environment(\.dismiss) private var dismiss
27-
@State private var selectedTabIndex: Int = 0
27+
@State private var selectedTabIndex: Int = 1
2828

2929
// MARK: - Dependencies
3030

@@ -173,8 +173,8 @@ struct CourseDetailsView: View {
173173

174174
extension CourseDetailsView {
175175
enum Tabs: CaseIterable, Identifiable {
176-
case myProgress
177176
case overview
177+
case myProgress
178178
case scores
179179
case notebook
180180
// case quickLinks

Horizon/Horizon/Sources/Features/LearningObjects/Assignment/AssignmentDetails/View/AssignmentSubmissionView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ struct AssignmentSubmissionView: View {
128128
case .fileUpload:
129129
VStack(spacing: .huiSpaces.space8) {
130130
HorizonUI.FileDrop(
131-
acceptedFilesType: viewModel.assignment?.allowedFileExtensions ?? ""
131+
acceptedFilesType: viewModel.assignment?.allowedFileExtensions
132132
) {
133133
isOverlayUploadFilePresented.toggle()
134134
}

Horizon/Horizon/Sources/Features/ModuleItemSequence/Sequence/View/ModuleItemSequenceViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ final class ModuleItemSequenceViewModel {
132132
guard let course else {
133133
return
134134
}
135-
135+
assignmentAttemptCount = nil
136136
let viewController = CourseProgressAssembly.makeView(
137137
course: course,
138138
currentModuleItem: moduleItem

packages/HorizonUI/Sources/HorizonUI/Sources/Components/FileDrop/HorizonUI.FileDrop.swift

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ public extension HorizonUI {
2424

2525
// MARK: - Dependencies
2626

27-
private let acceptedFilesType: String
27+
private let acceptedFilesType: String?
2828
private let onTap: () -> Void
2929

3030
// MARK: - Init
3131

3232
public init(
33-
acceptedFilesType: String,
33+
acceptedFilesType: String?,
3434
onTap: @escaping () -> Void
3535
) {
3636
self.acceptedFilesType = acceptedFilesType
@@ -56,14 +56,17 @@ public extension HorizonUI {
5656
style: StrokeStyle(lineWidth: 1, dash: [6, 5]))
5757
}
5858

59+
@ViewBuilder
5960
private var acceptedFilesView: some View {
60-
HStack(spacing: .huiSpaces.space2) {
61-
Text(String(localized: "Accepted file types:"))
62-
Text(acceptedFilesType)
61+
if let acceptedFilesType, !acceptedFilesType.isEmpty {
62+
HStack(spacing: .huiSpaces.space2) {
63+
Text(String(localized: "Accepted file types:"))
64+
Text(acceptedFilesType)
65+
}
66+
.foregroundStyle(Color.huiColors.text.body)
67+
.huiTypography(.p2)
68+
.padding(.horizontal, .huiSpaces.space16)
6369
}
64-
.foregroundStyle(Color.huiColors.text.body)
65-
.huiTypography(.p2)
66-
.padding(.horizontal, .huiSpaces.space16)
6770
}
6871
}
6972
}

0 commit comments

Comments
 (0)