import SwiftUI

struct NgaNotificationMainView: View {
    @ObservedObject var taskViewModel = TaskViewModel()

    var body: some View {
        TaskTitleView(
            taskViewModel: taskViewModel,
            title: TaskViewMode.NgaNotification.title,
            viewMode: TaskViewMode.MenuList
        )

        ScrollViewReader { proxy in
            ScrollView(.vertical){
                NgaNotificationView(taskViewModel: taskViewModel)
            }
            .onChange(of: taskViewModel.viewMode){ newViewMode in
                proxy.scrollTo(0, anchor: .top)
            }
        }

        Spacer()
            .frame(height: 55)
    }
}

#Preview {
    NgaNotificationMainView(taskViewModel: TaskViewModel())
}
