Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d75edfe
Create UI
petkybenedek Mar 3, 2026
7323f78
Merge branch 'master' into feature/MBL-19529-Dashboard-simple-edit-mode
petkybenedek Mar 3, 2026
aeb8276
Merge master
petkybenedek Mar 3, 2026
3713440
Correct animation
petkybenedek Mar 3, 2026
35fdfc9
Correct logic
petkybenedek Mar 3, 2026
bffad74
Correct tests and claude findings
petkybenedek Mar 3, 2026
eb5320a
Requested changes
petkybenedek Mar 4, 2026
eeb566e
Color selector corrections
petkybenedek Mar 5, 2026
52aac49
Merge branch 'master' into feature/MBL-19529-Dashboard-simple-edit-mode
petkybenedek Mar 5, 2026
2336355
Remove no longer set variable tests.
vargaat Mar 6, 2026
4742afb
Remove unnecessary test
petkybenedek Mar 6, 2026
3e2bca1
Merge branch 'feature/MBL-19529-Dashboard-simple-edit-mode' of https:…
petkybenedek Mar 6, 2026
19bd6ab
Increase popver size
petkybenedek Mar 6, 2026
198391f
- Split DashboardWidgetIdentifier into SystemWidgetIdentifier (fixe…
vargaat Mar 6, 2026
7c4c007
Add color saving.
vargaat Mar 9, 2026
2afe479
Add course settings switches. Move converences to system widgets.
vargaat Mar 9, 2026
70ad1d1
Add unit tests.
vargaat Mar 9, 2026
2ed5649
Use ID based color saving.
vargaat Mar 10, 2026
a7ebd90
Requested changes, change settings presentation logic
petkybenedek Mar 10, 2026
09d93cb
Update unit tests.
vargaat Mar 10, 2026
40bac3e
Merge branch 'feature/MBL-19529-Dashboard-simple-edit-mode' into feat…
vargaat Mar 10, 2026
763f10a
Rename dashboard settings view to screen.
vargaat Mar 11, 2026
704c4d6
Move factory methods to widget enums.
vargaat Mar 11, 2026
3dbcdcd
Also move custom settings view factory to widget id file.
vargaat Mar 11, 2026
afeca50
Update colors.
vargaat Mar 11, 2026
3bad66c
Update hidden widget update logic.
vargaat Mar 11, 2026
614361b
Fix unit test. Update done button color.
vargaat Mar 11, 2026
82f547c
Merge branch 'master' into feature/MBL-19529-Dashboard-simple-edit-mode
vargaat Mar 11, 2026
47f125f
Merge branch 'feature/MBL-19529-Dashboard-simple-edit-mode' into feat…
vargaat Mar 11, 2026
08f384c
Implement code review suggestions.
vargaat Mar 12, 2026
3359454
Merge branch 'master' into feature/MBL-19529-Learner-Dashboard-settin…
vargaat Mar 12, 2026
df062d5
Shorten test file name.
vargaat Mar 12, 2026
617c604
Create FlexibleGrid and place the dashboard colors in it.
petkybenedek Mar 13, 2026
9c8dd1e
Extract default course colors from interactor.
vargaat Mar 13, 2026
a83bbaa
Remove unnecessary helper.
vargaat Mar 13, 2026
fc45bfb
Implement multiple UI related code review suggestions.
vargaat Mar 13, 2026
c0f9aa0
Add back bottom padding.
vargaat Mar 13, 2026
882f35a
Fix lint violation.
vargaat Mar 13, 2026
c6b9674
Add customize dashboard button.
vargaat Mar 13, 2026
ef05d64
Add no widgets view.
vargaat Mar 13, 2026
e11edec
Hide sub-settings view from dashboard settings if the widget is turne…
vargaat Mar 13, 2026
e92b516
Fix color selection checkmark not being visible in dark mode.
vargaat Mar 13, 2026
695d41e
Fix edit dialog not updating when dark mode changes when being presen…
vargaat Mar 13, 2026
4b18748
Hide up and down widget actions from voiceover when they are disabled.
vargaat Mar 16, 2026
0e49fc8
Update unit tests.
vargaat Mar 16, 2026
c45fc64
Merge branch 'master' into feature/MBL-19529-Learner-Dashboard-Settin…
vargaat Mar 16, 2026
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// This file is part of Canvas.
// Copyright (C) 2026-present Instructure, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//

import Core
import SwiftUI

struct LearnerDashboardAllWidgetsTurnedOffView: View {

var body: some View {
InteractivePanda(
scene: SpacePanda(),
title: String(localized: "All widgets are turned off", bundle: .student),
subtitle: String(localized: "Add widgets using Customize Dashboard or Dashboard Settings.", bundle: .student)
)
.paddingStyle(.top, .standard)
.paddingStyle(.top, .standard)
.frame(maxWidth: .infinity)
}
}

#if DEBUG

#Preview {
LearnerDashboardAllWidgetsTurnedOffView()
.padding()
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct LearnerDashboardScreen: View {
@State private var isSettingsPresented = false
@Environment(\.viewController) private var viewController
@Environment(\.appEnvironment) private var env
@Environment(\.colorScheme) private var colorScheme

private let screenPadding = InstUI.Styles.Padding.standard
@State private var isAnimationEnabled = false
Expand Down Expand Up @@ -55,6 +56,11 @@ struct LearnerDashboardScreen: View {
widgetViewModel.makeView()
}
}
if viewModel.showWidgetsTurnedOffPanda {
LearnerDashboardAllWidgetsTurnedOffView()
}

customizeDashboardButton
}
.paddingStyle(.all, screenPadding)
.animation(isAnimationEnabled ? .dashboardWidget : nil, value: viewModel.widgets.map(\.layoutIdentifier))
Expand Down Expand Up @@ -86,6 +92,19 @@ struct LearnerDashboardScreen: View {
}
}

