New App Layout: Added missing empty states in room list and space bottom sheet

This commit is contained in:
Gil Eluard
2022-08-19 17:12:33 +02:00
parent 1e0dfdb7d3
commit 74454d11cb
14 changed files with 355 additions and 16 deletions
@@ -29,6 +29,18 @@ struct SpaceSelector: View {
@ObservedObject var viewModel: SpaceSelectorViewModel.Context
var body: some View {
VStack {
if !viewModel.viewState.items.isEmpty {
itemListView
} else {
emptyListPlaceholder
}
}
.background(theme.colors.background.edgesIgnoringSafeArea(.all))
.accentColor(theme.colors.accent)
}
private var itemListView: some View {
ScrollView {
LazyVStack {
ForEach(viewModel.viewState.items) { item in
@@ -50,7 +62,6 @@ struct SpaceSelector: View {
}
}
.frame(maxHeight: .infinity)
.background(theme.colors.background.edgesIgnoringSafeArea(.all))
.navigationTitle(viewModel.viewState.navigationTitle)
.toolbar {
ToolbarItem(placement: .confirmationAction) {
@@ -66,7 +77,32 @@ struct SpaceSelector: View {
}
}
}
.accentColor(theme.colors.accent)
}
private var emptyListPlaceholder: some View {
VStack {
Spacer()
Text(VectorL10n.spaceSelectorEmptyViewTitle)
.foregroundColor(theme.colors.primaryContent)
.font(theme.fonts.title3SB)
.accessibility(identifier: "emptyListPlaceholderTitle")
Spacer()
.frame(height: 24)
Text(VectorL10n.spaceSelectorEmptyViewInformation)
.foregroundColor(theme.colors.secondaryContent)
.font(theme.fonts.callout)
.multilineTextAlignment(.center)
.accessibility(identifier: "emptyListPlaceholderMessage")
Spacer()
Button { viewModel.send(viewAction: .createSpace) } label: {
Text(VectorL10n.spaceSelectorCreateSpace)
.font(theme.fonts.bodySB)
}
.buttonStyle(PrimaryActionButtonStyle())
.accessibility(identifier: "createSpaceButton")
}
.padding(.horizontal, 24)
.padding(.bottom, 24)
}
}