import Ember from 'ember';
import config from '../config/environment';

const { computed } = Ember;

export default Ember.Component.extend({
  tagName: 'ul',
  classNames: ['nav', 'nav-pills', 'user-menu'],

  userName: computed.readOnly('session.currentUser.login'),

  version: config.APP.version,
  environment: config.environment,
  currentRevision: config.currentRevision,

  v: computed('version', function() {
    return this.get('version').charAt(0) === "v" ? "" : "v";
  }),

  currentVersionLink: computed('environment', 'version', 'currentRevision', function() {
    var baseLink = "https://github.com/ember-cli/ember-twiddle";
    var { environment, currentRevision, version } = this.getProperties('environment', 'currentRevision', 'version');

    switch (environment) {
      case 'production':
        return `${baseLink}/releases/tag/${version}`;

      case 'staging':
        return `${baseLink}/commit/${currentRevision}`;
    }
  }),

  actions: {
    signInViaGithub() {
      this.attrs.signInViaGithub();
    },
    signOut() {
      this.attrs.signOut();
    },

    showTwiddles() {
      this.attrs.showTwiddles();
    }
  }
});

@@ -523,16 +523,21 @@
 onment',
+ 'v',
  'versio
@@ -568,24 +568,24 @@
 unction() %7B%0A
-
     var base
@@ -676,16 +676,19 @@
 evision,
+ v,
  version
@@ -744,16 +744,21 @@
 vision',
+ 'v',
  'versio
@@ -761,16 +761,52 @@
 rsion');
+%0A    var tagName = %60$%7Bv%7D$%7Bversion%7D%60;
 %0A%0A    sw
@@ -894,23 +894,23 @@
 s/tag/$%7B
-version
+tagName
 %7D%60;%0A%0A   

Fix help link