profile: move the "Follow you" badge into the profile header

Move the "Follow you" badge into the profile header he profile header
out-of-line with the often long and already space-constrained
username/display name text

Changelog-Changed: Move the "Follow you" badge into the profile header
Closes: https://github.com/damus-io/damus/pull/1529
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
Grimless
2023-09-02 12:34:39 -04:00
committed by William Casarin
parent f6f7d13f12
commit b18a0c573e
10 changed files with 114 additions and 145 deletions
+7 -13
View File
@@ -7,22 +7,16 @@
import Foundation
struct BothNames {
let username: String
let display_name: String
}
enum DisplayName {
case both(BothNames)
case both(username: String, displayName: String)
case one(String)
var display_name: String {
var displayName: String {
switch self {
case .one(let one):
return one
case .both(let b):
return b.display_name
case .both(username: _, displayName: let displayName):
return displayName
}
}
@@ -30,8 +24,8 @@ enum DisplayName {
switch self {
case .one(let one):
return one
case .both(let b):
return b.username
case .both(username: let username, displayName: _):
return username
}
}
}
@@ -50,7 +44,7 @@ func parse_display_name(profile: Profile?, pubkey: Pubkey) -> DisplayName {
let disp_name = profile.display_name?.isEmpty == false ? profile.display_name : nil
if let name, let disp_name, name != disp_name {
return .both(BothNames(username: name, display_name: disp_name))
return .both(username: name, displayName: disp_name)
}
if let one = name ?? disp_name {