view: extract ProfileEditButton to its own file
profile view file is getting cray cray
This commit is contained in:
@@ -189,6 +189,7 @@
|
|||||||
4C987B57283FD07F0042CE38 /* FollowersModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C987B56283FD07F0042CE38 /* FollowersModel.swift */; };
|
4C987B57283FD07F0042CE38 /* FollowersModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C987B56283FD07F0042CE38 /* FollowersModel.swift */; };
|
||||||
4C9AA14A2A4587A6003F49FD /* NotificationStatusModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C9AA1492A4587A6003F49FD /* NotificationStatusModel.swift */; };
|
4C9AA14A2A4587A6003F49FD /* NotificationStatusModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C9AA1492A4587A6003F49FD /* NotificationStatusModel.swift */; };
|
||||||
4C9B0DEE2A65A75F00CBDA21 /* AttrStringTestExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C9B0DED2A65A75F00CBDA21 /* AttrStringTestExtensions.swift */; };
|
4C9B0DEE2A65A75F00CBDA21 /* AttrStringTestExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C9B0DED2A65A75F00CBDA21 /* AttrStringTestExtensions.swift */; };
|
||||||
|
4C9B0DF32A65C46800CBDA21 /* ProfileEditButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C9B0DF22A65C46800CBDA21 /* ProfileEditButton.swift */; };
|
||||||
4C9BB83129C0ED4F00FC4E37 /* DisplayName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C9BB83029C0ED4F00FC4E37 /* DisplayName.swift */; };
|
4C9BB83129C0ED4F00FC4E37 /* DisplayName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C9BB83029C0ED4F00FC4E37 /* DisplayName.swift */; };
|
||||||
4C9BB83429C12D9900FC4E37 /* EventProfileName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C9BB83329C12D9900FC4E37 /* EventProfileName.swift */; };
|
4C9BB83429C12D9900FC4E37 /* EventProfileName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C9BB83329C12D9900FC4E37 /* EventProfileName.swift */; };
|
||||||
4C9F18E229AA9B6C008C55EC /* CustomizeZapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C9F18E129AA9B6C008C55EC /* CustomizeZapView.swift */; };
|
4C9F18E229AA9B6C008C55EC /* CustomizeZapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C9F18E129AA9B6C008C55EC /* CustomizeZapView.swift */; };
|
||||||
@@ -666,6 +667,7 @@
|
|||||||
4C987B56283FD07F0042CE38 /* FollowersModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowersModel.swift; sourceTree = "<group>"; };
|
4C987B56283FD07F0042CE38 /* FollowersModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowersModel.swift; sourceTree = "<group>"; };
|
||||||
4C9AA1492A4587A6003F49FD /* NotificationStatusModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationStatusModel.swift; sourceTree = "<group>"; };
|
4C9AA1492A4587A6003F49FD /* NotificationStatusModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationStatusModel.swift; sourceTree = "<group>"; };
|
||||||
4C9B0DED2A65A75F00CBDA21 /* AttrStringTestExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttrStringTestExtensions.swift; sourceTree = "<group>"; };
|
4C9B0DED2A65A75F00CBDA21 /* AttrStringTestExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttrStringTestExtensions.swift; sourceTree = "<group>"; };
|
||||||
|
4C9B0DF22A65C46800CBDA21 /* ProfileEditButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileEditButton.swift; sourceTree = "<group>"; };
|
||||||
4C9BB83029C0ED4F00FC4E37 /* DisplayName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayName.swift; sourceTree = "<group>"; };
|
4C9BB83029C0ED4F00FC4E37 /* DisplayName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayName.swift; sourceTree = "<group>"; };
|
||||||
4C9BB83329C12D9900FC4E37 /* EventProfileName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventProfileName.swift; sourceTree = "<group>"; };
|
4C9BB83329C12D9900FC4E37 /* EventProfileName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventProfileName.swift; sourceTree = "<group>"; };
|
||||||
4C9F18E129AA9B6C008C55EC /* CustomizeZapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomizeZapView.swift; sourceTree = "<group>"; };
|
4C9F18E129AA9B6C008C55EC /* CustomizeZapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomizeZapView.swift; sourceTree = "<group>"; };
|
||||||
@@ -1376,6 +1378,7 @@
|
|||||||
4C9BB83329C12D9900FC4E37 /* EventProfileName.swift */,
|
4C9BB83329C12D9900FC4E37 /* EventProfileName.swift */,
|
||||||
4C8D1A6B29F1DFC200ACDF75 /* FriendIcon.swift */,
|
4C8D1A6B29F1DFC200ACDF75 /* FriendIcon.swift */,
|
||||||
3A4647CE2A413ADC00386AD8 /* CondensedProfilePicturesView.swift */,
|
3A4647CE2A413ADC00386AD8 /* CondensedProfilePicturesView.swift */,
|
||||||
|
4C9B0DF22A65C46800CBDA21 /* ProfileEditButton.swift */,
|
||||||
);
|
);
|
||||||
path = Profile;
|
path = Profile;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -2128,6 +2131,7 @@
|
|||||||
4C9AA14A2A4587A6003F49FD /* NotificationStatusModel.swift in Sources */,
|
4C9AA14A2A4587A6003F49FD /* NotificationStatusModel.swift in Sources */,
|
||||||
4CB9D4A72992D02B00A9A7E4 /* ProfileNameView.swift in Sources */,
|
4CB9D4A72992D02B00A9A7E4 /* ProfileNameView.swift in Sources */,
|
||||||
4CE4F0F429D779B5005914DB /* PostBox.swift in Sources */,
|
4CE4F0F429D779B5005914DB /* PostBox.swift in Sources */,
|
||||||
|
4C9B0DF32A65C46800CBDA21 /* ProfileEditButton.swift in Sources */,
|
||||||
4C2859622A12A7F0004746F7 /* GoldSupportGradient.swift in Sources */,
|
4C2859622A12A7F0004746F7 /* GoldSupportGradient.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
|||||||
50
damus/Views/Profile/ProfileEditButton.swift
Normal file
50
damus/Views/Profile/ProfileEditButton.swift
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
//
|
||||||
|
// ProfileEditButton.swift
|
||||||
|
// damus
|
||||||
|
//
|
||||||
|
// Created by William Casarin on 2023-07-17.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct ProfileEditButton: View {
|
||||||
|
let damus_state: DamusState
|
||||||
|
|
||||||
|
@Environment(\.colorScheme) var colorScheme
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
NavigationLink(value: Route.EditMetadata) {
|
||||||
|
Text("Edit", comment: "Button to edit user's profile.")
|
||||||
|
.frame(height: 30)
|
||||||
|
.padding(.horizontal,25)
|
||||||
|
.font(.caption.weight(.bold))
|
||||||
|
.foregroundColor(fillColor())
|
||||||
|
.cornerRadius(24)
|
||||||
|
.overlay {
|
||||||
|
RoundedRectangle(cornerRadius: 24)
|
||||||
|
.stroke(borderColor(), lineWidth: 1)
|
||||||
|
}
|
||||||
|
.minimumScaleFactor(0.5)
|
||||||
|
.lineLimit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func fillColor() -> Color {
|
||||||
|
colorScheme == .light ? DamusColors.black : DamusColors.white
|
||||||
|
}
|
||||||
|
|
||||||
|
func borderColor() -> Color {
|
||||||
|
colorScheme == .light ? DamusColors.black : DamusColors.white
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct ProfileEditButton_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
Group {
|
||||||
|
ProfileEditButton(damus_state: test_damus_state())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -56,37 +56,6 @@ func followedByString(_ friend_intersection: [String], profiles: Profiles, local
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct EditButton: View {
|
|
||||||
let damus_state: DamusState
|
|
||||||
|
|
||||||
@Environment(\.colorScheme) var colorScheme
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
NavigationLink(value: Route.EditMetadata) {
|
|
||||||
Text("Edit", comment: "Button to edit user's profile.")
|
|
||||||
.frame(height: 30)
|
|
||||||
.padding(.horizontal,25)
|
|
||||||
.font(.caption.weight(.bold))
|
|
||||||
.foregroundColor(fillColor())
|
|
||||||
.cornerRadius(24)
|
|
||||||
.overlay {
|
|
||||||
RoundedRectangle(cornerRadius: 24)
|
|
||||||
.stroke(borderColor(), lineWidth: 1)
|
|
||||||
}
|
|
||||||
.minimumScaleFactor(0.5)
|
|
||||||
.lineLimit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func fillColor() -> Color {
|
|
||||||
colorScheme == .light ? DamusColors.black : DamusColors.white
|
|
||||||
}
|
|
||||||
|
|
||||||
func borderColor() -> Color {
|
|
||||||
colorScheme == .light ? DamusColors.black : DamusColors.white
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct VisualEffectView: UIViewRepresentable {
|
struct VisualEffectView: UIViewRepresentable {
|
||||||
var effect: UIVisualEffect?
|
var effect: UIVisualEffect?
|
||||||
|
|
||||||
@@ -308,7 +277,7 @@ struct ProfileView: View {
|
|||||||
)
|
)
|
||||||
} else if damus_state.keypair.privkey != nil {
|
} else if damus_state.keypair.privkey != nil {
|
||||||
NavigationLink(value: Route.EditMetadata) {
|
NavigationLink(value: Route.EditMetadata) {
|
||||||
EditButton(damus_state: damus_state)
|
ProfileEditButton(damus_state: damus_state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user