<commit_before>class ContentPanel extends KDView

  constructor:(options, data)->

    super options, data

    @registerSingleton "contentPanel", this, yes
    @bindTransitionEnd()
    @listenWindowResize()

    @state              = 'full'
    @chatMargin         = 0
    @windowController or= KD.getSingleton 'windowController'
    @navOpenedOnce      = yes #if KD.isLoggedIn() then yes else no
    mainViewController  = KD.getSingleton "mainViewController"
    mainViewController.on "UILayoutNeedsToChange", @bound "changeLayout"
    mainViewController.on "browseRequested", @bound "browseRequested"

  typeMap =
    full    : 'adjustForFullWidth'
    develop : 'adjustForDevelop'
    social  : 'adjustForSocial'

  nameMap =
    Home    : 'adjustForFullWidth'


  browseRequested:->

    @navOpenedOnce = yes
    @adjustForSocial()
    KD.getSingleton("mainView").mainTabView.changeLayout hideTabs : no


  changeLayout:(options)->

    {type, hideTabs, name}    = options

    @unsetClass 'full develop social'
    @adjustShadow hideTabs
    @navOpenedOnce = yes unless name in ["Home", "Activity"]

    @adjustLayoutHelper name, type


  resetToCurrentState:->

    switch @state
      when 'develop' then @adjustForDevelop()
      when 'social'  then @adjustForSocial()
      when 'full'    then @adjustForFullWidth()


  adjustShadow:(hideTabs)->

    @[if hideTabs then 'setClass' else 'unsetClass'] "no-shadow"


  adjustLayoutHelper:(name, type)->

    if @navOpenedOnce # KD.isLoggedIn() or
    then @[nameMap[name] or typeMap[type] or typeMap[@state]]?()
    else @adjustForFullWidth()


  adjustForFullWidth:->

    @setX 0
    @setWidth @windowController.winWidth - @chatMargin
    @setClass 'full'
    @state = 'full'


  adjustForDevelop:->

    @setX 260
    @setWidth @windowController.winWidth - 260 - @chatMargin
    @setClass 'develop'
    @state = 'develop'


  adjustForSocial:->

    offset = if @windowController.winWidth < 768 then 50 else 160
    @setWidth @windowController.winWidth - offset - @chatMargin
    @setClass 'social'
    @state = 'social'


  _windowDidResize: @::adjustLayoutHelper
<commit_msg>fullwidth adjust fixed<commit_after>class ContentPanel extends KDView

  constructor:(options, data)->

    super options, data

    @registerSingleton "contentPanel", this, yes
    @bindTransitionEnd()
    @listenWindowResize()

    @state              = 'full'
    @chatMargin         = 0
    @windowController or= KD.getSingleton 'windowController'
    @navOpenedOnce      = yes #if KD.isLoggedIn() then yes else no
    mainViewController  = KD.getSingleton "mainViewController"
    mainViewController.on "UILayoutNeedsToChange", @bound "changeLayout"
    mainViewController.on "browseRequested", @bound "browseRequested"

  typeMap =
    full    : 'adjustForFullWidth'
    develop : 'adjustForDevelop'
    social  : 'adjustForSocial'

  nameMap =
    Home    : 'adjustForFullWidth'


  browseRequested:->

    @navOpenedOnce = yes
    @adjustForSocial()
    KD.getSingleton("mainView").mainTabView.changeLayout hideTabs : no


  changeLayout:(options)->

    {type, hideTabs, name}    = options

    @unsetClass 'full develop social'
    @adjustShadow hideTabs
    @navOpenedOnce = yes unless name in ["Home", "Activity"]

    @adjustLayoutHelper name, type


  resetToCurrentState:->

    switch @state
      when 'develop' then @adjustForDevelop()
      when 'social'  then @adjustForSocial()
      when 'full'    then @adjustForFullWidth()


  adjustShadow:(hideTabs)->

    @[if hideTabs then 'setClass' else 'unsetClass'] "no-shadow"


  adjustLayoutHelper:(name, type)->

    if @navOpenedOnce # KD.isLoggedIn() or
    then @[nameMap[name] or typeMap[type] or typeMap[@state]]?()
    else @adjustForFullWidth()


  adjustForFullWidth:->

    @setX 0
    @getElement().style.width = "100%"
    # @setWidth @windowController.winWidth - @chatMargin
    @setClass 'full'
    @state = 'full'


  adjustForDevelop:->

    @setX 260
    @setWidth @windowController.winWidth - 260 - @chatMargin
    @setClass 'develop'
    @state = 'develop'


  adjustForSocial:->

    offset = if @windowController.winWidth < 768 then 50 else 160
    @setWidth @windowController.winWidth - offset - @chatMargin
    @setClass 'social'
    @state = 'social'


  _windowDidResize: @::adjustLayoutHelper

{'fraction_non_alphanumeric': 0.10823311748381129, 'fraction_numerical': 0.008094357076780759, 'mean_word_length': 3.3819655521783183, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6201657', 'n_tokens_mistral': 1446, 'n_tokens_neox': 1302, 'n_words': 318}