<commit_before>import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';

export default class CardhostLeftEdgeComponent extends Component {
  @service cardstackSession;
  @service library;
  @service router;
  @tracked isExpanded = false;

  @action
  toggleMenuExpand() {
    this.isExpanded = !this.isExpanded;
  }

  @action
  logout(sessionLogout) {
    sessionLogout.bind(this.cardstackSession)();
    this.library.hide();

    let cardId;
    let route = this.router.currentRoute;
    while (route) {
      cardId = route.params.id;
      if (!cardId) {
        route = route.parent;
      } else {
        break;
      }
    }
    if (cardId) {
      this.router.transitionTo('cards.card.view', cardId);
    } else {
      this.router.transitionTo('index');
    }
  }

  @action
  login(sessionLogin, username) {
    sessionLogin.bind(this.cardstackSession)(username);
  }

  @action
  closeLeftEdge() {
    this.isExpanded = false;
  }
}<commit_msg>prepping for the schema button in the left edge<commit_after>import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';

export default class CardhostLeftEdgeComponent extends Component {
  @service cardstackSession;
  @service library;
  @service router;
  @tracked isExpanded = false;

  get cardId() {
    let cardId;
    let route = this.router.currentRoute;
    while (route) {
      cardId = route.params.id;
      if (!cardId) {
        route = route.parent;
      } else {
        break;
      }
    }
    return cardId;
  }

  @action
  toggleMenuExpand() {
    this.isExpanded = !this.isExpanded;
  }

  @action
  logout(sessionLogout) {
    sessionLogout.bind(this.cardstackSession)();
    this.library.hide();

    if (this.cardId) {
      this.router.transitionTo('cards.card.view', this.cardId);
    } else {
      this.router.transitionTo('index');
    }
  }

  @action
  login(sessionLogin, username) {
    sessionLogin.bind(this.cardstackSession)(username);
  }

  @action
  closeLeftEdge() {
    this.isExpanded = false;
  }
}
{'fraction_non_alphanumeric': 0.12327547841566533, 'fraction_numerical': 0.0, 'mean_word_length': 3.072463768115942, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5213083', 'n_tokens_mistral': 719, 'n_tokens_neox': 704, 'n_words': 152}