justinrassier / elm-contribution-graph / ContributionGraph

This module creates a GitHub-style contribution graph based on a simple Contribution model. The original intent is to have leaderboard, so each contribution has a point value associated.

Models


type Model

Opaque data model that holds the internal state of the Contribution Graph


type alias Config =
{ repoCommitUrl : String }

Config options that are specific to your provider and your repo

Example:

config =
    { repoCommitUrl = "https://github.com/justinrassier/elm-contribution-graph/"
    }


type alias Contribution =
{ mergeTimestamp : Time.Posix
, title : String
, commitSha : String
, points : Basics.Int 
}

Contribution data model used to display data in the graph.

Standard Elm Architecture Pieces

view : Model -> Html.Styled.Html Msg

View function to render contribution graph as an SVG

update : Msg -> Model -> ( Model, Platform.Cmd.Cmd Msg )

Standard update function that handles Contribution Graph interactions. Hook up to your update function using Cmd.map


type Msg

Messages that the Contribution Graph responds to update its internal state

Common Helpers

init : Config -> List Contribution -> ( Model, Platform.Cmd.Cmd Msg )

Initialize the Model, which is an opaque type that controls the internal state of the graph

setContributions : List Contribution -> Model -> Model

Setter for the list of Contributions in the Model to render