on master help sign in
Merge pull request #14 from vagos/frontend-imprs
2f60ea2Evangelos Lamprou
dev/elm-live.sh+6−1
@@ -4,4 +4,9 @@ set -e
4
4
5cd "$(dirname "$0")/../frontend"
5cd "$(dirname "$0")/../frontend"
6
6
7+if [[ -z $(command -v nix) ]] && [[ -z $(command -v elm-live) ]]; then
8+ echo "Please install either 'nix' or 'elm-live'" && exit 1
9+fi
10+
7−nix run nixpkgs#elmPackages.elm-live -- src/Main.elm --start-page=index.html -- --debug --output=elm.js "$@"
11+command -v nix && nix run nixpkgs#elmPackages.elm-live -- src/Main.elm --start-page=index.html -- --debug --output=elm.js "$@"
12+command -v elm-live && elm-live src/Main.elm --start-page=index.html -- --debug --output=elm.js "$@"
frontend/assets/css/main.css+12
@@ -49,3 +49,15 @@
49 top: 0px;
49 top: 0px;
50 }
50 }
51}
51}
52+
53+.result-link {
54+ color: #000;
55+ text-decoration: none;
56+ font-size: 12px !important;
57+}
58+
59+.result-title {
60+ color: #000;
61+ text-decoration: none;
62+ font-size: 16px;
63+}
frontend/elm.json+5
@@ -7,6 +7,7 @@
7 "elm-version": "0.19.1",
7 "elm-version": "0.19.1",
8 "dependencies": {
8 "dependencies": {
9 "direct": {
9 "direct": {
10+ "Evelios/elm-hash": "1.0.0",
10 "TSFoster/elm-bytes-extra": "1.3.0",
11 "TSFoster/elm-bytes-extra": "1.3.0",
11 "avh4/elm-color": "1.0.0",
12 "avh4/elm-color": "1.0.0",
12 "cmditch/elm-bigint": "2.0.1",
13 "cmditch/elm-bigint": "2.0.1",
@@ -32,6 +33,7 @@
32 "ianmackenzie/elm-units": "2.10.0",
33 "ianmackenzie/elm-units": "2.10.0",
33 "jasonliang-dev/elm-heroicons": "2.0.0",
34 "jasonliang-dev/elm-heroicons": "2.0.0",
34 "jxxcarlson/hex": "4.0.0",
35 "jxxcarlson/hex": "4.0.0",
36+ "marcosh/elm-html-to-unicode": "1.0.4",
35 "mdgriffith/elm-animator": "1.1.1",
37 "mdgriffith/elm-animator": "1.1.1",
36 "mdgriffith/elm-ui": "1.1.8",
38 "mdgriffith/elm-ui": "1.1.8",
37 "rtfeldman/elm-css": "18.0.0",
39 "rtfeldman/elm-css": "18.0.0",
@@ -43,6 +45,8 @@
43 "AdrianRibao/elm-derberos-date": "1.2.3",
45 "AdrianRibao/elm-derberos-date": "1.2.3",
44 "NoRedInk/elm-string-conversions": "1.0.1",
46 "NoRedInk/elm-string-conversions": "1.0.1",
45 "bitsoflogic/elm-radixint": "2.0.0",
47 "bitsoflogic/elm-radixint": "2.0.0",
48+ "bonzaico/murmur3": "1.0.0",
49+ "chain-partners/elm-bignum": "1.0.1",
46 "elm/file": "1.0.5",
50 "elm/file": "1.0.5",
47 "elm/parser": "1.1.0",
51 "elm/parser": "1.1.0",
48 "elm/random": "1.0.0",
52 "elm/random": "1.0.0",
@@ -55,6 +59,7 @@
55 "ianmackenzie/elm-interval": "3.1.0",
59 "ianmackenzie/elm-interval": "3.1.0",
56 "ianmackenzie/elm-units-interval": "3.2.0",
60 "ianmackenzie/elm-units-interval": "3.2.0",
57 "ktonon/elm-word": "2.1.2",
61 "ktonon/elm-word": "2.1.2",
62+ "myrho/elm-round": "1.0.5",
58 "robinheghan/murmur3": "1.0.0"
63 "robinheghan/murmur3": "1.0.0"
59 }
64 }
60 },
65 },
frontend/src/Main.elm+34−7
@@ -31,6 +31,10 @@ import Ur.Jam exposing (isSig)
31import Ur.Run
31import Ur.Run
32import Ur.Sub
32import Ur.Sub
33import Ur.Types exposing (Noun(..))
33import Ur.Types exposing (Noun(..))
34+import Url
35+import ElmEscapeHtml
36+import Json.Encode
37+import Hash
34
38
35url : String
39url : String
36url =
40url =
@@ -188,7 +192,18 @@ aboutView = row [ centerX, padding 10, spacing 10]
188 , subtleLinkView "[Code]" "https://github.com/ilyakooo0/seax"
192 , subtleLinkView "[Code]" "https://github.com/ilyakooo0/seax"
189 ]
193 ]
190
194
191−
195+titleEmoji : String -> String
196+titleEmoji title =
197+ let maxUnicode = 0x1F3F0
198+ minUnicode = 0x1F300
199+ in title |> Hash.fromString
200+ |> Hash.toString
201+ |> String.toInt
202+ |> Maybe.withDefault 0
203+ |> (\x -> ((modBy (maxUnicode - minUnicode) x) + minUnicode))
204+ |> Char.fromCode
205+ |> String.fromChar
206+ |> (\x -> x ++ " ")
192
207
193
208
194view : Model -> Element Msg
209view : Model -> Element Msg
@@ -292,7 +307,7 @@ view model =
292 |> Maybe.map Tuple.first
307 |> Maybe.map Tuple.first
293 |> Maybe.withDefault (Animator.init 0)
308 |> Maybe.withDefault (Animator.init 0)
294 )
309 )
295− (\i -> toFloat i * 47 |> Animator.at)
310+ (\i -> toFloat i * 0 |> Animator.at)
296 |> String.fromFloat
311 |> String.fromFloat
297 )
312 )
298 ++ "px"
313 ++ "px"
@@ -302,14 +317,26 @@ view model =
302 , Html.Attributes.style "padding" "0.5em" |> htmlAttribute
317 , Html.Attributes.style "padding" "0.5em" |> htmlAttribute
303 , Html.Attributes.class "result" |> htmlAttribute
318 , Html.Attributes.class "result" |> htmlAttribute
304 ]
319 ]
305− [ text (stripTags title)
320+ [ (Element.html
306− |> el
321+ (Html.a
307− [ Font.size 16
322+ [ Html.Attributes.href link
323+ , Html.Attributes.class "result-title"
324+ , Html.Attributes.target "_blank"
308 ]
325 ]
326+ [ Html.text
327+ (Maybe.withDefault ""
328+ (Url.percentDecode
329+ (ElmEscapeHtml.unescape
330+ (stripTags
331+ ((titleEmoji title) ++ title)
332+ ))))
333+ ]
334+ )
335+ )
309 , text link
336 , text link
310 |> el
337 |> el
311− [ Font.size 12
312− , Font.color (rgb 0.7 0.7 0.7)
338+ [ Font.color (rgb 0.7 0.7 0.7)
339+ , Html.Attributes.class "result-link" |> htmlAttribute
313 ]
340 ]
314 ]
341 ]
315 )
342 )