Reworked post header view + add option to hide server name from username

This commit is contained in:
Thomas Ricouard 2023-02-19 19:16:39 +01:00
parent da289dbc1f
commit 0d6eff391b
20 changed files with 51 additions and 13 deletions

View file

@ -93,6 +93,7 @@ struct DisplaySettingsView: View {
Text(shape.description).tag(shape) Text(shape.description).tag(shape)
} }
} }
Toggle("settings.display.full-username", isOn: $theme.displayFullUsername)
Picker("settings.display.status.action-buttons", selection: $theme.statusActionsDisplay) { Picker("settings.display.status.action-buttons", selection: $theme.statusActionsDisplay) {
ForEach(Theme.StatusActionsDisplay.allCases, id: \.rawValue) { buttonStyle in ForEach(Theme.StatusActionsDisplay.allCases, id: \.rawValue) { buttonStyle in
Text(buttonStyle.description).tag(buttonStyle) Text(buttonStyle.description).tag(buttonStyle)

View file

@ -73,6 +73,7 @@
"settings.display.font.scaling-%@" = "Маштаб шрыфту: %@"; "settings.display.font.scaling-%@" = "Маштаб шрыфту: %@";
"settings.display.avatar.position" = "Пазіцыя аватару"; "settings.display.avatar.position" = "Пазіцыя аватару";
"settings.display.avatar.shape" = "Форма аватару"; "settings.display.avatar.shape" = "Форма аватару";
"settings.display.full-username" = "Display full username";
"settings.display.navigation-title" = "Налады дысплэю"; "settings.display.navigation-title" = "Налады дысплэю";
"settings.display.restore" = "Аднавіць па змаўчанні"; "settings.display.restore" = "Аднавіць па змаўчанні";
"settings.display.section.display" = "Дысплэй"; "settings.display.section.display" = "Дысплэй";

View file

@ -72,6 +72,7 @@
"settings.display.example-toot" = "Publicació d'exemple"; "settings.display.example-toot" = "Publicació d'exemple";
"settings.display.avatar.position" = "Posició de les fotos de perfil"; "settings.display.avatar.position" = "Posició de les fotos de perfil";
"settings.display.avatar.shape" = "Forma de les fotos de perfil"; "settings.display.avatar.shape" = "Forma de les fotos de perfil";
"settings.display.full-username" = "Display full username";
"settings.display.navigation-title" = "Configuració de l'aparença"; "settings.display.navigation-title" = "Configuració de l'aparença";
"settings.display.restore" = "Restableix els valors per defecte"; "settings.display.restore" = "Restableix els valors per defecte";
"settings.display.section.display" = "Aparença"; "settings.display.section.display" = "Aparença";

View file

@ -73,6 +73,7 @@
"settings.display.example-toot" = "Beispielbeitrag"; "settings.display.example-toot" = "Beispielbeitrag";
"settings.display.avatar.position" = "Profilbild-Position"; "settings.display.avatar.position" = "Profilbild-Position";
"settings.display.avatar.shape" = "Profilbild-Form"; "settings.display.avatar.shape" = "Profilbild-Form";
"settings.display.full-username" = "Display full username";
"settings.display.navigation-title" = "Anzeigeeinstellungen"; "settings.display.navigation-title" = "Anzeigeeinstellungen";
"settings.display.restore" = "Standard wiederherstellen"; "settings.display.restore" = "Standard wiederherstellen";
"settings.display.section.display" = "Anzeigen"; "settings.display.section.display" = "Anzeigen";

View file

@ -77,6 +77,7 @@
"settings.display.font.scaling-%@" = "Font scaling: %@"; "settings.display.font.scaling-%@" = "Font scaling: %@";
"settings.display.avatar.position" = "Avatar position"; "settings.display.avatar.position" = "Avatar position";
"settings.display.avatar.shape" = "Avatar shape"; "settings.display.avatar.shape" = "Avatar shape";
"settings.display.full-username" = "Display full username";
"settings.display.navigation-title" = "Display Settings"; "settings.display.navigation-title" = "Display Settings";
"settings.display.restore" = "Restore defaults"; "settings.display.restore" = "Restore defaults";
"settings.display.section.display" = "Display"; "settings.display.section.display" = "Display";

View file

@ -77,6 +77,7 @@
"settings.display.font.scaling-%@" = "Font scaling: %@"; "settings.display.font.scaling-%@" = "Font scaling: %@";
"settings.display.avatar.position" = "Avatar position"; "settings.display.avatar.position" = "Avatar position";
"settings.display.avatar.shape" = "Avatar shape"; "settings.display.avatar.shape" = "Avatar shape";
"settings.display.full-username" = "Display full username";
"settings.display.navigation-title" = "Display Settings"; "settings.display.navigation-title" = "Display Settings";
"settings.display.restore" = "Restore defaults"; "settings.display.restore" = "Restore defaults";
"settings.display.section.display" = "Display"; "settings.display.section.display" = "Display";

View file

@ -73,6 +73,7 @@
"settings.display.example-toot" = "Publicación de ejemplo"; "settings.display.example-toot" = "Publicación de ejemplo";
"settings.display.avatar.position" = "Posición del avatar"; "settings.display.avatar.position" = "Posición del avatar";
"settings.display.avatar.shape" = "Forma del avatar"; "settings.display.avatar.shape" = "Forma del avatar";
"settings.display.full-username" = "Display full username";
"settings.display.navigation-title" = "Ajustes de apariencia"; "settings.display.navigation-title" = "Ajustes de apariencia";
"settings.display.restore" = "Restaurar ajustes predeterminados"; "settings.display.restore" = "Restaurar ajustes predeterminados";
"settings.display.section.display" = "Apariencia"; "settings.display.section.display" = "Apariencia";

View file

@ -73,6 +73,7 @@
"settings.display.example-toot" = "Adibidea"; "settings.display.example-toot" = "Adibidea";
"settings.display.avatar.position" = "Avatarearen kokapena"; "settings.display.avatar.position" = "Avatarearen kokapena";
"settings.display.avatar.shape" = "Avatarearen itxura"; "settings.display.avatar.shape" = "Avatarearen itxura";
"settings.display.full-username" = "Display full username";
"settings.display.navigation-title" = "Pantaila ezarpenak"; "settings.display.navigation-title" = "Pantaila ezarpenak";
"settings.display.restore" = "Berrezarri defektuzkoa"; "settings.display.restore" = "Berrezarri defektuzkoa";
"settings.display.section.display" = "Pantaila"; "settings.display.section.display" = "Pantaila";

View file

@ -73,6 +73,7 @@
"settings.display.example-toot" = "Toot d'exemple"; "settings.display.example-toot" = "Toot d'exemple";
"settings.display.avatar.position" = "Position de l'avatar"; "settings.display.avatar.position" = "Position de l'avatar";
"settings.display.avatar.shape" = "Forme de l'avatar"; "settings.display.avatar.shape" = "Forme de l'avatar";
"settings.display.full-username" = "Afficher le nom d'utilisateur complet";
"settings.display.navigation-title" = "Paramètres d'affichage"; "settings.display.navigation-title" = "Paramètres d'affichage";
"settings.display.restore" = "Restaurer les valeurs par défaut"; "settings.display.restore" = "Restaurer les valeurs par défaut";
"settings.display.section.display" = "Affichage"; "settings.display.section.display" = "Affichage";

View file

@ -73,6 +73,7 @@
"settings.display.example-toot" = "Post di esempio"; "settings.display.example-toot" = "Post di esempio";
"settings.display.avatar.position" = "Posizione dell'avatar"; "settings.display.avatar.position" = "Posizione dell'avatar";
"settings.display.avatar.shape" = "Forma dell'avatar"; "settings.display.avatar.shape" = "Forma dell'avatar";
"settings.display.full-username" = "Display full username";
"settings.display.navigation-title" = "Impostazioni di visualizzazione"; "settings.display.navigation-title" = "Impostazioni di visualizzazione";
"settings.display.restore" = "Ripristina i valori predefiniti"; "settings.display.restore" = "Ripristina i valori predefiniti";
"settings.display.section.display" = "Visualizzazione"; "settings.display.section.display" = "Visualizzazione";

View file

@ -77,6 +77,7 @@
"settings.display.font.scaling-%@" = "フォントサイズ: %@"; "settings.display.font.scaling-%@" = "フォントサイズ: %@";
"settings.display.avatar.position" = "アバターの位置"; "settings.display.avatar.position" = "アバターの位置";
"settings.display.avatar.shape" = "アバターの形"; "settings.display.avatar.shape" = "アバターの形";
"settings.display.full-username" = "Display full username";
"settings.display.navigation-title" = "表示設定"; "settings.display.navigation-title" = "表示設定";
"settings.display.restore" = "デフォルトに戻す"; "settings.display.restore" = "デフォルトに戻す";
"settings.display.section.display" = "表示"; "settings.display.section.display" = "表示";

View file

@ -73,6 +73,7 @@
"settings.display.example-toot" = "글 미리 보기"; "settings.display.example-toot" = "글 미리 보기";
"settings.display.avatar.position" = "프로필 사진 위치"; "settings.display.avatar.position" = "프로필 사진 위치";
"settings.display.avatar.shape" = "프로필 사진 모양"; "settings.display.avatar.shape" = "프로필 사진 모양";
"settings.display.full-username" = "Display full username";
"settings.display.navigation-title" = "화면 설정"; "settings.display.navigation-title" = "화면 설정";
"settings.display.restore" = "초기 설정으로 되돌리기"; "settings.display.restore" = "초기 설정으로 되돌리기";
"settings.display.section.display" = "화면"; "settings.display.section.display" = "화면";

View file

@ -77,6 +77,7 @@
"settings.display.font.scaling-%@" = "Font scaling: %@"; "settings.display.font.scaling-%@" = "Font scaling: %@";
"settings.display.avatar.position" = "Avatarposisjon"; "settings.display.avatar.position" = "Avatarposisjon";
"settings.display.avatar.shape" = "Avatarform"; "settings.display.avatar.shape" = "Avatarform";
"settings.display.full-username" = "Display full username";
"settings.display.navigation-title" = "Visningsinnstillinger"; "settings.display.navigation-title" = "Visningsinnstillinger";
"settings.display.restore" = "Gjenopprett standardinnstillinger"; "settings.display.restore" = "Gjenopprett standardinnstillinger";
"settings.display.section.display" = "Visning"; "settings.display.section.display" = "Visning";

View file

@ -73,6 +73,7 @@
"settings.display.example-toot" = "Postvoorbeeld"; "settings.display.example-toot" = "Postvoorbeeld";
"settings.display.avatar.position" = "Avatarpositie"; "settings.display.avatar.position" = "Avatarpositie";
"settings.display.avatar.shape" = "Avatarvorm"; "settings.display.avatar.shape" = "Avatarvorm";
"settings.display.full-username" = "Display full username";
"settings.display.navigation-title" = "Weergaveopties"; "settings.display.navigation-title" = "Weergaveopties";
"settings.display.restore" = "Stel opnieuw in"; "settings.display.restore" = "Stel opnieuw in";
"settings.display.section.display" = "Weergave"; "settings.display.section.display" = "Weergave";

View file

@ -73,6 +73,7 @@
"settings.display.example-toot" = "Przykładowy post"; "settings.display.example-toot" = "Przykładowy post";
"settings.display.avatar.position" = "Położenie awatara"; "settings.display.avatar.position" = "Położenie awatara";
"settings.display.avatar.shape" = "Kształt awatara"; "settings.display.avatar.shape" = "Kształt awatara";
"settings.display.full-username" = "Display full username";
"settings.display.navigation-title" = "Ustawienia ekranu"; "settings.display.navigation-title" = "Ustawienia ekranu";
"settings.display.restore" = "Przywróć ustawienia domyślne"; "settings.display.restore" = "Przywróć ustawienia domyślne";
"settings.display.section.display" = "Ekran"; "settings.display.section.display" = "Ekran";

View file

@ -73,6 +73,7 @@
"settings.display.example-toot" = "Example Post"; "settings.display.example-toot" = "Example Post";
"settings.display.avatar.position" = "Posição do avatar"; "settings.display.avatar.position" = "Posição do avatar";
"settings.display.avatar.shape" = "Formato do avatar"; "settings.display.avatar.shape" = "Formato do avatar";
"settings.display.full-username" = "Display full username";
"settings.display.navigation-title" = "Ver Configurações"; "settings.display.navigation-title" = "Ver Configurações";
"settings.display.restore" = "Restaurar padrões"; "settings.display.restore" = "Restaurar padrões";
"settings.display.section.display" = "Exibir"; "settings.display.section.display" = "Exibir";

View file

@ -73,6 +73,7 @@
"settings.display.example-toot" = "Example Post"; "settings.display.example-toot" = "Example Post";
"settings.display.avatar.position" = "Avatar Pozisyonu"; "settings.display.avatar.position" = "Avatar Pozisyonu";
"settings.display.avatar.shape" = "Avatar Şekli"; "settings.display.avatar.shape" = "Avatar Şekli";
"settings.display.full-username" = "Display full username";
"settings.display.navigation-title" = "Gösterim Ayarları"; "settings.display.navigation-title" = "Gösterim Ayarları";
"settings.display.restore" = "Varsayılan Ayarlara Geri Döndür"; "settings.display.restore" = "Varsayılan Ayarlara Geri Döndür";
"settings.display.section.display" = "Gösterim"; "settings.display.section.display" = "Gösterim";

View file

@ -73,6 +73,7 @@
"settings.display.example-toot" = "样例嘟文"; "settings.display.example-toot" = "样例嘟文";
"settings.display.avatar.position" = "头像位置"; "settings.display.avatar.position" = "头像位置";
"settings.display.avatar.shape" = "头像边框"; "settings.display.avatar.shape" = "头像边框";
"settings.display.full-username" = "Display full username";
"settings.display.navigation-title" = "显示设置"; "settings.display.navigation-title" = "显示设置";
"settings.display.restore" = "恢复默认设置"; "settings.display.restore" = "恢复默认设置";
"settings.display.section.display" = "显示"; "settings.display.section.display" = "显示";

View file

@ -7,6 +7,7 @@ public class Theme: ObservableObject {
case avatarPosition, avatarShape, statusActionsDisplay, statusDisplayStyle case avatarPosition, avatarShape, statusActionsDisplay, statusDisplayStyle
case selectedSet, selectedScheme case selectedSet, selectedScheme
case followSystemColorSchme case followSystemColorSchme
case displayFullUsernameTimeline
} }
public enum FontState: Int, CaseIterable { public enum FontState: Int, CaseIterable {
@ -96,6 +97,7 @@ public class Theme: ObservableObject {
@AppStorage(ThemeKey.statusActionsDisplay.rawValue) public var statusActionsDisplay: StatusActionsDisplay = .full @AppStorage(ThemeKey.statusActionsDisplay.rawValue) public var statusActionsDisplay: StatusActionsDisplay = .full
@AppStorage(ThemeKey.statusDisplayStyle.rawValue) public var statusDisplayStyle: StatusDisplayStyle = .large @AppStorage(ThemeKey.statusDisplayStyle.rawValue) public var statusDisplayStyle: StatusDisplayStyle = .large
@AppStorage(ThemeKey.followSystemColorSchme.rawValue) public var followSystemColorScheme: Bool = true @AppStorage(ThemeKey.followSystemColorSchme.rawValue) public var followSystemColorScheme: Bool = true
@AppStorage(ThemeKey.displayFullUsernameTimeline.rawValue) public var displayFullUsername: Bool = true
@Published public var avatarPosition: AvatarPosition = .top @Published public var avatarPosition: AvatarPosition = .top
@Published public var avatarShape: AvatarShape = .rounded @Published public var avatarShape: AvatarShape = .rounded

View file

@ -1,6 +1,7 @@
import DesignSystem import DesignSystem
import Models import Models
import SwiftUI import SwiftUI
import Env
struct StatusRowHeaderView: View { struct StatusRowHeaderView: View {
@Environment(\.isInCaptureMode) private var isInCaptureMode: Bool @Environment(\.isInCaptureMode) private var isInCaptureMode: Bool
@ -33,22 +34,39 @@ struct StatusRowHeaderView: View {
if theme.avatarPosition == .top { if theme.avatarPosition == .top {
AvatarView(url: status.account.avatar, size: .status) AvatarView(url: status.account.avatar, size: .status)
} }
VStack(alignment: .leading, spacing: 0) { VStack(alignment: .leading, spacing: 4) {
EmojiTextApp(.init(stringValue: status.account.safeDisplayName), emojis: status.account.emojis) HStack(alignment: .center, spacing: 4) {
.font(.scaledSubheadline) EmojiTextApp(.init(stringValue: status.account.safeDisplayName), emojis: status.account.emojis)
.fontWeight(.semibold) .font(.scaledSubheadline)
Group { .fontWeight(.semibold)
Text("@\(status.account.acct)") + .lineLimit(1)
Text("") + if theme.avatarPosition == .leading {
Text(status.createdAt.relativeFormatted) + dateView
Text("") + .offset(y: 1)
Text(Image(systemName: viewModel.status.visibility.iconName)) .lineLimit(1)
}
}
if theme.avatarPosition == .top {
HStack(spacing: 0) {
Text("@\(theme.displayFullUsername ? status.account.acct : status.account.username)") +
Text("") +
dateView
}
.font(.scaledFootnote)
.foregroundColor(.gray)
.lineLimit(1)
} }
.font(.scaledFootnote)
.foregroundColor(.gray)
} }
} }
} }
private var dateView: Text {
Text(status.createdAt.relativeFormatted) +
Text("") +
Text(Image(systemName: viewModel.status.visibility.iconName))
.font(.scaledFootnote)
.foregroundColor(.gray)
}
@ViewBuilder @ViewBuilder
private var threadIcon: some View { private var threadIcon: some View {
@ -66,7 +84,7 @@ struct StatusRowHeaderView: View {
StatusRowContextMenu(viewModel: viewModel) StatusRowContextMenu(viewModel: viewModel)
} label: { } label: {
Image(systemName: "ellipsis") Image(systemName: "ellipsis")
.frame(width: 20, height: 30) .frame(width: 20)
} }
.menuStyle(.borderlessButton) .menuStyle(.borderlessButton)
.foregroundColor(.gray) .foregroundColor(.gray)