2022-08-14 13:14:21 +01:00
|
|
|
//
|
|
|
|
// UserView.swift
|
|
|
|
// Mixonomer
|
|
|
|
//
|
|
|
|
// Created by Andy Pack on 14/08/2022.
|
|
|
|
// Copyright © 2022 Sarsoo. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct UserView: View {
|
|
|
|
|
|
|
|
@EnvironmentObject var liveUser: LiveUser
|
|
|
|
@Binding var user: User
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
Form {
|
|
|
|
|
|
|
|
Section {
|
|
|
|
HStack {
|
|
|
|
Text("Type")
|
|
|
|
Spacer()
|
|
|
|
Text(user.type.rawValue)
|
|
|
|
.foregroundColor(.gray)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Section(header: Text("External")) {
|
|
|
|
HStack {
|
|
|
|
Text("Spotify")
|
|
|
|
Spacer()
|
|
|
|
Text(user.spotify_linked ? "✅" : "❌")
|
|
|
|
.foregroundColor(.gray)
|
|
|
|
}
|
|
|
|
|
|
|
|
HStack {
|
|
|
|
Text("Last.fm")
|
|
|
|
Spacer()
|
|
|
|
Text(user.lastfm_username ?? "")
|
|
|
|
.foregroundColor(.gray)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Section(header: Text("Timestamps")) {
|
|
|
|
HStack {
|
|
|
|
Text("Last Web Login")
|
|
|
|
Spacer()
|
|
|
|
Text(user.last_login)
|
|
|
|
.foregroundColor(.gray)
|
|
|
|
}
|
|
|
|
|
|
|
|
HStack {
|
|
|
|
Text("Last Keygen")
|
|
|
|
Spacer()
|
|
|
|
Text(user.last_keygen)
|
|
|
|
.foregroundColor(.gray)
|
|
|
|
}
|
2022-08-15 19:24:56 +01:00
|
|
|
|
|
|
|
HStack {
|
|
|
|
Text("Last Spotify Refresh")
|
|
|
|
Spacer()
|
|
|
|
Text(user.last_refreshed)
|
|
|
|
.foregroundColor(.gray)
|
|
|
|
}
|
2022-08-14 13:14:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
.navigationBarTitle(Text(user.username))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct UserView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
2022-08-15 19:24:56 +01:00
|
|
|
UserView(user: .constant(User()))
|
2022-08-14 13:14:21 +01:00
|
|
|
}
|
|
|
|
}
|