@@ -117,48 +117,61 @@ subscriptions model =
117
117
118
118
view : Model -> Html Msg
119
119
view { running, entries } =
120
+ div [] <|
121
+ ( viewEarlyEntries running entries)
122
+ ++ ( viewLaterEntries running entries)
123
+ ++ [ button
124
+ [ style [ ( " width" , " 100%" ) ]
125
+ , disabled running
126
+ , onClick Start
127
+ ]
128
+ [ text " Run" ]
129
+ ]
130
+
131
+
132
+ viewEarlyEntries : Bool -> List Entry -> List (Html Msg )
133
+ viewEarlyEntries running entries =
120
134
let
121
135
earlyEntries =
122
136
entries |> List . filter ( \ entry -> not entry. impl. afterBlogPost)
123
137
124
138
laterEntries =
125
139
entries |> List . filter ( \ entry -> entry. impl. afterBlogPost)
126
140
in
127
- div [] <|
128
- [ h2 [] [ text " Before Blog Post" ]
141
+ ( if List . isEmpty laterEntries then
142
+ []
143
+ else
144
+ [ h2 [] [ text " Before Blog Post" ] ]
145
+ )
146
+ ++ [ ul
147
+ ( if running then
148
+ [ style [ ( " color" , " #aaa" ) ] ]
149
+ else
150
+ []
151
+ )
152
+ ( List . map ( viewEntry running) earlyEntries)
153
+ ]
154
+
155
+
156
+ viewLaterEntries : Bool -> List Entry -> List (Html Msg )
157
+ viewLaterEntries running entries =
158
+ let
159
+ laterEntries =
160
+ entries |> List . filter ( \ entry -> entry. impl. afterBlogPost)
161
+ in
162
+ if List . isEmpty laterEntries then
163
+ []
164
+ else
165
+ [ hr [] []
166
+ , h2 [] [ text " After Blog Post" ]
129
167
, ul
130
168
( if running then
131
169
[ style [ ( " color" , " #aaa" ) ] ]
132
170
else
133
171
[]
134
172
)
135
- ( List . map ( viewEntry running) earlyEntries )
173
+ ( List . map ( viewEntry running) laterEntries )
136
174
]
137
- ++ ( viewLaterEntries running laterEntries)
138
- ++ [ button
139
- [ style [ ( " width" , " 100%" ) ]
140
- , disabled running
141
- , onClick Start
142
- ]
143
- [ text " Run" ]
144
- ]
145
-
146
-
147
- viewLaterEntries : Bool -> List Entry -> List (Html Msg )
148
- viewLaterEntries running entries =
149
- if List . isEmpty entries then
150
- []
151
- else
152
- [ hr [] []
153
- , h2 [] [ text " After Blog Post" ]
154
- , ul
155
- ( if running then
156
- [ style [ ( " color" , " #aaa" ) ] ]
157
- else
158
- []
159
- )
160
- ( List . map ( viewEntry running) entries)
161
- ]
162
175
163
176
164
177
viewEntry : Bool -> Entry -> Html Msg
0 commit comments