Created
February 4, 2016 07:08
-
-
Save dcapwell/276232d980e8dd76db91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Tracker where | |
---- MODEL ---- | |
type alias Dashboard = | |
{ name : String | |
, active : Bucket | |
, pending : Bucket | |
, icebox : Bucket } | |
type BucketType | |
= Active | |
| Pending | |
| Icebox | |
type alias Bucket = | |
{ title : String | |
, description : String | |
, issues : List Issue } | |
type alias Issue = | |
{ iid : Int | |
, title : String | |
, description : String | |
, state : State | |
, labels : List String} | |
type State | |
= Open | |
| Closed | |
type alias User = String | |
initialDashboard : Dashboard | |
initialDashboard = | |
{ name = "Primary" | |
, active = emptyBucket "Active" "Issues under active development" | |
, pending = emptyBucket "Pending" "High priority issues that are not in active development" | |
, icebox = emptyBucket "Icebox" "Low priority, unordered issues" } | |
emptyBucket : String -> String -> Bucket | |
emptyBucket title description = | |
{ title = title | |
, description = description | |
, issues = [] } | |
newIssue : Int -> String -> String -> State -> List String -> Issue | |
newIssue iid title description state labels = | |
{ iid = iid | |
, title = title | |
, description = description | |
, state = state | |
, labels = labels } | |
---- UPDATE ---- | |
type Action | |
= NoOp | |
| Add BucketType Issue | |
update : Action -> Dashboard -> Dashboard | |
update action dashboard = | |
case action of | |
NoOp -> dashboard | |
Add t issue -> | |
case t of | |
Active -> { dashboard | action = dashboard.action ++ [ issue ] } | |
Pending -> { dashboard | pending = dashboard.pending ++ [ issue ] } | |
Icebox -> { dashboard | icebox = dashboard.icebox ++ [ issue ] } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can rename file to Tracker.elm, so there would be syntax highlight.