Remove ResultId
This commit is contained in:
@@ -9,7 +9,7 @@ import Auth
|
||||
import Task exposing (Task)
|
||||
import Json.Decode exposing (Decoder)
|
||||
import Dict exposing (Dict)
|
||||
import SearchResult exposing (ResultId)
|
||||
import SearchResult
|
||||
|
||||
|
||||
searchFeed : String -> Cmd Msg
|
||||
@@ -32,7 +32,7 @@ responseDecoder =
|
||||
|
||||
type alias Model =
|
||||
{ query : String
|
||||
, results : Dict ResultId SearchResult.Model
|
||||
, results : Dict Int SearchResult.Model
|
||||
, errorMessage : Maybe String
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ viewErrorMessage errorMessage =
|
||||
text ""
|
||||
|
||||
|
||||
viewSearchResults : Dict ResultId SearchResult.Model -> List (Html Msg)
|
||||
viewSearchResults : Dict Int SearchResult.Model -> List (Html Msg)
|
||||
viewSearchResults results =
|
||||
results
|
||||
|> Dict.values
|
||||
@@ -95,7 +95,7 @@ viewSearchResult result =
|
||||
type Msg
|
||||
= Search
|
||||
| SetQuery String
|
||||
| UpdateSearchResult ResultId SearchResult.Msg
|
||||
| UpdateSearchResult Int SearchResult.Msg
|
||||
| HandleSearchResponse (List SearchResult.Model)
|
||||
| HandleSearchError Http.Error
|
||||
|
||||
@@ -119,7 +119,7 @@ update msg model =
|
||||
|
||||
HandleSearchResponse results ->
|
||||
let
|
||||
resultsById : Dict ResultId SearchResult.Model
|
||||
resultsById : Dict Int SearchResult.Model
|
||||
resultsById =
|
||||
results
|
||||
|> List.map (\result -> ( result.id, result ))
|
||||
|
||||
@@ -15,10 +15,6 @@ type alias Model =
|
||||
}
|
||||
|
||||
|
||||
type alias ResultId =
|
||||
Int
|
||||
|
||||
|
||||
type Msg
|
||||
= Expand
|
||||
| Collapse
|
||||
@@ -45,8 +41,8 @@ update msg model =
|
||||
|
||||
view : Model -> Html Msg
|
||||
view model =
|
||||
li []
|
||||
<| if model.expanded then
|
||||
li [] <|
|
||||
if model.expanded then
|
||||
[ span [ class "star-count" ] [ text (toString model.stars) ]
|
||||
, a
|
||||
[ href
|
||||
@@ -61,7 +57,7 @@ view model =
|
||||
, button [ class "hide-result", onClick Collapse ]
|
||||
[ text "X" ]
|
||||
]
|
||||
else
|
||||
else
|
||||
[ button [ class "expand-result", onClick Expand ]
|
||||
[ text "Show" ]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user