on master help sign in
Added animations
commit601f905e2a3c4eaccbcf2440317e93c659aedfac authoriko <mail@iko.soy> dateSat 5 Aug 2023, 12:19 (3 years ago) parent683f1d1
4 files changed+30−7
frontend/index.html+5 frontend/src/Main.elm+17−4 zod/seax/app/seax.hoon+6−1 zod/seax/lib/rank.hoon+2−2
frontend/index.html+5
@@ -15,6 +15,7 @@
1515 transform: traslateY(0);
1616 }
1717 }
18+
1819 .bobbing {
1920 animation-duration: 2s;
2021 animation-name: bobbing;
@@ -22,6 +23,10 @@
2223 animation-direction: alternate;
2324 animation-timing-function: ease-in-out;
2425 }
26+
27+ .hidden-engine {
28+ transition: max-width 1s ease-out, top 1s ease-out, margin-left 1s ease-out;
29+ }
2530 </style>
2631 </head>
2732 <body>
frontend/src/Main.elm+17−4
@@ -199,13 +199,17 @@ view model =
199199 [ row [ spacing 16, width fill ]
200200 [ searchView model |> el [ padding 8 ]
201201 , model.engines
202− |> List.filter (\( _, state ) -> state /= Failed)
203202 |> List.map
204203 (\( name, state ) ->
205− text ("%" ++ name)
204+ ( name
205+ , text ("%" ++ name)
206206 |> el
207207 ([ Font.size 43
208208 , Font.bold
209+ , Html.Attributes.style "max-width" "300px"
210+ |> htmlAttribute
211+
212+ -- , clip
209213 ]
210214 ++ (if Set.isEmpty model.selectedEngines then
211215 []
@@ -232,11 +236,20 @@ view model =
232236 ]
233237
234238 Failed ->
235− []
239+ [ Html.Attributes.class "hidden-engine" |> htmlAttribute
240+ , Html.Attributes.style "max-width" "0px" |> htmlAttribute
241+ , Html.Attributes.style "top" "-100px"
242+ |> htmlAttribute
243+ , Html.Attributes.style "margin" "0"
244+ |> htmlAttribute
245+ , Font.color (rgb 0.8 0.8 0.8)
246+ , Html.Attributes.class "bobbing" |> htmlAttribute
247+ ]
236248 )
237249 )
250+ )
238251 )
239− |> row
252+ |> Keyed.row
240253 [ spacing 16
241254 , clipX
242255 , scrollbarX
zod/seax/app/seax.hoon+6−1
@@ -52,6 +52,7 @@ $:
5252 (~(get by search-results:(~(got by search-subscriptions.state) query)) engine)
5353 ?~ results %loading
5454 ?~ +.results %failed
55+ ?~ +.+.results %failed
5556 %completed
5657=* search-results
5758 |= =query
@@ -61,6 +62,7 @@ $:
6162 search-results.search-state
6263=* sink-for-query
6364 |= =query
65+ ~& (~(get by search-subscriptions.state) query)
6466 [(current-engines query) (search-results query)]
6567=* sink
6668 |= =query
@@ -145,8 +147,11 @@ $:
145147 =. search-subscriptions.state
146148 (~(put by search-subscriptions.state) query search-subscription)
147149 =^ card sink (sync:sink (sink-for-query query))
150+ ~& (current-engines query)
148151 [~[card] this]
149152 ==
150−++ on-fail |=([term tang] `..on-init)
153+++ on-fail
154+ |= [term =tang]
155+ ((slog tang) `this)
151156--
152157
zod/seax/lib/rank.hoon+2−2
@@ -9,9 +9,9 @@
99 %- zing
1010 %+ turn results
1111 |= [engine=term results=(list search-result)]
12− %+ turn (zip (gulf 1 (lent results)) results)
12+ %+ turn (zip (gulf 0 (lent results)) results)
1313 |= [ord=@u result=search-result]
14− %- malt ~[[url.result [~[engine] ~[ord] result]]]
14+ %- malt ~[[url.result [~[engine] ~[+(ord)] result]]]
1515=/ url-to-engines-map
1616 ^- (map @t [engines=(list term) ords=(list @u) result=search-result])
1717 %+ roll url-to-engine-map