<commit_before>goog.provide 'app.react.pages.MySongs'

class app.react.pages.MySongs

  ###*
    @param {app.Routes} routes
    @param {app.user.Store} userStore
    @param {app.react.Touch} touch
    @param {app.Firebase} firebase
    @constructor
  ###
  constructor: (routes, userStore, touch, firebase) ->
    {div,h1,ul,li,p,nav,button} = React.DOM
    {a} = touch.scroll 'a'

    @component = React.createClass

      render: ->
        allSongs = userStore.songsSortedByName()
        songs = allSongs
          .filter (song) -> !song.inTrash
          .map (song) ->
            li key: song.id,
              a href: routes.mySong.url(song),
                "#{song.getDisplayName()} [#{song.getDisplayArtist()}]"
        deletedSongs = allSongs.filter (song) -> song.inTrash

        div className: 'page',
          if songs.length
            ul className: 'songs', songs
          else
            p {}, MySongs.MSG_NO_SONGS
          nav {},
            a
              className: 'btn btn-link'
              href: routes.newSong.url()
            , MySongs.MSG_ADD_NEW_SONG
            deletedSongs.length > 0 &&
              a
                className: 'btn btn-link'
                href: routes.trash.url()
              , "Trash (#{deletedSongs.length})"

  @MSG_ADD_NEW_SONG: goog.getMsg 'New Song'
  @MSG_NO_SONGS: goog.getMsg 'No songs.'<commit_msg>Better message.<commit_after>goog.provide 'app.react.pages.MySongs'

class app.react.pages.MySongs

  ###*
    @param {app.Routes} routes
    @param {app.user.Store} userStore
    @param {app.react.Touch} touch
    @param {app.Firebase} firebase
    @constructor
  ###
  constructor: (routes, userStore, touch, firebase) ->
    {div,h1,ul,li,p,nav,button} = React.DOM
    {a} = touch.scroll 'a'

    @component = React.createClass

      render: ->
        allSongs = userStore.songsSortedByName()
        songs = allSongs
          .filter (song) -> !song.inTrash
          .map (song) ->
            li key: song.id,
              a href: routes.mySong.url(song),
                "#{song.getDisplayName()} [#{song.getDisplayArtist()}]"
        deletedSongs = allSongs.filter (song) -> song.inTrash

        div className: 'page',
          if songs.length
            ul className: 'songs', songs
          else
            p {}, MySongs.MSG_NO_SONGS
          nav {},
            a
              className: 'btn btn-link'
              href: routes.newSong.url()
            , MySongs.MSG_ADD_NEW_SONG
            deletedSongs.length > 0 &&
              a
                className: 'btn btn-link'
                href: routes.trash.url()
              , "Trash (#{deletedSongs.length})"

  @MSG_ADD_NEW_SONG: goog.getMsg 'New Song'
  @MSG_NO_SONGS: goog.getMsg "
    You have no songs stored on your device yet. Add or search one.
  "
{'fraction_non_alphanumeric': 0.12651030561478321, 'fraction_numerical': 0.0014214641080312722, 'mean_word_length': 1.8695208970438328, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '4319321', 'n_tokens_mistral': 932, 'n_tokens_neox': 886, 'n_words': 189}