on master help sign in
Get src/Main.elm compiling again
7ddee33Evan Czaplicki
ui/browser/src/Main.elm+40−23
@@ -1,29 +1,43 @@
1−module Index.Dashboard exposing
1+module Main exposing (main)
2− ( view
3− )
4
2
5
3
4+import Browser
5+import Dict
6import Html exposing (..)
6import Html exposing (..)
7−import Html.Attributes exposing (class, href, style, title)
7+import Html.Attributes exposing (class, href, src, style, title)
8+import Json.Decode as D
8
9
9−import Elm.Config as Config exposing (Config)
10import Elm.License as License
10import Elm.License as License
11−import Elm.Repo as Repo exposing (Repo)
11+import Elm.Package as Package
12+import Elm.Project as Project
12−import Elm.Version as Version exposing (Version)
13+import Elm.Version as Version
13import Index.Icon as Icon
14import Index.Icon as Icon
14−import Index.Navigator as Navigator exposing ((</>))
15−import Index.Project as Project exposing (Project, File(..))
16import Index.Skeleton as Skeleton
15import Index.Skeleton as Skeleton
17
16
18
17
19
18
19+-- MAIN
20+
21+
22+main : Program () () ()
23+main =
24+ Browser.fullscreen
25+ { init = Debug.crash "init"
26+ , update = Debug.crash "update"
27+ , subscriptions = Debug.crash "subscriptions"
28+ , view = Debug.crash "view"
29+ , onNavigation = Nothing
30+ }
31+
32+
33+
20-- MODEL
34-- MODEL
21
35
22
36
23type alias Model =
37type alias Model =
24 { path : String
38 { path : String
25 , status : ProjectStatus
39 , status : ProjectStatus
26− , directory : Status Directory
40+ , directory : DirectoryStatus
27 }
41 }
28
42
29
43
@@ -33,7 +47,7 @@ type ProjectStatus
33 | ProjectIsValid
47 | ProjectIsValid
34 { root : String
48 { root : String
35 , project : Project.Project
49 , project : Project.Project
36− , exactDeps : List (Package.Name, Version.Version)
50+ , exactDeps : Dict.Dict String Version.Version
37 }
51 }
38
52
39
53
@@ -66,8 +80,7 @@ type alias File =
66
80
67decoder : D.Decoder Directory
81decoder : D.Decoder Directory
68decoder =
82decoder =
69− D.map4 Directory
83+ D.map3 Directory
70− (D.field "path" (D.list D.string))
71 (D.field "dirs" (D.list D.string))
84 (D.field "dirs" (D.list D.string))
72 (D.field "files" (D.list fileDecoder))
85 (D.field "files" (D.list fileDecoder))
73 (D.field "readme" (D.nullable D.string))
86 (D.field "readme" (D.nullable D.string))
@@ -107,18 +120,18 @@ waiting =
107-- VIEW DIRECTORY
120-- VIEW DIRECTORY
108
121
109
122
110−viewDirectory : Project -> Directory -> Html msg
123+viewDirectory : ExactDeps -> Project.Project -> Directory -> Html msg
111−viewDirectory project directory =
124+viewDirectory exactDeps project directory =
112 Skeleton.view
125 Skeleton.view
113− [ Navigator.view pwd
126+ -- Navigator.view pwd TODO
114− , section [ class "left-column" ]
127+ [ section [ class "left-column" ]
115 [ viewFiles directory.dirs directory.files
128 [ viewFiles directory.dirs directory.files
116 , viewReadme directory.readme
129 , viewReadme directory.readme
117 ]
130 ]
118 , section [ class "right-column" ]
131 , section [ class "right-column" ]
119 [ viewProjectSummary project
132 [ viewProjectSummary project
120− , viewDeps project
133+ , viewDeps exactDeps project
121− , viewTestDeps project
134+ , viewTestDeps exactDeps project
122 ]
135 ]
123 , div [ style "clear" "both" ] []
136 , div [ style "clear" "both" ] []
124 ]
137 ]
@@ -170,7 +183,7 @@ viewFile {name} =
170viewProjectSummary : Project.Project -> Html msg
183viewProjectSummary : Project.Project -> Html msg
171viewProjectSummary project =
184viewProjectSummary project =
172 case project of
185 case project of
173− Project.Browser info ->
186+ Project.Application info ->
174 Skeleton.box
187 Skeleton.box
175 { title = "Source Directories"
188 { title = "Source Directories"
176 , items = List.map (\dir -> [text dir]) info.dirs
189 , items = List.map (\dir -> [text dir]) info.dirs
@@ -182,7 +195,7 @@ viewProjectSummary project =
182 Skeleton.box
195 Skeleton.box
183 { title = "Package Info"
196 { title = "Package Info"
184 , items =
197 , items =
185− [ [ text ("Name: " ++ info.name) ]
198+ [ [ text ("Name: " ++ Package.toString info.name) ]
186 , [ text ("Version: " ++ Version.toString info.version) ]
199 , [ text ("Version: " ++ Version.toString info.version) ]
187 , [ text ("License: " ++ License.toString info.license) ]
200 , [ text ("License: " ++ License.toString info.license) ]
188 ]
201 ]
@@ -194,12 +207,16 @@ viewProjectSummary project =
194-- VIEW DEPENDENCIES
207-- VIEW DEPENDENCIES
195
208
196
209
210+type alias ExactDeps =
211+ Dict.Dict String Version.Version
212+
213+
197viewDeps : ExactDeps -> Project.Project -> Html msg
214viewDeps : ExactDeps -> Project.Project -> Html msg
198viewDeps exactDeps project =
215viewDeps exactDeps project =
199 let
216 let
200 dependencies =
217 dependencies =
201 case project of
218 case project of
202− Project.Browser info ->
219+ Project.Application info ->
203 List.map (viewDependency exactDeps) info.deps
220 List.map (viewDependency exactDeps) info.deps
204
221
205 Project.Package info ->
222 Project.Package info ->
@@ -217,7 +234,7 @@ viewTestDeps exactDeps project =
217 let
234 let
218 dependencies =
235 dependencies =
219 case project of
236 case project of
220− Project.Browser info ->
237+ Project.Application info ->
221 List.map (viewDependency exactDeps) info.testDeps
238 List.map (viewDependency exactDeps) info.testDeps
222
239
223 Project.Package info ->
240 Project.Package info ->