<commit_before>module View exposing (view)

import Dict exposing (Dict)
import Html exposing (Html, div, span)
import Html.Attributes
import Html.Events exposing (on)
import Json.Decode as Json
import Mouse
import String exposing (..)
import Svg exposing (..)
import Svg.Attributes exposing (..)


-- mine

import Types exposing (..)


baseStretch =
    5


baseBlur =
    0.8


angleConvert =
    180 / pi


view : Model -> Html Msg
view model =
    div
        [ class "appState-container"
        ]
        [ drawWinModal (model)
        , svg
            [ width "100%"
            , height "100%"
            , onMouseMove
            , onMouseUp
            , onMouseDown
            ]
            (case model.appState of
                LoadingState ->
                    []

                ActiveState gameState ->
                    (List.concat
                        [ drawFilters
                        , drawEdges gameState.nodes gameState.edges
                        , drawNodes model.config gameState.mouseState (List.reverse (Dict.values gameState.nodes))
                        ]
                    )
            )
        , drawLevelSelect (model)
        , drawConfig (model.config)
        ]


drawFilters : List (Html Msg)
drawFilters =
    [ (Svg.filter
        [ id "node-shadow" ]
        [ feGaussianBlur [ stdDeviation "2.5" ] [] ]
      )
    , (Svg.radialGradient
        [ id "node-fill-default" ]
        [ Svg.stop [ offset "75%", stopColor "rgba(255, 255, 255, 1.0)" ] []
        , Svg.stop [ offset "85%", stopColor "rgba(220, 220, 220, 0.7)" ] []
        , Svg.stop [ offset "90%", stopColor "rgba(200, 200, 200, 0.3)" ] []
        , Svg.stop [ offset "95%", stopColor "rgba(180, 180, 180, 0.1)" ] []
        , Svg.stop [ offset "100%", stopColor "rgba(100, 100, 100, 0)" ] []
        ]
      )
    , (Svg.radialGradient
        [ id "node-fill-hover" ]
        [ Svg.stop [ offset "75%", stopColor "rgba(165, 205, 255, 1.0)" ] []
        , Svg.stop [ offset "85%", stopColor "rgba(180, 200, 220, 0.7)" ] []
        , Svg.stop [ offset "90%", stopColor "rgba(150, 200, 200, 0.3)" ] []
        , Svg.stop [ offset "95%", stopColor "rgba(120, 180, 180, 0.1)" ] []
        , Svg.stop [ offset "100%", stopColor "rgba(50, 100, 100, 0)" ] []
        ]
      )
    , (Svg.radialGradient
        [ id "node-fill-drag" ]
        [ Svg.stop [ offset "75%", stopColor "rgba(145, 145, 255, 1.0)" ] []
        , Svg.stop [ offset "85%", stopColor "rgba(120, 140, 220, 0.7)" ] []
        , Svg.stop [ offset "90%", stopColor "rgba(90, 140, 200, 0.3)" ] []
        , Svg.stop [ offset "95%", stopColor "rgba(80, 140, 180, 0.1)" ] []
        , Svg.stop [ offset "100%", stopColor "rgba(50, 100, 100, 0)" ] []
        ]
      )
    , (Svg.radialGradient
        [ id "node-fill-neighbors" ]
        [ Svg.stop [ offset "75%", stopColor "rgba(255, 205, 255, 1.0)" ] []
        , Svg.stop [ offset "85%", stopColor "rgba(255, 200, 220, 0.7)" ] []
        , Svg.stop [ offset "90%", stopColor "rgba(255, 200, 200, 0.3)" ] []
        , Svg.stop [ offset "95%", stopColor "rgba(120, 180, 180, 0.1)" ] []
        , Svg.stop [ offset "100%", stopColor "rgba(50, 100, 100, 0)" ] []
        ]
      )
    ]


drawWinModal : Model -> Html Msg
drawWinModal model =
    let
        isHidden =
            case model.appState of
                LoadingState ->
                    True

                ActiveState gameState ->
                    if gameState.hasWon then
                        False
                    else
                        True

        className =
            if isHidden then
                "win-modal hidden"
            else
                "win-modal"
    in
        div
            [ class className ]
            [ div
                [ class "win-modal-text" ]
                [ text "You did it!" ]
            , div
                [ class "win-modal-button" ]
                [ text "Next Level" ]
            ]


drawNodes : Config -> MouseState -> List Node -> List (Html Msg)
drawNodes config mouseState nodesList =
    (List.concat (List.map (drawNode config mouseState) nodesList))


drawNode : Config -> MouseState -> Node -> List (Html Msg)
drawNode config mouseState node =
    let
        realPosition =
            node.pos

        stretch =
            baseStretch * node.vel.r

        blur =
            getBlur node

        rad =
            config.radius

        realXRad =
            rad + stretch<commit_msg>'Next Level' button works<commit_after>module View exposing (view)

import Dict exposing (Dict)
import Html exposing (Html, div, span)
import Html.Attributes
import Html.Events exposing (on)
import Json.Decode as Json
import Mouse
import String exposing (..)
import Svg exposing (..)
import Svg.Attributes exposing (..)


