//
//  HeaderView.swift
//  ComposeUI
//
//  Created by Shadowfacts on 3/4/23.
//

import SwiftUI
import Pachyderm
import InstanceFeatures

struct HeaderView: View {
    let currentAccount: (any AccountProtocol)?
    let charsRemaining: Int
    
    var body: some View {
        HStack(alignment: .top) {
            CurrentAccountView(account: currentAccount)
                .accessibilitySortPriority(1)
            
            Spacer()
            
            Text(verbatim: charsRemaining.description)
                .foregroundColor(charsRemaining < 0 ? .red : .secondary)
                .font(Font.body.monospacedDigit())
                .accessibility(label: Text(charsRemaining < 0 ? "\(-charsRemaining) characters too many" : "\(charsRemaining) characters remaining"))
                // this should come first, so VO users can back to it from the main compose text view
                .accessibilitySortPriority(0)
        }.frame(height: 50)
    }
}
