Start on ServerListView

This commit is contained in:
Ethan Pippin 2021-10-15 00:14:53 -06:00
parent 64f50be2aa
commit 8f79ecbc77
5 changed files with 43 additions and 69 deletions

View File

@ -23,34 +23,26 @@ struct ServerListView: View {
Button { Button {
serverListRouter.route(to: \.userList, server) serverListRouter.route(to: \.userList, server)
} label: { } label: {
ZStack(alignment: Alignment.leading) { HStack {
Rectangle() Image(systemName: "server.rack")
.foregroundColor(Color.secondarySystemFill) .font(.system(size: 72))
.frame(height: 100) .foregroundColor(.primary)
.cornerRadius(10)
HStack { VStack(alignment: .leading, spacing: 5) {
Image(systemName: "server.rack") Text(server.name)
.font(.system(size: 36)) .font(.title2)
.foregroundColor(.primary) .foregroundColor(.primary)
VStack(alignment: .leading, spacing: 5) { Text(server.uri)
Text(server.name) .font(.footnote)
.font(.title2) .disabled(true)
.foregroundColor(.primary) .foregroundColor(.secondary)
Text(server.uri) Text(viewModel.userTextFor(server: server))
.font(.footnote) .font(.footnote)
.disabled(true) .foregroundColor(.primary)
.foregroundColor(.secondary) }
Text(viewModel.userTextFor(server: server))
.font(.footnote)
.foregroundColor(.primary)
}
}.padding([.leading])
} }
.padding()
} }
.contextMenu { .contextMenu {
Button(role: .destructive) { Button(role: .destructive) {
@ -62,32 +54,25 @@ struct ServerListView: View {
} }
} }
} }
.padding(.top, 100)
} }
@ViewBuilder @ViewBuilder
private var noServerView: some View { private var noServerView: some View {
VStack { VStack {
Text("Connect to a Jellyfin server to get started") Text("Connect to a Jellyfin server to get started")
.frame(minWidth: 50, maxWidth: 240) .frame(minWidth: 50, maxWidth: 500)
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
.font(.callout)
Button { Button {
serverListRouter.route(to: \.connectToServer) serverListRouter.route(to: \.connectToServer)
} label: { } label: {
ZStack { Text("Connect")
Rectangle() .bold()
.foregroundColor(Color.jellyfinPurple) .font(.callout)
.frame(maxWidth: 500, maxHeight: 50)
.frame(height: 50)
.cornerRadius(10)
.padding([.leading, .trailing], 30)
.padding([.top, .bottom], 20)
Text("Connect")
.foregroundColor(Color.white)
.bold()
}
} }
.padding(.top, 40)
} }
} }
@ -98,6 +83,7 @@ struct ServerListView: View {
.offset(y: -50) .offset(y: -50)
} else { } else {
listView listView
.frame(width: 3000)
} }
} }
@ -131,6 +117,7 @@ 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) {
@ -142,3 +129,11 @@ struct ServerListView: View {
} }
} }
} }
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
NavigationView {
ServerListView(viewModel: ServerListViewModel())
}
}
}

View File

