Finish ServerListView and UserListView

This commit is contained in:
Ethan Pippin 2021-10-15 00:43:14 -06:00
parent 8f79ecbc77
commit 2d56c01bb9
3 changed files with 23 additions and 46 deletions

View File

@ -42,8 +42,11 @@ struct ServerListView: View {
.font(.footnote) .font(.footnote)
.foregroundColor(.primary) .foregroundColor(.primary)
} }
Spacer()
} }
} }
.padding([.leading, .trailing], 100)
.contextMenu { .contextMenu {
Button(role: .destructive) { Button(role: .destructive) {
viewModel.remove(server: server) viewModel.remove(server: server)
@ -53,8 +56,9 @@ struct ServerListView: View {
} }
} }
} }
.padding(.top, 50)
} }
.padding(.top, 100) .padding(.top, 50)
} }
@ViewBuilder @ViewBuilder
@ -83,7 +87,6 @@ struct ServerListView: View {
.offset(y: -50) .offset(y: -50)
} else { } else {
listView listView
.frame(width: 3000)
} }
} }
@ -117,7 +120,6 @@ struct ServerListView: View {
var body: some View { var body: some View {
innerBody innerBody
.frame(width: 1500)
.navigationTitle("Servers") .navigationTitle("Servers")
.toolbar { .toolbar {
ToolbarItemGroup(placement: .navigationBarTrailing) { ToolbarItemGroup(placement: .navigationBarTrailing) {
@ -129,11 +131,3 @@ struct ServerListView: View {
} }
} }
} }
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
NavigationView {
ServerListView(viewModel: ServerListViewModel())
}
}
}

View File

@ -22,17 +22,7 @@ struct UserListView: View {
Button { Button {
viewModel.login(user: user) viewModel.login(user: user)
} label: { } label: {
ZStack(alignment: Alignment.leading) {
Rectangle()
.foregroundColor(Color.secondarySystemFill)
.frame(height: 70)
.cornerRadius(10)
HStack { HStack {
Image(systemName: "person.crop.circle.fill")
.font(.system(size: 46))
.foregroundColor(.primary)
Text(user.username) Text(user.username)
.font(.title2) .font(.title2)
@ -41,10 +31,9 @@ struct UserListView: View {
if viewModel.isLoading { if viewModel.isLoading {
ProgressView() ProgressView()
} }
}.padding(.leading)
} }
.padding()
} }
.padding([.leading, .trailing], 100)
.contextMenu { .contextMenu {
Button(role: .destructive) { Button(role: .destructive) {
viewModel.remove(user: user) viewModel.remove(user: user)
@ -54,33 +43,27 @@ struct UserListView: View {
} }
} }
} }
.padding(.top, 50)
} }
.padding(.top, 50)
} }
@ViewBuilder @ViewBuilder
private var noUserView: some View { private var noUserView: some View {
VStack { VStack {
Text("Sign in to get started") Text("Sign in to get started")
.frame(minWidth: 50, maxWidth: 240) .frame(minWidth: 50, maxWidth: 500)
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
.font(.callout)
Button { Button {
userListRouter.route(to: \.userSignIn, viewModel.server) userListRouter.route(to: \.userSignIn, viewModel.server)
} label: { } label: {
ZStack {
Rectangle()
.foregroundColor(Color.jellyfinPurple)
.frame(maxWidth: 500, maxHeight: 50)
.frame(height: 50)
.cornerRadius(10)
.padding([.leading, .trailing], 30)
.padding([.top, .bottom], 20)
Text("Sign in") Text("Sign in")
.foregroundColor(Color.white)
.bold() .bold()
.font(.callout)
} }
} .padding(.top, 40)
} }
} }

View File

@ -24,7 +24,7 @@ final class LibraryListViewModel: ViewModel {
} }
func requestLibraries() { func requestLibraries() {
UserViewsAPI.getUserViews(userId: SessionManager.main.currentLogin.user.id ?? "val was nil") UserViewsAPI.getUserViews(userId: SessionManager.main.currentLogin.user.id)
.trackActivity(loading) .trackActivity(loading)
.sink(receiveCompletion: { completion in .sink(receiveCompletion: { completion in
self.handleAPIRequestError(completion: completion) self.handleAPIRequestError(completion: completion)