<commit_before>module Index where

import Color exposing (Color, darkGrey)
import Dict
import FontAwesome as FA
import Html exposing (..)
import Html.Attributes exposing (..)
import Markdown
import Signal exposing (Signal, Address)
import String
import Util exposing (..)


-- MAIN

main : Html
main =
  view info


port info : Model


-- MODEL

type alias Model =
    { pwd : List String
    , dirs : List String
    , files : List String
    , pkg : Maybe PackageInfo
    , readme : Maybe String
    }


type alias PackageInfo =
    { version : String
    , repository : String
    , summary : String
    , dependencies : List (String, String)
    }


-- CONSTANTS

(=>) = (,)


pageWidth = "960px"
smallBoxWidth = "300px"
largeBoxWidth = "600px"


floatLeft =
  [ "float" => "left" ]


floatRight =
  [ "float" => "right" ]


boxStyles =
  [ "border" => "1px solid #c7c7c7"
  , "border-radius" => "5px"
  ]


boxHeaderStyles =
  [ "background-color" => "#fafafa"
  , "text-align" => "center"
  ]


blockStyles =
  [ "display" => "block"
  , "overflow" => "hidden"
  , "padding" => "7px 12px"
  ]


boxItemStyles =
  [ "border-top" => "1px solid #e1e1e1" ]


clearfix : Html
clearfix =
  div [ style [ "clear" => "both" ] ] []


-- VIEW

view : Model -> Html
view model =
  let
    packageDependants pkgInfo =
      [ div
          [ style ("width" => smallBoxWidth :: floatRight)
          ]
          [ viewPackageInfo pkgInfo
          , dependenciesView pkgInfo.dependencies
          ]
      ]

    contents =
      navigator model.pwd
      :: folderView model
      :: Maybe.withDefault [] (Maybe.map packageDependants model.pkg)
      ++ [ clearfix ]
  in
    div []
      [ pageHeader model
      , div
          [ style
              [ "width" => pageWidth
              , "margin-left" => "auto"
              , "margin-right" => "auto"
              ]
          ]
          contents
      ]



pageHeader : Model -> Html
pageHeader model =
  header
    [ style
        [ "width" => "100%"
        , "background-color" => "#60B5CC"
        , "height" => "8px"
        ]
    ]
    []


folderView : Model -> Html
folderView model =
  let
    files =
      div
        [ style (boxStyles ++ ["margin-bottom" => "30px"]) ]
        (
          div [ style <| boxHeaderStyles ++ blockStyles ] [ text "File Navigation" ]
          :: List.map folderDisplay (List.sort model.dirs)
          ++ List.map fileDisplay (List.sort model.files)
        )

    viewReadme markdown =
      [ div
          [ style boxStyles ]
          [ div [ style (blockStyles ++ boxHeaderStyles) ] [ text "README" ]
          , div [ style (blockStyles ++ boxItemStyles) ] [ Markdown.toHtml markdown ]
          ]
      ]
  in
    section
      [ style (floatLeft ++ ["width" => largeBoxWidth])
      ]
      (files :: Maybe.withDefault [] (Maybe.map viewReadme model.readme))


folderDisplay : String -> Html
folderDisplay folder =
  div
    [ style (blockStyles ++ boxItemStyles)
    ]<commit_msg>Add padding to the bottom of both columns<commit_after>module Index where

import Color exposing (Color, darkGrey)
import Dict
import FontAwesome as FA
import Html exposing (..)
import Html.Attributes exposing (..)
import Markdown
import Signal exposing (Signal, Address)
import String
import Util exposing (..)


-- MAIN

main : Html
main =
  view info


port info : Model


-- MODEL

type alias Model =
    { pwd : List String
    , dirs : List String
    , files : List String
    , pkg : Maybe PackageInfo
    , readme : Maybe String
    }


type alias PackageInfo =
    { version : String
    , repository : String
    , summary : String
    , dependencies : List (String, String)
    }


-- CONSTANTS

(=>) = (,)


pageWidth = "960px"
smallBoxWidth = "300px"
largeBoxWidth = "600px"


floatLeft =
  [ "float" => "left" ]


floatRight =
  [ "float" => "right" ]


boxStyles =
  [ "border" => "1px solid #c7c7c7"
  , "border-radius" => "5px"
  ]


boxHeaderStyles =
  [ "background-color" => "#fafafa"
  , "text-align" => "center"
  ]


blockStyles =
  [ "display" => "block"
  , "overflow" => "hidden"
  , "padding" => "7px 12px"
  ]


boxItemStyles =
  [ "border-top" => "1px solid #e1e1e1" ]


clearfix : Html
clearfix =
  div [ style [ "clear" => "both" ] ] []


-- VIEW

view : Model -> Html
view model =
  let
    rightColumnView pkgInfo =
      [ div
          [ style ("width" => smallBoxWidth :: "padding-bottom" => "80px" :: floatRight)
          ]
          [ viewPackageInfo pkgInfo
          , dependenciesView pkgInfo.dependencies
          ]
      ]

    contents =
      navigator model.pwd
      :: leftColumnView model
      :: Maybe.withDefault [] (Maybe.map rightColumnView model.pkg)
      ++ [ clearfix ]
  in
    div []
      [ pageHeader model
      , div
          [ style
              [ "width" => pageWidth
              , "margin-left" => "auto"
              , "margin-right" => "auto"
              ]
          ]
          contents
      ]



pageHeader : Model -> Html
pageHeader model =
  header
    [ style
        [ "width" => "100%"
        , "background-color" => "#60B5CC"
        , "height" => "8px"
        ]
    ]
    []


leftColumnView : Model -> Html
leftColumnView model =
  let
    files =
      div
        [ style (boxStyles ++ ["margin-bottom" => "30px"]) ]
        (
          div [ style <| boxHeaderStyles ++ blockStyles ] [ text "File Navigation" ]
          :: List.map folderDisplay (List.sort model.dirs)
          ++ List.map fileDisplay (List.sort model.files)
        )

    viewReadme markdown =
      [ div
          [ style boxStyles ]
          [ div [ style (blockStyles ++ boxHeaderStyles) ] [ text "README" ]
          , div [ style (blockStyles ++ boxItemStyles) ] [ Markdown.toHtml markdown ]
          ]
      ]
  in
    section
      [ style (floatLeft ++ ["width" => largeBoxWidth, "padding-bottom" => "80px"])
      ]
      (files :: Maybe.withDefault [] (Maybe.map viewReadme model.readme))


folderDisplay : String -> Html
folderDisplay folder =
  div
    [ style (blockStyles ++ boxItemStyles)
    ]
{'fraction_non_alphanumeric': 0.12949521610029693, 'fraction_numerical': 0.010557571758495546, 'mean_word_length': 2.088639836984208, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 55, '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': '721615', 'n_tokens_mistral': 2008, 'n_tokens_neox': 1934, 'n_words': 483}