 
     {mainController} = KD.singletons
 
-    @bindPulsingRemove()
-    @bindTransitionEnd()
     @createHeader()
-
-    if KD.isLoggedInOnLoad then @createSidebar()
 
     @createPanelWrapper()
     @createMainTabView()
 
-    mainController.ready =>
-      if KD.isLoggedInOnLoad then @createAccountArea()
-
-      @setStickyNotification()
-      @emit 'ready'
+    @emit 'ready'
 
 
   createHeader:->
-
-    {entryPoint} = KD.config
 
     @addSubView @header = new KDView
       tagName  : 'header'

      KD.getSingleton('router').handleRoute "/Activity"

    @panelWrapper.addSubView @mainTabView


  openMachineModal: (machine, item) ->

    bounds   = item.getBounds()
    position =
      top    : Math.max bounds.y - 38, 0
      left   : bounds.x + bounds.w + 16

    new MachineSettingsModal {position}, machine


  setStickyNotification:->

    return if not KD.isLoggedIn() # don't show it to guests

    {JSystemStatus} = KD.remote.api

    JSystemStatus.on 'restartScheduled', @bound 'handleSystemMessage'

    KD.utils.wait 2000, =>
      KD.remote.api.JSystemStatus.getCurrentSystemStatuses (err, statuses)=>
        if err then log 'current system status:',err
        else if statuses and Array.isArray statuses
          {daisy} = Bongo
          queue   = statuses.map (status)=>=>
            @createGlobalNotification status
            KD.utils.wait 500, -> queue.next()

          daisy queue.reverse()

  handleSystemMessage:(message)->

    @createGlobalNotification message  if message.status is 'active'

  hideAllNotifications:->

    notification.hide() for notification in @notifications


  # this only creates a notification
  # and keeps track of existing ones
  # it doesn't broadcast anything
  # a name change might be necessary here - SY
  createGlobalNotification:(message, options = {})->

    # will get rid of this map
    # once the admin panel counterpart
    # of this is renewed - SY
    typeMap =
      'restart' : 'warn'
      'reload'  : ''
      'info'    : ''
      'red'     : 'err'
      'yellow'  : 'warn'
      'green'   : ''

    options.type      or= typeMap[message.type]
    options.showTimer  ?= message.type isnt 'restart'  #change this option name creates confusion with the actual timer
    options.cssClass    = KD.utils.curry "header-notification", options.type
    options.cssClass    = KD.utils.curry options.cssClass, 'fx'  if options.animated

    @notifications.push notification = new GlobalNotificationView options, message

    container = message.container or @header
    container.addSubView notification
    @hideAllNotifications()

    # if a notification is destroyed
    # find the previous one
    # and show it if it exists - SY
    notification.once 'KDObjectWillBeDestroyed', =>
      for n, i in @notifications
        if n.getId() is notification.getId()
          @notifications[i-1]?.show()
          break

    KD.utils.wait 177, notification.bound 'show'

    return notification


  enableFullscreen: ->
    @setClass "fullscreen no-anim"
    @emit "fullscreen", yes
    KD.getSingleton("windowController").notifyWindowResizeListeners()


  disableFullscreen: ->
    @unsetClass "fullscreen no-anim"
    @emit "fullscreen", no
    KD.getSingleton("windowController").notifyWindowResizeListeners()


  isFullscreen: -> @hasClass "fullscreen"


  toggleFullscreen: ->

    if @isFullscreen()
    then @disableFullscreen()
    else @enableFullscreen()


  bindPulsingRemove:->

    router     = KD.getSingleton 'router'
    appManager = KD.getSingleton 'appManager'

    appManager.once 'AppCouldntBeCreated', removePulsing

    appManager.on 'AppCreated', (appInstance)->
      options = appInstance.getOptions()
      {title, name, appEmitsReady} = options
      routeArr = location.pathname.split('/')
      routeArr.shift()
      checkedRoute = if routeArr.first is "Develop" \
                     then routeArr.last else routeArr.first

      if checkedRoute is name or checkedRoute is title
        if appEmitsReady
          appView = appInstance.getView()
          appView.ready removePulsing
        else removePulsing()


  _logoutAnimation: ->

    {body}      = document
    turnOffLine = new KDCustomHTMLView cssClass : "turn-off-line"
    turnOffDot  = new KDCustomHTMLView cssClass : "turn-off-dot"

    turnOffLine.appendToDomBody()
    turnOffDot.appendToDomBody()

    body.style.background = "#000"
    @setClass "logout-tv"


  removePulsing = ->

    loadingScreen = document.getElementById 'main-loading'

    return unless loadingScreen

    logo = loadingScreen.children[0]
    logo.classList.add 'out'

    KD.utils.wait 750, ->

      loadingScreen.classList.add 'out'

      KD.utils.wait 750, ->

        loadingScreen.parentElement.removeChild loadingScreen

        return if KD.isLoggedIn()

        cdc      = KD.singleton('display')
        mainView = KD.getSingleton 'mainView'

        return unless Object.keys(cdc.displays).length

        for own id, display of cdc.displays
          top      = display.$().offset().top
          duration = 400
          KDScrollView::scrollTo.call mainView, {top, duration}
          break


      tagName  : 'cite'
      domId    : 'sidebar-toggle'
      click    : => @toggleClass 'collapsed'


  createMainTabView:->
