<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:vm="using:DodoSSH.Client.Shell.ViewModels"
             x:Class="DodoSSH.Client.App.Views.StatusBar"
             x:DataType="vm:MainWindowViewModel">

  <!--
    The strip along the bottom.

    The design puts five things here: the active host and the bastion it is reached through, the open port
    forwards, the SFTP transfer count, an auto-lock countdown, and the last sync time. Four of those five
    have nothing behind them — there is no jump-host routing, no port forwarding, no file transfer and no
    idle auto-lock — so what is left is the active session, the vault's last message, and the shortcut hint.

    The last message is the load-bearing one, and it is why this bar is worth having at all: the vault's
    status line used to be a cramped label in the account bar, and everything the application has to say
    about a save, a sync, a refusal or a conflict goes through it.

    ── v2 ────────────────────────────────────────────────────────────────────────────────────────────────
    The design has no status bar. Two of the three things this one carried moved into the titlebar with it —
    the sync word is up there beside its dot, and the shortcut hint is inside the search box that uses it —
    so those two are gone from here rather than printed twice.

    The third did not move, and is why this bar survives the design that deletes it. Vault.Status is the one
    channel this application has for saying that a save failed, that a sync was refused, that a merge picked
    a winner. The design is a mock-up of a working afternoon and has nowhere for a sentence like that to go;
    dropping the bar would have meant dropping the sentence, or repeating it on six screens.
  -->

  <Border Height="24" Background="{StaticResource Chrome}"
          BorderBrush="{StaticResource Border}" BorderThickness="0,1,0,0">
    <Grid ColumnDefinitions="Auto,*" Margin="14,0">

      <!-- What is connected, and where. Absent rather than empty when nothing is. -->
      <StackPanel Grid.Column="0" Orientation="Horizontal" Spacing="5" VerticalAlignment="Center"
                  Margin="0,0,14,0" IsVisible="{Binding SelectedTab, Converter={x:Static ObjectConverters.IsNotNull}}">
        <Ellipse Classes="dot" Classes.live="{Binding SelectedTab.IsLive}" VerticalAlignment="Center" />
        <TextBlock Classes="mono" Text="{Binding SelectedTab.Address}" FontSize="10.5"
                   Foreground="{StaticResource TextDim}" VerticalAlignment="Center" />
      </StackPanel>

      <!--
        Everything the vault has to say. Trimmed rather than wrapped, because this bar is one line high and
        a message that grew it would move the whole window's contents up.
      -->
      <TextBlock Grid.Column="1" Classes="mono" Text="{Binding Vault.Status}" FontSize="10.5"
                 Foreground="{StaticResource TextDim}" VerticalAlignment="Center"
                 TextTrimming="CharacterEllipsis" />

    </Grid>
  </Border>

</UserControl>
