2022-12-03 10:45:54 +01:00
|
|
|
//
|
|
|
|
// ProfileView.swift
|
|
|
|
// BeReal
|
|
|
|
//
|
|
|
|
// Created by Javier Cicchelli on 03/12/2022.
|
|
|
|
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
2022-12-03 11:37:42 +01:00
|
|
|
public struct ProfileView: View {
|
|
|
|
|
2022-12-03 11:45:54 +01:00
|
|
|
// MARK: Properties
|
|
|
|
|
|
|
|
private let logOut: () -> Void
|
|
|
|
|
2022-12-03 11:37:42 +01:00
|
|
|
// MARK: Initialisers
|
|
|
|
|
2022-12-03 11:45:54 +01:00
|
|
|
public init(logOut: @escaping () -> Void) {
|
|
|
|
self.logOut = logOut
|
|
|
|
}
|
2022-12-03 11:37:42 +01:00
|
|
|
|
|
|
|
// MARK: Body
|
|
|
|
|
|
|
|
public var body: some View {
|
|
|
|
ClearBackgroundList {
|
2022-12-03 10:45:54 +01:00
|
|
|
Section {
|
|
|
|
Image.photo
|
|
|
|
.resizable()
|
|
|
|
.scaledToFit()
|
|
|
|
.frame(width: 160)
|
|
|
|
.frame(maxWidth: .infinity)
|
|
|
|
}
|
|
|
|
.listRowBackground(Color.clear)
|
|
|
|
|
|
|
|
Section {
|
|
|
|
Label {
|
|
|
|
Text("Javier")
|
|
|
|
} icon: {
|
2022-12-03 11:37:42 +01:00
|
|
|
Text(
|
|
|
|
"profile.sections.names.label.first_name.text",
|
|
|
|
bundle: .module,
|
|
|
|
comment: "First name label text."
|
|
|
|
)
|
2022-12-03 10:45:54 +01:00
|
|
|
}
|
|
|
|
.labelStyle(.nameAndValue)
|
|
|
|
|
|
|
|
Label {
|
|
|
|
Text("Cicchelli")
|
|
|
|
} icon: {
|
2022-12-03 11:37:42 +01:00
|
|
|
Text(
|
|
|
|
"profile.sections.names.label.last_name.text",
|
|
|
|
bundle: .module,
|
|
|
|
comment: "Last name label text."
|
|
|
|
)
|
2022-12-03 10:45:54 +01:00
|
|
|
}
|
|
|
|
.labelStyle(.nameAndValue)
|
|
|
|
} header: {
|
2022-12-03 11:37:42 +01:00
|
|
|
Text(
|
|
|
|
"profile.sections.names.header.text",
|
|
|
|
bundle: .module,
|
|
|
|
comment: "Names section header text."
|
|
|
|
)
|
2022-12-03 10:45:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Section {
|
|
|
|
Label {
|
|
|
|
Text("71207ee4c0573fde80b03643caafe62731406404")
|
|
|
|
} icon: {
|
2022-12-03 11:37:42 +01:00
|
|
|
Text(
|
|
|
|
"profile.sections.root_info.label.identifier.text",
|
|
|
|
bundle: .module,
|
|
|
|
comment: "Identifier label text."
|
|
|
|
)
|
2022-12-03 10:45:54 +01:00
|
|
|
}
|
|
|
|
.labelStyle(.nameAndValue)
|
|
|
|
|
|
|
|
Label {
|
|
|
|
Text("Yes")
|
|
|
|
} icon: {
|
2022-12-03 11:37:42 +01:00
|
|
|
Text(
|
|
|
|
"profile.sections.root_info.label.is_directory.text",
|
|
|
|
bundle: .module,
|
|
|
|
comment: "Is directory label text."
|
|
|
|
)
|
2022-12-03 10:45:54 +01:00
|
|
|
}
|
|
|
|
.labelStyle(.nameAndValue)
|
|
|
|
|
|
|
|
Label {
|
|
|
|
Text("3 days ago")
|
|
|
|
} icon: {
|
2022-12-03 11:37:42 +01:00
|
|
|
Text(
|
|
|
|
"profile.sections.root_info.label.last_modified.text",
|
|
|
|
bundle: .module,
|
|
|
|
comment: "Last modified label text."
|
|
|
|
)
|
2022-12-03 10:45:54 +01:00
|
|
|
}
|
|
|
|
.labelStyle(.nameAndValue)
|
|
|
|
|
|
|
|
Label {
|
|
|
|
Text("My files")
|
|
|
|
} icon: {
|
2022-12-03 11:37:42 +01:00
|
|
|
Text(
|
|
|
|
"profile.sections.root_info.label.name.text",
|
|
|
|
bundle: .module,
|
|
|
|
comment: "Root name label text."
|
|
|
|
)
|
2022-12-03 10:45:54 +01:00
|
|
|
}
|
|
|
|
.labelStyle(.nameAndValue)
|
|
|
|
} header: {
|
2022-12-03 11:37:42 +01:00
|
|
|
Text(
|
|
|
|
"profile.sections.root_info.header.text",
|
|
|
|
bundle: .module,
|
|
|
|
comment: "Root item information header text."
|
|
|
|
)
|
2022-12-03 10:45:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Section {
|
|
|
|
Button {
|
2022-12-03 11:45:54 +01:00
|
|
|
logOut()
|
2022-12-03 10:45:54 +01:00
|
|
|
} label: {
|
2022-12-03 11:37:42 +01:00
|
|
|
Text(
|
|
|
|
"profile.button.log_out.text",
|
|
|
|
bundle: .module,
|
|
|
|
comment: "Log out button text."
|
|
|
|
)
|
|
|
|
.fontWeight(.semibold)
|
|
|
|
.foregroundColor(.primary)
|
|
|
|
.frame(maxWidth: .infinity)
|
2022-12-03 10:45:54 +01:00
|
|
|
}
|
|
|
|
.tint(.orange)
|
|
|
|
.buttonStyle(.borderedProminent)
|
|
|
|
.buttonBorderShape(.roundedRectangle(radius: 8))
|
|
|
|
.controlSize(.large)
|
|
|
|
}
|
|
|
|
.listRowBackground(Color.clear)
|
|
|
|
}
|
|
|
|
.background(Color.red)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: - Images+Constants
|
|
|
|
|
|
|
|
private extension Image {
|
|
|
|
static let photo = Image(systemName: "person.crop.circle.fill")
|
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: - Previews
|
|
|
|
|
|
|
|
struct ProfileView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
2022-12-03 11:45:54 +01:00
|
|
|
ProfileView {
|
|
|
|
// closure for log out action.
|
|
|
|
}
|
2022-12-03 10:45:54 +01:00
|
|
|
}
|
|
|
|
}
|