-- mine

import Types exposing (..)


baseStretch =
    5


baseBlur =
    0.8


angleConvert =
    180 / pi


view : Model -> Html Msg
view model =
    div
        [ class "appState-container"
        ]
        [ drawWinModal (model)
        , svg
            [ width "100%"
            , height "100%"
            , onMouseMove
            , onMouseUp
            , onMouseDown
            ]
            (case model.appState of
                LoadingState ->
                    []

                ActiveState gameState ->
                    (List.concat
                        [ drawFilters
                        , drawEdges gameState.nodes gameState.edges
                        , drawNodes model.config gameState.mouseState (List.reverse (Dict.values gameState.nodes))
                        ]
                    )
            )
        , drawLevelSelect (model)
        , drawConfig (model.config)
        ]


drawFilters : List (Html Msg)
drawFilters =
    [ (Svg.filter
        [ id "node-shadow" ]
        [ feGaussianBlur [ stdDeviation "2.5" ] [] ]
      )
    , (Svg.radialGradient
        [ id "node-fill-default" ]
        [ Svg.stop [ offset "75%", stopColor "rgba(255, 255, 255, 1.0)" ] []
        , Svg.stop [ offset "85%", stopColor "rgba(220, 220, 220, 0.7)" ] []
        , Svg.stop [ offset "90%", stopColor "rgba(200, 200, 200, 0.3)" ] []
        , Svg.stop [ offset "95%", stopColor "rgba(180, 180, 180, 0.1)" ] []
        , Svg.stop [ offset "100%", stopColor "rgba(100, 100, 100, 0)" ] []
        ]
      )
    , (Svg.radialGradient
        [ id "node-fill-hover" ]
        [ Svg.stop [ offset "75%", stopColor "rgba(165, 205, 255, 1.0)" ] []
        , Svg.stop [ offset "85%", stopColor "rgba(180, 200, 220, 0.7)" ] []
        , Svg.stop [ offset "90%", stopColor "rgba(150, 200, 200, 0.3)" ] []
        , Svg.stop [ offset "95%", stopColor "rgba(120, 180, 180, 0.1)" ] []
        , Svg.stop [ offset "100%", stopColor "rgba(50, 100, 100, 0)" ] []
        ]
      )
    , (Svg.radialGradient
        [ id "node-fill-drag" ]
        [ Svg.stop [ offset "75%", stopColor "rgba(145, 145, 255, 1.0)" ] []
        , Svg.stop [ offset "85%", stopColor "rgba(120, 140, 220, 0.7)" ] []
        , Svg.stop [ offset "90%", stopColor "rgba(90, 140, 200, 0.3)" ] []
        , Svg.stop [ offset "95%", stopColor "rgba(80, 140, 180, 0.1)" ] []
        , Svg.stop [ offset "100%", stopColor "rgba(50, 100, 100, 0)" ] []
        ]
      )
    , (Svg.radialGradient
        [ id "node-fill-neighbors" ]
        [ Svg.stop [ offset "75%", stopColor "rgba(255, 205, 255, 1.0)" ] []
        , Svg.stop [ offset "85%", stopColor "rgba(255, 200, 220, 0.7)" ] []
        , Svg.stop [ offset "90%", stopColor "rgba(255, 200, 200, 0.3)" ] []
        , Svg.stop [ offset "95%", stopColor "rgba(120, 180, 180, 0.1)" ] []
        , Svg.stop [ offset "100%", stopColor "rgba(50, 100, 100, 0)" ] []
        ]
      )
    ]


drawWinModal : Model -> Html Msg
drawWinModal model =
    case model.appState of
        LoadingState ->
            div [] []

        ActiveState gameState ->
            let
                isHidden =
                    if gameState.hasWon then
                        False
                    else
                        True

                className =
                    if isHidden then
                        "win-modal hidden"
                    else
                        "win-modal"

                nextDifficulty =
                    gameState.difficulty + 1
            in
                div
                    [ class className ]
                    [ div
                        [ class "win-modal-text" ]
                        [ text "You did it!" ]
                    , div
                        [ class "win-modal-button"
                        , Html.Events.onClick (GenerateEdges nextDifficulty)
                        ]
                        [ text "Next Level" ]
                    ]


drawNodes : Config -> MouseState -> List Node -> List (Html Msg)
drawNodes config mouseState nodesList =
    (List.concat (List.map (drawNode config mouseState) nodesList))


drawNode : Config -> MouseState -> Node -> List (Html Msg)
drawNode config mouseState node =
    let
        realPosition =
            node.pos

        stretch =
            baseStretch * node.vel.r

        blur =
            getBlur node

        rad =
            config.radius

        realXRad =
            rad + stretch
{'fraction_non_alphanumeric': 0.13226885316646889, 'fraction_numerical': 0.058150825331751, 'mean_word_length': 1.4595383390819847, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, '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': '2286864', 'n_tokens_mistral': 3365, 'n_tokens_neox': 2833, 'n_words': 724}