Skip to content

Commit 27b8a4c

Browse files
Use consistent naming
1 parent fff7fe8 commit 27b8a4c

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

examples/Example/Page/Todos/TodoCSS.hs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ data AllTodos = AllTodos
5555
instance (Todos :> es) => HyperView AllTodos es where
5656
type Require AllTodos = '[TodoView]
5757

58-
newtype Action AllTodos = MkAction Shared.TodosAction
58+
newtype Action AllTodos = MkTodosAction Shared.TodosAction
5959
deriving newtype (Generic, ViewAction)
6060

61-
update (MkAction action) = do
61+
update (MkTodosAction action) = do
6262
case action of
6363
Shared.ClearCompleted ->
6464
todosView FilterAll <$> Shared.updateTodos Shared.ClearCompleted
@@ -88,7 +88,7 @@ todosView filt todos = do
8888
label'
8989
@ class_ "toggle-all-label"
9090
. att "for" "toggle-all"
91-
. onClick (MkAction $ Shared.ToggleAll filt)
91+
. onClick (MkTodosAction $ Shared.ToggleAll filt)
9292
$ text "Mark all as complete"
9393

9494
ul' @ class_ "todo-list" $ do
@@ -100,7 +100,7 @@ todosView filt todos = do
100100
todoForm :: View AllTodos ()
101101
todoForm = do
102102
let f :: TodoForm FieldName = fieldNames
103-
form (MkAction Shared.SubmitTodo) $ do
103+
form (MkTodosAction Shared.SubmitTodo) $ do
104104
field f.task $ do
105105
Input (FieldName nm) <- context
106106
input' -- we use a custom input field, because the Hyperbole one overrides autocomplete
@@ -136,12 +136,12 @@ statusBar filt todos = do
136136
filterLi Active "Active"
137137
filterLi Completed "Completed"
138138
space
139-
button (MkAction Shared.ClearCompleted) @ class_ "clear-completed" $ "Clear completed"
139+
button (MkTodosAction Shared.ClearCompleted) @ class_ "clear-completed" $ "Clear completed"
140140
where
141141
filterLi f str =
142142
li' @ class_ "filter" . selectedFilter f $ do
143143
a
144-
@ onClick (MkAction $ Shared.Filter f)
144+
@ onClick (MkTodosAction $ Shared.Filter f)
145145
. att "href" "" -- harmless empty href is for the CSS
146146
$ text str
147147
selectedFilter f =
@@ -157,12 +157,12 @@ instance (Todos :> es) => HyperView TodoView es where
157157

158158
data Action TodoView
159159
= Edit FilterTodo Todo
160-
| MkTodoViewAction FilterTodo Shared.TodoAction
160+
| MkTodoAction FilterTodo Shared.TodoAction
161161
deriving (Generic, ViewAction)
162162

163163
update (Edit filt todo) = do
164164
pure $ todoEditView filt todo
165-
update (MkTodoViewAction filt action) = do
165+
update (MkTodoAction filt action) = do
166166
todoView filt <$> Shared.updateTodo action
167167

168168
todoView :: FilterTodo -> Todo -> View TodoView ()
@@ -176,20 +176,20 @@ todoView filt todo = do
176176
input'
177177
@ class_ "toggle"
178178
. att "type" "checkbox"
179-
. onClick (MkAction $ Shared.SetCompleted filt todo $ not todo.completed)
179+
. onClick (MkTodosAction $ Shared.SetCompleted filt todo $ not todo.completed)
180180
. checked todo.completed
181181

182182
label' @ class_ "label" . onDblClick (Edit filt todo) $ do
183183
text todo.task
184184

185185
target AllTodos $ do
186-
button (MkAction $ Shared.Destroy filt todo) @ class_ "destroy" $ ""
186+
button (MkTodosAction $ Shared.Destroy filt todo) @ class_ "destroy" $ ""
187187

188188
todoEditView :: FilterTodo -> Todo -> View TodoView ()
189189
todoEditView filt todo = do
190190
let f = fieldNames @TodoForm
191191
li' @ class_ "editing" $ do
192-
form (MkTodoViewAction filt $ Shared.SubmitEdit todo) $ do
192+
form (MkTodoAction filt $ Shared.SubmitEdit todo) $ do
193193
let taskField = Input f.task
194194
-- Instead of using the `field` FormField wrapper, we add the context manually
195195
-- and use a custom input field for maximum control over the generated HTML

0 commit comments

Comments
 (0)