summaryrefslogtreecommitdiff
path: root/elm/Lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-05-12 14:34:47 +0200
committerYorhel <git@yorhel.nl>2020-05-12 14:34:47 +0200
commite169129934ac56d0f0758c981da009523bf4619f (patch)
treedad407687a8d249e5c4348160752c7d04f971834 /elm/Lib
parent13d14259b08ab9d40f14bfc3edabb816e3ea8d20 (diff)
Chars::Edit: Add instance editing
Diffstat (limited to 'elm/Lib')
-rw-r--r--elm/Lib/Api.elm1
-rw-r--r--elm/Lib/Autocomplete.elm19
2 files changed, 20 insertions, 0 deletions
diff --git a/elm/Lib/Api.elm b/elm/Lib/Api.elm
index ee2df07f..63f519cc 100644
--- a/elm/Lib/Api.elm
+++ b/elm/Lib/Api.elm
@@ -47,6 +47,7 @@ showResponse res =
TagResult _ -> unexp
VNResult _ -> unexp
ProducerResult _ -> unexp
+ CharResult _ -> unexp
ImageResult _ -> unexp
diff --git a/elm/Lib/Autocomplete.elm b/elm/Lib/Autocomplete.elm
index 5cda67eb..1b8f2edc 100644
--- a/elm/Lib/Autocomplete.elm
+++ b/elm/Lib/Autocomplete.elm
@@ -8,6 +8,7 @@ module Lib.Autocomplete exposing
, tagSource
, vnSource
, producerSource
+ , charSource
, init
, clear
, update
@@ -32,6 +33,7 @@ import Gen.Boards as GB
import Gen.Tags as GT
import Gen.VN as GV
import Gen.Producers as GP
+import Gen.Chars as GC
type alias Config m a =
@@ -125,6 +127,23 @@ producerSource =
}
+charSource : SourceConfig m GApi.ApiCharResult
+charSource =
+ { source = Endpoint (\s -> GC.send { search = s })
+ <| \x -> case x of
+ GApi.CharResult e -> Just e
+ _ -> Nothing
+ , view = \i ->
+ [ b [ class "grayedout" ] [ text <| "c" ++ String.fromInt i.id ++ ": " ]
+ , text i.name
+ , Maybe.withDefault (text "") <| Maybe.map (\m ->
+ b [ class "grayedout" ] [ text <| " (instance of c" ++ String.fromInt m.id ++ ": " ++ m.name ]
+ ) i.main
+ ]
+ , key = \i -> String.fromInt i.id
+ }
+
+
type alias Model a =
{ visible : Bool
, value : String