{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: BUSL-1.1
~}}

{{#if this.token.selfToken}}
  <Hds::Dropdown @color="secondary" class="profile-dropdown"
    {{keyboard-shortcut menuLevel=true pattern=(array "g" "p") }}
    as |dd|>
    <dd.ToggleButton @color="secondary" @icon="user-circle" @text={{this.token.selfToken.name}} @size="small" data-test-header-profile-dropdown />
    <dd.Description @text="Signed In" />
    <dd.Separator />
    <dd.Interactive @route="settings.tokens" @text="Profile" data-test-profile-dropdown-profile-link />
    <dd.Interactive {{on "click" this.signOut}} @text="Sign Out" @color="critical" data-test-profile-dropdown-sign-out-link />
  </Hds::Dropdown>
{{else}}
  <span class="profile-link"
    {{keyboard-shortcut menuLevel=true pattern=(array "g" "p") }}
  >
    <Hds::Button
      data-test-header-signin-link
      @route="settings.tokens"
      @text="Profile and Sign In"
      @icon="user-circle"
      @isIconOnly={{true}}
      @color="secondary"
      @size="medium"
    />
  </span>
{{/if}}

{{yield}}
