<commit_before>module Choosers.GeneralGroupChooser exposing (generalgroupchooser, creategeneralgroupchooserdata)

import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Choosers.Types exposing (..)
import ViewHelper.ViewExtra exposing (..)
import SWEditor.DisplaySvg exposing (symbolsvg)
import Material.Tooltip as Tooltip exposing (attach, render, left)
import Material.Options as Options exposing (div, cs, when)
import SWEditor.EditorSymbol exposing (..)
import Exts.List exposing (..)
import SW.Pua exposing (codefromkey)
import Choosers.SymbolToolTip exposing (..)


-- View


generalgroupchooser : List (List GeneralGroupChooserColumData) -> Html Msg
generalgroupchooser tabledata =
    table []
        (List.map row tabledata)


row : List GeneralGroupChooserColumData -> Html Msg
row rowdata =
    tr
        []
        (List.map column rowdata)


column : GeneralGroupChooserColumData -> Html Msg
column columndata =
    td
        [ class "chosercolumn"
        , style
            [ "background-color" => (bkcolor columndata.row columndata.col) ]
        ]
        (List.map
            symbol
            columndata.symboldatalist
        )


symbol : GeneralGroupChooserSymbolData -> Html Msg
symbol symboldata =
    Html.div
        [ onClick (GroupSelected symboldata.chooseritem)
        , onMouseDown (DragSymbol symboldata.symbol.key)
        , onDoubleClick (ReplaceSymbol symboldata.symbol.key)
        , style
            [ "margin-top" => px 3 ]
        ]
        (symboltooltip
            symboldata.modelmdl
            symboldata.mdlid
            symboldata.chooseritem.name
            [ Html.map SignView
                (symbolsvg "" symboldata.symbol)
            ]
        )



--State functions


creategeneralgroupchooserdata : Model -> List (List GeneralGroupChooserColumData)
creategeneralgroupchooserdata model =
    let
        basesymbol =
            String.slice 0 4 model.clicked

        choosings =
            getchoosings basesymbol model.allgroupchoosings

        rowvalues =
            List.sort <| unique <| List.map (\item -> item.row) choosings

        tabledata =
            creategeneralgroupchoosertabledata model choosings rowvalues
    in
        tabledata


creategeneralgroupchoosertabledata : Choosers.Types.Model -> List ChooserItem -> List Int -> List (List GeneralGroupChooserColumData)<commit_msg>Adding hover back to General Group symbol chooser<commit_after>module Choosers.GeneralGroupChooser exposing (generalgroupchooser, creategeneralgroupchooserdata)

import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Choosers.Types exposing (..)
import ViewHelper.ViewExtra exposing (..)
import SWEditor.DisplaySvg exposing (symbolsvg)
import SWEditor.EditorSymbol exposing (..)
import Exts.List exposing (..)
import SW.Pua exposing (codefromkey)
import Choosers.SymbolToolTip exposing (..)


-- View


generalgroupchooser : List (List GeneralGroupChooserColumData) -> Html Msg
generalgroupchooser tabledata =
    table []
        (List.map row tabledata)


row : List GeneralGroupChooserColumData -> Html Msg
row rowdata =
    tr
        []
        (List.map column rowdata)


column : GeneralGroupChooserColumData -> Html Msg
column columndata =
    td
        [ class "chosercolumn"
        , style
            [ "background-color" => (bkcolor columndata.row columndata.col) ]
        ]
        (List.map
            symbol
            columndata.symboldatalist
        )


symbol : GeneralGroupChooserSymbolData -> Html Msg
symbol symboldata =
    Html.div
        [ onClick (GroupSelected symboldata.chooseritem)
        , onMouseDown (DragSymbol symboldata.symbol.key)
        , onDoubleClick (ReplaceSymbol symboldata.symbol.key)
        , style
            [ "margin-top" => px 3 ]
        ]
        (symboltooltip
            symboldata.modelmdl
            symboldata.mdlid
            symboldata.chooseritem.name
            [ Html.map SignView
                (symbolsvg "hover" symboldata.symbol)
            ]
        )



--State functions


creategeneralgroupchooserdata : Model -> List (List GeneralGroupChooserColumData)
creategeneralgroupchooserdata model =
    let
        basesymbol =
            String.slice 0 4 model.clicked

        choosings =
            getchoosings basesymbol model.allgroupchoosings

        rowvalues =
            List.sort <| unique <| List.map (\item -> item.row) choosings

        tabledata =
            creategeneralgroupchoosertabledata model choosings rowvalues
    in
        tabledata


creategeneralgroupchoosertabledata : Choosers.Types.Model -> List ChooserItem -> List Int -> List (List GeneralGroupChooserColumData)
{'fraction_non_alphanumeric': 0.07721518987341772, 'fraction_numerical': 0.0012658227848101266, 'mean_word_length': 2.586232980332829, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, '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': '4994912', 'n_tokens_mistral': 1433, 'n_tokens_neox': 1375, 'n_words': 319}