Fix iCloud icon and move to the right
This commit is contained in:
parent
fc834ab367
commit
ca03d057fc
|
@ -80,7 +80,7 @@ public final class Theme: ObservableObject {
|
|||
switch $0 {
|
||||
case .add: return "plus"
|
||||
case .close: return "xmark"
|
||||
case .cloud: return "cloud"
|
||||
case .cloud: return "icloud"
|
||||
case .contextDuplicate: return "plus.square.on.square"
|
||||
case .contextRemove: return "trash"
|
||||
case .copy: return "doc.on.doc"
|
||||
|
|
|
@ -38,31 +38,18 @@ struct ProfileCardView: View {
|
|||
|
||||
let header: ProfileHeader
|
||||
|
||||
@ObservedObject
|
||||
var profileManager: ProfileManager
|
||||
|
||||
var body: some View {
|
||||
switch style {
|
||||
case .compact:
|
||||
HStack {
|
||||
Text(header.name)
|
||||
.themeTruncating()
|
||||
if isShared {
|
||||
ThemeImage(.cloud)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
case .full:
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Text(header.name)
|
||||
.font(.headline)
|
||||
.themeTruncating()
|
||||
if isShared {
|
||||
ThemeImage(.cloud)
|
||||
}
|
||||
}
|
||||
Text(Strings.Views.Profiles.Rows.modules(header.modules.count))
|
||||
.font(.subheadline)
|
||||
.foregroundStyle(.secondary)
|
||||
|
@ -72,12 +59,6 @@ struct ProfileCardView: View {
|
|||
}
|
||||
}
|
||||
|
||||
private extension ProfileCardView {
|
||||
var isShared: Bool {
|
||||
profileManager.isRemotelyShared(profileWithId: header.id)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Previews
|
||||
|
||||
#Preview {
|
||||
|
@ -85,15 +66,13 @@ private extension ProfileCardView {
|
|||
Section {
|
||||
ProfileCardView(
|
||||
style: .compact,
|
||||
header: Profile.mock.header(),
|
||||
profileManager: .mock
|
||||
header: Profile.mock.header()
|
||||
)
|
||||
}
|
||||
Section {
|
||||
ProfileCardView(
|
||||
style: .full,
|
||||
header: Profile.mock.header(),
|
||||
profileManager: .mock
|
||||
header: Profile.mock.header()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,8 @@ struct ProfileRowView: View, TunnelContextProviding {
|
|||
|
||||
let style: ProfileCardView.Style
|
||||
|
||||
let profileManager: ProfileManager
|
||||
@ObservedObject
|
||||
var profileManager: ProfileManager
|
||||
|
||||
@ObservedObject
|
||||
var tunnel: Tunnel
|
||||
|
@ -63,12 +64,19 @@ struct ProfileRowView: View, TunnelContextProviding {
|
|||
}
|
||||
cardView
|
||||
Spacer()
|
||||
if isShared {
|
||||
sharingView
|
||||
}
|
||||
ProfileInfoButton(header: header, onEdit: onEdit)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension ProfileRowView {
|
||||
var isShared: Bool {
|
||||
profileManager.isRemotelyShared(profileWithId: header.id)
|
||||
}
|
||||
|
||||
var markerView: some View {
|
||||
ThemeImage(header.id == nextProfileId ? .pending : statusImage)
|
||||
.opacity(header.id == nextProfileId || header.id == tunnel.currentProfile?.id ? 1.0 : 0.0)
|
||||
|
@ -85,14 +93,18 @@ private extension ProfileRowView {
|
|||
) { _ in
|
||||
ProfileCardView(
|
||||
style: style,
|
||||
header: header,
|
||||
profileManager: profileManager
|
||||
header: header
|
||||
)
|
||||
.frame(maxWidth: .infinity)
|
||||
.contentShape(.rect)
|
||||
}
|
||||
}
|
||||
|
||||
var sharingView: some View {
|
||||
ThemeImage(.cloud)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
|
||||
var statusImage: Theme.ImageName {
|
||||
switch tunnelConnectionStatus {
|
||||
case .active:
|
||||
|
|
Loading…
Reference in New Issue