@ -37,7 +37,6 @@
5321753E2671DE9C005491E6 /* Typings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 535870AC2669D8DD00D05A09 /* Typings.swift */; }; 5321753E2671DE9C005491E6 /* Typings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 535870AC2669D8DD00D05A09 /* Typings.swift */; };
532175402671EE4F005491E6 /* LibraryFilterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53E4E646263F6CF100F67C6B /* LibraryFilterView.swift */; }; 532175402671EE4F005491E6 /* LibraryFilterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53E4E646263F6CF100F67C6B /* LibraryFilterView.swift */; };
53272532268BF09D0035FBF1 /* MediaViewActionButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53272531268BF09D0035FBF1 /* MediaViewActionButton.swift */; }; 53272532268BF09D0035FBF1 /* MediaViewActionButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53272531268BF09D0035FBF1 /* MediaViewActionButton.swift */; };
53272535268BF9710035FBF1 /* SwiftUIFocusGuide in Frameworks */ = {isa = PBXBuildFile; productRef = 53272534268BF9710035FBF1 /* SwiftUIFocusGuide */; };
53272537268C1DBB0035FBF1 /* SeasonItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53272536268C1DBB0035FBF1 /* SeasonItemView.swift */; }; 53272537268C1DBB0035FBF1 /* SeasonItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53272536268C1DBB0035FBF1 /* SeasonItemView.swift */; };
53272539268C20100035FBF1 /* EpisodeItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53272538268C20100035FBF1 /* EpisodeItemView.swift */; }; 53272539268C20100035FBF1 /* EpisodeItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53272538268C20100035FBF1 /* EpisodeItemView.swift */; };
532E68CF267D9F6B007B9F13 /* VideoPlayerCastDeviceSelector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 532E68CE267D9F6B007B9F13 /* VideoPlayerCastDeviceSelector.swift */; }; 532E68CF267D9F6B007B9F13 /* VideoPlayerCastDeviceSelector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 532E68CE267D9F6B007B9F13 /* VideoPlayerCastDeviceSelector.swift */; };
@ -583,7 +582,6 @@
53A431BF266B0FFE0016769F /* JellyfinAPI in Frameworks */, 53A431BF266B0FFE0016769F /* JellyfinAPI in Frameworks */,
535870912669D7A800D05A09 /* Introspect in Frameworks */, 535870912669D7A800D05A09 /* Introspect in Frameworks */,
6261A0E026A0AB710072EF1C /* CombineExt in Frameworks */, 6261A0E026A0AB710072EF1C /* CombineExt in Frameworks */,
53272535268BF9710035FBF1 /* SwiftUIFocusGuide in Frameworks */,
536D3D84267BEA550004248C /* ParallaxView in Frameworks */, 536D3D84267BEA550004248C /* ParallaxView in Frameworks */,
53ABFDDC267972BF00886593 /* TVServices.framework in Frameworks */, 53ABFDDC267972BF00886593 /* TVServices.framework in Frameworks */,
E13DD3CD27164CA7009D4DAF /* CoreStore in Frameworks */, E13DD3CD27164CA7009D4DAF /* CoreStore in Frameworks */,
@ -1304,7 +1302,6 @@
53A431BE266B0FFE0016769F /* JellyfinAPI */, 53A431BE266B0FFE0016769F /* JellyfinAPI */,
53ABFDEC26799D7700886593 /* ActivityIndicator */, 53ABFDEC26799D7700886593 /* ActivityIndicator */,
536D3D83267BEA550004248C /* ParallaxView */, 536D3D83267BEA550004248C /* ParallaxView */,
53272534268BF9710035FBF1 /* SwiftUIFocusGuide */,
53649AAE269CFAF600A2D8B7 /* Puppy */, 53649AAE269CFAF600A2D8B7 /* Puppy */,
6261A0DF26A0AB710072EF1C /* CombineExt */, 6261A0DF26A0AB710072EF1C /* CombineExt */,
6220D0C826D63F3700B8E046 /* Stinsen */, 6220D0C826D63F3700B8E046 /* Stinsen */,
@ -1428,7 +1425,6 @@
625CB5782678C4A400530A6E /* XCRemoteSwiftPackageReference "ActivityIndicator" */, 625CB5782678C4A400530A6E /* XCRemoteSwiftPackageReference "ActivityIndicator" */,
536D3D82267BEA550004248C /* XCRemoteSwiftPackageReference "ParallaxView" */, 536D3D82267BEA550004248C /* XCRemoteSwiftPackageReference "ParallaxView" */,
53EC6E23267EB10F006DD26A /* XCRemoteSwiftPackageReference "SwiftyJSON" */, 53EC6E23267EB10F006DD26A /* XCRemoteSwiftPackageReference "SwiftyJSON" */,
53272533268BF9710035FBF1 /* XCRemoteSwiftPackageReference "SwiftUIFocusGuide" */,
53649AAB269CFAEA00A2D8B7 /* XCRemoteSwiftPackageReference "Puppy" */, 53649AAB269CFAEA00A2D8B7 /* XCRemoteSwiftPackageReference "Puppy" */,
6260FFF726A09754003FA968 /* XCRemoteSwiftPackageReference "CombineExt" */, 6260FFF726A09754003FA968 /* XCRemoteSwiftPackageReference "CombineExt" */,
62C29E9A26D0FE4100C1D2E7 /* XCRemoteSwiftPackageReference "stinsen" */, 62C29E9A26D0FE4100C1D2E7 /* XCRemoteSwiftPackageReference "stinsen" */,
@ -2370,14 +2366,6 @@
/* End XCConfigurationList section */ /* End XCConfigurationList section */
/* Begin XCRemoteSwiftPackageReference section */ /* Begin XCRemoteSwiftPackageReference section */
53272533268BF9710035FBF1 /* XCRemoteSwiftPackageReference "SwiftUIFocusGuide" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/rmnblm/SwiftUIFocusGuide";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.1.0;
};
};
5335256F265EA0A0006CCA86 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = { 5335256F265EA0A0006CCA86 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = {
isa = XCRemoteSwiftPackageReference; isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/siteline/SwiftUI-Introspect"; repositoryURL = "https://github.com/siteline/SwiftUI-Introspect";
@ -2469,11 +2457,6 @@
/* End XCRemoteSwiftPackageReference section */ /* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */ /* Begin XCSwiftPackageProductDependency section */
53272534268BF9710035FBF1 /* SwiftUIFocusGuide */ = {
isa = XCSwiftPackageProductDependency;
package = 53272533268BF9710035FBF1 /* XCRemoteSwiftPackageReference "SwiftUIFocusGuide" */;
productName = SwiftUIFocusGuide;
};
53352570265EA0A0006CCA86 /* Introspect */ = { 53352570265EA0A0006CCA86 /* Introspect */ = {
isa = XCSwiftPackageProductDependency; isa = XCSwiftPackageProductDependency;
package = 5335256F265EA0A0006CCA86 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */; package = 5335256F265EA0A0006CCA86 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */;

View File

@ -136,15 +136,6 @@
"version": "0.1.3" "version": "0.1.3"
} }
}, },
{
"package": "SwiftUIFocusGuide",
"repositoryURL": "https://github.com/rmnblm/SwiftUIFocusGuide",
"state": {
"branch": null,
"revision": "fb8eefaccb2954efedc19a5539241f370baa4a10",
"version": "0.1.0"
}
},
{ {
"package": "SwiftyJSON", "package": "SwiftyJSON",
"repositoryURL": "https://github.com/SwiftyJSON/SwiftyJSON", "repositoryURL": "https://github.com/SwiftyJSON/SwiftyJSON",

View File

@ -15,11 +15,6 @@ import Foundation
import JellyfinAPI import JellyfinAPI
import UIKit import UIKit
#if os(tvOS)
import TVServices
import SwiftUIFocusGuide
#endif
typealias CurrentLogin = (server: SwiftfinStore.State.Server, user: SwiftfinStore.State.User) typealias CurrentLogin = (server: SwiftfinStore.State.Server, user: SwiftfinStore.State.User)
// MARK: NewSessionManager // MARK: NewSessionManager

View File

@ -13,6 +13,7 @@ import Defaults
enum SwiftfinStore { enum SwiftfinStore {
// MARK: State
// Safe, copyable representations of their underlying CoreStoredObject's // Safe, copyable representations of their underlying CoreStoredObject's
// Relationships are represented by the related object's IDs or value // Relationships are represented by the related object's IDs or value
enum State { enum State {
@ -33,6 +34,10 @@ enum SwiftfinStore {
self.version = version self.version = version
self.userIDs = usersIDs self.userIDs = usersIDs
} }
static var sample: Server {
return Server(uri: "https://www.notaurl.com", name: "Johnny's Tree", id: "123abc", os: "macOS", version: "1.1.1", usersIDs: ["1", "2"])
}
} }
struct User { struct User {
@ -47,9 +52,14 @@ enum SwiftfinStore {
self.serverID = serverID self.serverID = serverID
self.accessToken = accessToken self.accessToken = accessToken
} }
static var sample: User {
return User(username: "JohnnyAppleseed", id: "123abc", serverID: "123abc", accessToken: "open-sesame")
}
} }
} }
// MARK: Models
enum Models { enum Models {
final class StoredServer: CoreStoreObject { final class StoredServer: CoreStoreObject {