fix: `AddAccountView` (#1764)

* fix typo

* format number of users and posts

* add thumbnail and re-layout
This commit is contained in:
Thai D. V 2023-12-19 13:25:31 +07:00 committed by GitHub
parent 260dbd351a
commit ca13e61b53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 90 additions and 52 deletions

View File

@ -177,25 +177,63 @@ struct AddAccountView: View {
instanceName = instance.name
} label: {
VStack(alignment: .leading, spacing: 4) {
Text(instance.name)
.font(.scaledHeadline)
.foregroundColor(.primary)
Text(instance.info?.shortDescription ?? "")
.font(.scaledBody)
.foregroundStyle(Color.secondary)
(Text("instance.list.users-\(instance.users)")
+ Text("")
+ Text("instance.list.posts-\(instance.statuses)"))
.font(.scaledFootnote)
.foregroundStyle(Color.secondary)
LazyImage(url: instance.thumbnail) { state in
if let image = state.image {
image
.resizable()
.scaledToFill()
} else {
Rectangle().fill(theme.tintColor.opacity(0.1))
}
}
.frame(height: 100)
.frame(maxWidth: .infinity)
.clipped()
VStack(alignment: .leading) {
HStack {
Text(instance.name)
.font(.scaledHeadline)
.foregroundColor(.primary)
Spacer()
(Text("instance.list.users-\(formatAsNumber(instance.users))")
+ Text("")
+ Text("instance.list.posts-\(formatAsNumber(instance.statuses))"))
.foregroundStyle(theme.tintColor)
}
.padding(.bottom, 5)
Text(instance.info?.shortDescription?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "")
.foregroundStyle(Color.secondary)
.lineLimit(10)
}
.font(.scaledFootnote)
.padding(10)
}
}
.listRowBackground(theme.primaryBackgroundColor)
.background(theme.primaryBackgroundColor)
.listRowBackground(Color.clear)
.listRowInsets(EdgeInsets(top: 10, leading: 0, bottom: 10, trailing: 0))
.listRowSeparator(.hidden)
.clipShape(RoundedRectangle(cornerRadius: 5))
.overlay {
RoundedRectangle(cornerRadius: 5)
.stroke(lineWidth: 1)
.fill(theme.tintColor)
}
}
}
}
}
private func formatAsNumber(_ string: String) -> String {
(Int(string) ?? 0)
.formatted(
.number
.notation(.compactName)
.locale(.current)
)
}
private var placeholderRow: some View {
VStack(alignment: .leading, spacing: 4) {
Text("placeholder.loading.short")

View File

@ -7638,7 +7638,7 @@
"ca" : {
"stringUnit" : {
"state" : "translated",
"value" : "Add account"
"value" : "Add Account"
}
},
"de" : {
@ -7722,7 +7722,7 @@
"tr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Add account"
"value" : "Add Account"
}
},
"uk" : {
@ -10971,115 +10971,115 @@
"localizations" : {
"be" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Дадаць уліковы запіс"
}
},
"ca" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Afegeix un compte"
}
},
"de" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Konto hinzufügen"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Add account"
"value" : "Add Account"
}
},
"en-GB" : {
"stringUnit" : {
"state" : "translated",
"value" : "Add account"
"value" : "Add Account"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Añadir cuenta"
}
},
"eu" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Gehitu kontua"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Ajouter un compte"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Aggiungi account"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "アカウントの追加"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "계정 추가"
}
},
"nb" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Legg til konto"
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Account toevoegen"
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Dodaj konto"
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Adicionar conta"
}
},
"tr" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Hesap Ekle"
}
},
"uk" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Додати підключення"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "添加账户"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "新增帳戶"
}
}
@ -38356,115 +38356,115 @@
"localizations" : {
"be" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Дадаць уліковы запіс"
}
},
"ca" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Afegeix un compte"
}
},
"de" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Konto hinzufügen"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Add account"
"value" : "Add Account"
}
},
"en-GB" : {
"stringUnit" : {
"state" : "translated",
"value" : "Add account"
"value" : "Add Account"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Añadir cuenta"
}
},
"eu" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Gehitu kontua"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Ajouter un compte"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Aggiungi un account"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "アカウントの追加"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "계정 추가"
}
},
"nb" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Legg til konto"
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Account toevoegen"
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Dodaj konto"
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Adicionar conta"
}
},
"tr" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Hesap Ekle"
}
},
"uk" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Додати обліковий запис"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "添加账户"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "新增帳戶"
}
}