damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

RelayAdminDetail.swift (2674B)


      1 //
      2 //  RelayAdminDetail.swift
      3 //  damus
      4 //
      5 //  Created by eric on 4/1/24.
      6 //
      7 
      8 import SwiftUI
      9 
     10 struct RelayAdminDetail: View {
     11     
     12     let state: DamusState
     13     let nip11: RelayMetadata?
     14     
     15     var body: some View {
     16         HStack(spacing: 15) {
     17             VStack(spacing: 10) {
     18                 Text("ADMIN", comment: "Text label indicating the profile picture underneath it is the admin of the Nostr relay.")
     19                     .font(.caption)
     20                     .fontWeight(.heavy)
     21                     .foregroundColor(DamusColors.mediumGrey)
     22                 if let pubkey = nip11?.pubkey {
     23                     ProfilePicView(pubkey: pubkey, size: 40, highlight: .custom(.gray.opacity(0.5), 1), profiles: state.profiles, disable_animation: state.settings.disable_animation)
     24                         .padding(.bottom, 5)
     25                         .onTapGesture {
     26                             state.nav.push(route: Route.ProfileByKey(pubkey: pubkey))
     27                         }
     28                 } else {
     29                     Image("user-circle")
     30                         .resizable()
     31                         .frame(width: 50, height: 50)
     32                         .foregroundColor(.gray.opacity(0.5))
     33                 }
     34             }
     35             
     36             Divider().frame(width: 1)
     37             
     38             VStack {
     39                 Text("CONTACT", comment: "Text label indicating that the information below is the contact information of the admin of the Nostr relay.")
     40                     .font(.caption)
     41                     .fontWeight(.heavy)
     42                     .foregroundColor(DamusColors.mediumGrey)
     43                 Image("messages")
     44                     .foregroundColor(.gray)
     45                 if let contact = nip11?.contact, !contact.isEmpty {
     46                     Text(contact)
     47                         .font(.subheadline)
     48                         .foregroundColor(.gray)
     49                 } else {
     50                     Text("N/A", comment: "Text label indicating that there is no NIP-11 relay admin contact information found. In English, N/A stands for not applicable.")
     51                         .font(.subheadline)
     52                         .foregroundColor(.gray)
     53                 }
     54             }
     55         }
     56     }
     57 }
     58 
     59 struct RelayAdminDetail_Previews: PreviewProvider {
     60     static var previews: some View {
     61         let metadata = RelayMetadata(name: "name", description: "Relay description", pubkey: test_pubkey, contact: "contact@mail.com", supported_nips: [1,2,3], software: "software", version: "version", limitation: Limitations.empty, payments_url: "https://jb55.com", icon: "", fees: Fees.empty)
     62         RelayAdminDetail(state: test_damus_state, nip11: metadata)
     63     }
     64 }