Compare commits

...

15 Commits

Author SHA1 Message Date
Evangelos Lamprou
2f60ea2cb4
Merge pull request #14 from vagos/frontend-imprs
Frontend improvements
2023-10-23 19:30:19 +02:00
Evangelos Lamprou
dd5f5bc03a
Merge branch 'master' into frontend-imprs 2023-10-23 19:03:31 +02:00
Evangelos Lamprou
c4c46fe729 Result links now open in page 2023-10-23 18:46:49 +02:00
Evangelos Lamprou
b69ee0d7de Add fun emoji icons
- TODO: Replace in the feature with website favicon
2023-10-23 18:46:49 +02:00
Evangelos Lamprou
711dede3aa Unescape some html sequences and improve links 2023-10-23 18:46:49 +02:00
Evangelos Lamprou
43fab35ea5 Add necessary includes (#13)
poke the agent using: :seax ~[%get-notes]
2023-10-23 18:46:49 +02:00
Evangelos Lamprou
1e49ae3391 Added about on main page and enter to search.
- Can now initiate search by pressing enter
- About page in main screen
2023-10-23 18:46:49 +02:00
Evangelos Lamprou
f0b7e4f1c7 Sorted imports 2023-10-23 18:46:49 +02:00
Evangelos Lamprou
0d8873ef9b Removed unused css 2023-10-23 18:46:49 +02:00
Evangelos Lamprou
fff3e6e32e Visual imporvements on search page
- Added [Code] and [About] links at the botoom of the page
- Added error message for empty search results
2023-10-23 18:46:49 +02:00
Evangelos Lamprou
29854aff7b Restore font typefaces 2023-10-23 18:46:49 +02:00
Evangelos Lamprou
3e70e77ea8 Added get-notes poke
- Can now put posts from the ship's groups into the agent's state
  (notes.state)
- Changed poke arguments
- Added necessary files from %groups
2023-10-23 18:46:49 +02:00
Evangelos Lamprou
9abc4882fb Dev script now supports non-nix systems 2023-10-23 18:46:49 +02:00
Evangelos Lamprou
13363fd8bc
Merge pull request #11 from vagos/doc-search
Add urbit dev docs search source
2023-10-23 18:06:49 +02:00
Evangelos Lamprou
cae52014b9 Add urbit dev docs search source 2023-10-22 02:18:13 +02:00
6 changed files with 88 additions and 9 deletions

View File

@ -4,4 +4,9 @@ set -e
cd "$(dirname "$0")/../frontend"
nix run nixpkgs#elmPackages.elm-live -- src/Main.elm --start-page=index.html -- --debug --output=elm.js "$@"
if [[ -z $(command -v nix) ]] && [[ -z $(command -v elm-live) ]]; then
echo "Please install either 'nix' or 'elm-live'" && exit 1
fi
command -v nix && nix run nixpkgs#elmPackages.elm-live -- src/Main.elm --start-page=index.html -- --debug --output=elm.js "$@"
command -v elm-live && elm-live src/Main.elm --start-page=index.html -- --debug --output=elm.js "$@"

View File

@ -49,3 +49,15 @@
top: 0px;
}
}
.result-link {
color: #000;
text-decoration: none;
font-size: 12px !important;
}
.result-title {
color: #000;
text-decoration: none;
font-size: 16px;
}

View File

