Files
damus/damus/Views/PubkeyView.swift
T
tyiu d01e7c0595 Fix localization bugs and export localizations
Changelog-Fixes: Fix some localization bugs
Closes: #320
2023-01-14 08:54:43 -08:00

34 lines
680 B
Swift

//
// PubkeyView.swift
// damus
//
// Created by William Casarin on 2022-05-04.
//
import SwiftUI
struct PubkeyView: View {
let pubkey: String
let relay: String?
var body: some View {
let color: Color = id_to_color(pubkey)
ZStack {
Text("\(abbrev_pubkey(pubkey))", comment: "Abbreviated version of a nostr public key.")
.foregroundColor(color)
}
}
}
func abbrev_pubkey(_ pubkey: String, amount: Int = 8) -> String {
return pubkey.prefix(amount) + ":" + pubkey.suffix(amount)
}
/*
struct PubkeyView_Previews: PreviewProvider {
static var previews: some View {
PubkeyView()
}
}
*/