Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redid Account Overview Page #154

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 83 additions & 13 deletions Swiftcord/Views/Settings/User/AccountOverview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,97 @@ struct AccountOverview: View {
UserInfo()
}
} header: {
VStack(spacing: 0) {
CachedAsyncImage(url: user.avatarURL(size: 240)) { image in
image.resizable().scaledToFill()
} placeholder: {
ProgressView().progressViewStyle(.circular)
VStack {
HStack(spacing: 0) {
CachedAsyncImage(url: user.avatarURL(size: 240)) { image in
image.resizable().scaledToFill()
} placeholder: {
ProgressView().progressViewStyle(.circular)
}
.clipShape(Circle())
.frame(width: 70, height: 70)
.padding(5)
.overlay {
Circle()
.strokeBorder(.white.opacity(0.5), lineWidth: 2)
}
.padding()
VStack(alignment: .leading) {
Text(user.username).font(.title)/*.padding(.top, 6)*/
Text("#" + user.discriminator)
.font(.system(.title3, weight: .bold))
}
Spacer()
Button(action: {
if let url = URL(string: "https://discord.com/channels/@me") {
NSWorkspace.shared.open(url)
}
}, label: {
HStack {
Text("Edit Profile")
Image(systemName: "link")
}
.frame(width: 131, height: 32)
.background(Color.accentColor)
.cornerRadius(5)
})
.buttonStyle(.plain)
}
.clipShape(Circle())
.frame(width: 100, height: 100)
Text(user.username).font(.title2).padding(.top, 6)
Text(user.email).font(.system(.title3, weight: .regular))
if let phone = user.phone {
Text(phone)
.textSelection(.enabled)
.padding()
//.background(Color.green.opacity(0.5))
VStack {
List {
HStack {
VStack(alignment: .leading) {
Text("Name")
.font(.system(.title3, weight: .bold))
Text(user.username + "#" + user.discriminator)
.font(.system(.title3, weight: .regular))
}
Spacer()
}
if let phone = user.phone {
HStack {
VStack(alignment: .leading) {
Text("Phone")
.font(.system(.title3, weight: .bold))
Text(phone)
.font(.system(.title3, weight: .regular))
}
Spacer()
}
} else {
HStack {
VStack(alignment: .leading) {
Text("Phone")
.font(.system(.title3, weight: .bold))
Text("No Phone Number Added")
.font(.system(.title3, weight: .regular))
}
Spacer()
}
}
HStack {
VStack(alignment: .leading) {
Text("Email")
.font(.system(.title3, weight: .bold))
Text(user.email)
.font(.system(.title3, weight: .regular))
}
Spacer()
}
}
.cornerRadius(15)
.padding()
}
}
.foregroundColor(.primary)
.frame(maxWidth: .infinity)
.padding(.top, -10)
.padding(.bottom, 10)
.background(Color.black.opacity(0.4))
.cornerRadius(15)
}

Section {
HStack {
Button("Disable Account", role: .destructive) {
Expand Down
10 changes: 10 additions & 0 deletions Swiftcord/Views/User/Profile/MiniUserProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import CachedAsyncImage

struct MiniUserProfileView<RichContentSlot: View>: View {
let user: User
let pasteboard = NSPasteboard.general
@Binding var profile: UserProfile?
var guildRoles: [Role]?
var isWebhook: Bool = false
Expand Down Expand Up @@ -90,6 +91,15 @@ struct MiniUserProfileView<RichContentSlot: View>: View {
NonUserBadge(flags: user.public_flags, isWebhook: isWebhook)
}
Spacer()
Button(action: {
pasteboard.declareTypes([.string], owner: nil)
pasteboard.setString("\(user.username)#\(user.discriminator)", forType: .string)
}, label: {
Image(systemName: "square.on.square")
})
.buttonStyle(.plain)
.padding()
.frame(width: 20, height: 20)
}

// Custom status
Expand Down