private var customizeDashboardButton: some View {
Button {
isSettingsPresented = true
} label: {
InstUI.PillContent(
title: String(localized: "Customize Dashboard", bundle: .student),
leadingIcon: .editLine,
size: .height30
)
}
.buttonStyle(.pillTintOutlined)
}

@available(iOS, introduced: 26, message: "Legacy version exists")
private var profileMenuButton: some View {
Button {
Expand Down Expand Up @@ -131,6 +150,7 @@ struct LearnerDashboardScreen: View {
NavigationStack {
LearnerDashboardSettingsScreen(viewModel: viewModel.makeSettingsViewModel())
}
.environment(\.colorScheme, colorScheme)
.accentColor(.brandPrimary)
.tint(.brandPrimary)
}
Expand Down Expand Up @@ -158,6 +178,7 @@ struct LearnerDashboardScreen: View {
NavigationStack {
LearnerDashboardSettingsScreen(viewModel: viewModel.makeSettingsViewModel())
}
.environment(\.colorScheme, colorScheme)
.accentColor(.brandPrimary)
.tint(.brandPrimary)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,12 @@ final class LearnerDashboardViewModel {
private(set) var state: InstUI.ScreenState = .loading
private(set) var widgets: [any DashboardWidgetViewModel] = []
private(set) var mainColor: Color
private(set) var showWidgetsTurnedOffPanda: Bool = false
let snackBarViewModel: SnackBarViewModel

let screenConfig = InstUI.BaseScreenConfig(
refreshable: true,
showsScrollIndicators: false,
emptyPandaConfig: .init(
scene: SpacePanda(),
title: String(localized: "Welcome to Canvas!", bundle: .student),
subtitle: String(
localized: "You don't have any courses yet — so things are a bit quiet here. Once you enroll in a class, your dashboard will start filling up with new activity.",
bundle: .student
)
),
backgroundColor: .backgroundLight
)

Expand Down Expand Up @@ -109,9 +102,8 @@ final class LearnerDashboardViewModel {
.sink { [weak self] result in
guard let self else { return }
widgets = result
if result.isNotEmpty {
state = .data
}
showWidgetsTurnedOffPanda = result.allEditableWidgetsTurnedOff
state = .data
refresh(ignoreCache: false)
}
.store(in: &subscriptions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ struct LearnerDashboardColorSelectorView: View {
Image.checkLine
.resizable()
.scaledFrame(size: 24)
.foregroundStyle(
selectedColor == whiteColor
? .textLightest.variantForDarkMode
: .textLightest.variantForLightMode
)
.foregroundStyle(.textLightest)
}
}
.scaledFrame(size: 40)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct LearnerDashboardSettingsWidgetCardView: View {
.padding(.bottom, 14)
.accessibilityElement(children: .combine)

if let subSettings = subSettingsView {
if let subSettings = subSettingsView, isVisible {
InstUI.Divider()
.padding(.horizontal, -16)
subSettings
Expand Down Expand Up @@ -80,6 +80,7 @@ struct LearnerDashboardSettingsWidgetCardView: View {
localized: "Move \(config.id.settingsTitle(username: username)) widget up",
bundle: .student
))
.accessibilityHidden(isMoveUpDisabled)

InstUI.Divider()
.padding(.vertical, 4)
Expand All @@ -95,6 +96,7 @@ struct LearnerDashboardSettingsWidgetCardView: View {
localized: "Move \(config.id.settingsTitle(username: username)) widget down",
bundle: .student
))
.accessibilityHidden(isMoveDownDisabled)
}
.padding(.horizontal, 8)
.fixedSize(horizontal: false, vertical: true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,9 @@ extension DashboardWidgetViewModel {
!isHiddenInEmptyState || state != .empty
}
}

extension [any DashboardWidgetViewModel] {
var allEditableWidgetsTurnedOff: Bool {
allSatisfy { EditableWidgetIdentifier(rawValue: $0.id) == nil }
}
}
6 changes: 6 additions & 0 deletions Student/Student/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -19924,6 +19924,9 @@
}
}
}
},
"Add widgets using Customize Dashboard or Dashboard Settings." : {

},
"All Courses" : {

Expand Down Expand Up @@ -20197,6 +20200,9 @@
}
}
}
},
"All widgets are turned off" : {

},
"Allowed Attempts:" : {
"localizations" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,11 @@ final class LearnerDashboardViewModelTests: StudentTestCase {

XCTAssertEqual(testee.screenConfig.refreshable, true)
XCTAssertEqual(testee.screenConfig.showsScrollIndicators, false)
XCTAssertEqual(testee.screenConfig.emptyPandaConfig.scene is SpacePanda, true)
XCTAssertEqual(
testee.screenConfig.emptyPandaConfig.title,
String(localized: "Welcome to Canvas!", bundle: .student)
)
}

// MARK: - State management

func test_init_withNoWidgets_shouldKeepLoadingState() {
func test_init_withNoWidgets_shouldSetDataState() {
testee = LearnerDashboardViewModel(
interactor: interactor,
colorInteractor: colorInteractor,
Expand All @@ -111,7 +106,7 @@ final class LearnerDashboardViewModelTests: StudentTestCase {
interactor.loadWidgetsPublisher.send([])
scheduler.advance()

XCTAssertEqual(testee.state, .loading)
XCTAssertEqual(testee.state, .data)
}

func test_init_withWidgets_shouldSetDataState() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
//
// This file is part of Canvas.
// Copyright (C) 2026-present Instructure, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//

import Combine
@testable import Core
@testable import Student
import SwiftUI
import XCTest

final class DashboardWidgetViewModelArrayTests: XCTestCase {

// MARK: - allEditableWidgetsTurnedOff

func test_allEditableWidgetsTurnedOff_withEmptyArray_shouldBeTrue() {
let widgets: [any DashboardWidgetViewModel] = []

XCTAssertTrue(widgets.allEditableWidgetsTurnedOff)
}

func test_allEditableWidgetsTurnedOff_withOnlySystemWidgets_shouldBeTrue() {
let widgets: [any DashboardWidgetViewModel] = [
MockDashboardWidgetViewModel(id: SystemWidgetIdentifier.courseInvitations.rawValue)
]

XCTAssertTrue(widgets.allEditableWidgetsTurnedOff)
}

func test_allEditableWidgetsTurnedOff_withEditableWidget_shouldBeFalse() {
let widgets: [any DashboardWidgetViewModel] = [
MockDashboardWidgetViewModel(id: EditableWidgetIdentifier.helloWidget.rawValue)
]

XCTAssertFalse(widgets.allEditableWidgetsTurnedOff)
}

func test_allEditableWidgetsTurnedOff_withSystemAndEditableWidgets_shouldBeFalse() {
let widgets: [any DashboardWidgetViewModel] = [
MockDashboardWidgetViewModel(id: SystemWidgetIdentifier.courseInvitations.rawValue),
MockDashboardWidgetViewModel(id: EditableWidgetIdentifier.coursesAndGroups.rawValue)
]

XCTAssertFalse(widgets.allEditableWidgetsTurnedOff)
}
}

private final class MockDashboardWidgetViewModel: DashboardWidgetViewModel {
let id: String
let state: InstUI.ScreenState = .data
let isHiddenInEmptyState = false

init(id: String) {
self.id = id
}

func makeView() -> AnyView { AnyView(EmptyView()) }

func refresh(ignoreCache: Bool) -> AnyPublisher<Void, Never> {
Just(()).eraseToAnyPublisher()
}
}
Loading