@ -7,6 +7,7 @@
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"Evelios/elm-hash": "1.0.0",
"TSFoster/elm-bytes-extra": "1.3.0",
"avh4/elm-color": "1.0.0",
"cmditch/elm-bigint": "2.0.1",
@ -32,6 +33,7 @@
"ianmackenzie/elm-units": "2.10.0",
"jasonliang-dev/elm-heroicons": "2.0.0",
"jxxcarlson/hex": "4.0.0",
"marcosh/elm-html-to-unicode": "1.0.4",
"mdgriffith/elm-animator": "1.1.1",
"mdgriffith/elm-ui": "1.1.8",
"rtfeldman/elm-css": "18.0.0",
@ -43,6 +45,8 @@
"AdrianRibao/elm-derberos-date": "1.2.3",
"NoRedInk/elm-string-conversions": "1.0.1",
"bitsoflogic/elm-radixint": "2.0.0",
"bonzaico/murmur3": "1.0.0",
"chain-partners/elm-bignum": "1.0.1",
"elm/file": "1.0.5",
"elm/parser": "1.1.0",
"elm/random": "1.0.0",
@ -55,6 +59,7 @@
"ianmackenzie/elm-interval": "3.1.0",
"ianmackenzie/elm-units-interval": "3.2.0",
"ktonon/elm-word": "2.1.2",
"myrho/elm-round": "1.0.5",
"robinheghan/murmur3": "1.0.0"
}
},

View File

@ -31,6 +31,10 @@ import Ur.Jam exposing (isSig)
import Ur.Run
import Ur.Sub
import Ur.Types exposing (Noun(..))
import Url
import ElmEscapeHtml
import Json.Encode
import Hash
url : String
url =
@ -188,7 +192,18 @@ aboutView = row [ centerX, padding 10, spacing 10]
, subtleLinkView "[Code]" "https://github.com/ilyakooo0/seax"
]
titleEmoji : String -> String
titleEmoji title =
let maxUnicode = 0x1F3F0
minUnicode = 0x1F300
in title |> Hash.fromString
|> Hash.toString
|> String.toInt
|> Maybe.withDefault 0
|> (\x -> ((modBy (maxUnicode - minUnicode) x) + minUnicode))
|> Char.fromCode
|> String.fromChar
|> (\x -> x ++ " ")
view : Model -> Element Msg
@ -292,7 +307,7 @@ view model =
|> Maybe.map Tuple.first
|> Maybe.withDefault (Animator.init 0)
)
(\i -> toFloat i * 47 |> Animator.at)
(\i -> toFloat i * 0 |> Animator.at)
|> String.fromFloat
)
++ "px"
@ -302,14 +317,26 @@ view model =
, Html.Attributes.style "padding" "0.5em" |> htmlAttribute
, Html.Attributes.class "result" |> htmlAttribute
]
[ text (stripTags title)
|> el
[ Font.size 16
[ (Element.html
(Html.a
[ Html.Attributes.href link
, Html.Attributes.class "result-title"
, Html.Attributes.target "_blank"
]
[ Html.text
(Maybe.withDefault ""
(Url.percentDecode
(ElmEscapeHtml.unescape
(stripTags
((titleEmoji title) ++ title)
))))
]
)
)
, text link
|> el
[ Font.size 12
, Font.color (rgb 0.7 0.7 0.7)
[ Font.color (rgb 0.7 0.7 0.7)
, Html.Attributes.class "result-link" |> htmlAttribute
]
]
)

View File

@ -1,5 +1,5 @@
/- *seax
/+ engines-yep, engines-crowdview, engines-wiby, engines-alexandria
/+ engines-yep, engines-crowdview, engines-wiby, engines-alexandria, engines-urbit-dev
^- engines
@ -10,5 +10,6 @@
[name=%crowdview engine=engines-crowdview weight=.2]
[name=%wiby engine=engines-wiby weight=.2]
[name=%alexandria engine=engines-alexandria weight=.2]
[name=%urbit-dev engine=engines-urbit-dev weight=.2]
==

View File

@ -0,0 +1,29 @@
/- *seax
^- engine
=<
|%
++ url
|= query=tape
^- tape
%+ weld
"https://urbit.org/api/dev-search?q="
(en-urlt:html query)
++ results
|= response=mime-data:iris
^- (unit (list search-result))
=/ body q.data.response
;< jon=json _biff (de:json:html body)
(apex jon)
--
::
|%
++ apex
=, dejs-soft:format
%- ot
~[glossary+(ar parse-search-result)]
++ parse-search-result
=, dejs-soft:format
%- ot
~[[%'name' so] [%'url' so]]
--