Add some style and validation.

while here add some automation
This commit is contained in:
Aaron Bieber 2023-05-24 20:58:59 -06:00
parent a24c411c9a
commit beaf1ac0f3
No known key found for this signature in database
4 changed files with 2936 additions and 446 deletions

17
Makefile Normal file
View File

@ -0,0 +1,17 @@
build: elm append fix clean
elm: src/Main.elm
elm make --optimize src/Main.elm
append:
sed -i '/<!DOCTYPE HTML>/,$$d' pr-status.pl
cat index.html >> pr-status.pl
fix:
sed -i 's/<title>Main/<title>pr-status/' pr-status.pl
clean:
rm -f index.html

View File

@ -10,14 +10,17 @@
"elm/core": "1.0.5",
"elm/html": "1.0.0",
"elm/http": "2.0.0",
"elm/json": "1.1.3"
"elm/json": "1.1.3",
"rtfeldman/elm-css": "18.0.0"
},
"indirect": {
"elm/bytes": "1.0.8",
"elm/file": "1.0.5",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.3"
"elm/virtual-dom": "1.0.3",
"robinheghan/murmur3": "1.0.0",
"rtfeldman/elm-hex": "1.0.0"
}
},
"test-dependencies": {

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,12 @@
module Main exposing (..)
import Browser
import Html exposing (..)
import Html.Attributes exposing (href, placeholder, style)
import Html.Events exposing (onClick, onInput)
import Css exposing (alignItems, center, display, padding, pct, px, width)
import Html.Styled exposing (..)
import Html.Styled.Attributes exposing (css, disabled, href, placeholder, style)
import Html.Styled.Events exposing (onClick, onInput)
import Http
import Json.Decode as Decode exposing (Decoder, field, int, list, map5, map6, string)
import Json.Decode as Decode exposing (Decoder, field, int, list, map5, string)
type Status
@ -37,7 +38,7 @@ main : Program () Model Msg
main =
Browser.element
{ init = init
, view = view
, view = view >> toUnstyled
, update = update
, subscriptions = \_ -> Sub.none
}
@ -87,14 +88,36 @@ init _ =
view : Model -> Html Msg
view model =
div []
[ div []
[ input [ placeholder "search...", onInput SetPR ] []
, button [ onClick RunSearch ] [ text "Search" ]
div
[ css
[ padding (px 30)
, width (pct 100)
]
, div []
[ viewResult model ]
]
[ div []
[ div []
[ input [ placeholder "search...", onInput SetPR ] []
, button
[ onClick RunSearch
, disabled (viewValidation model)
]
[ text "Search" ]
]
, div []
[ viewResult model
]
]
]
viewValidation : Model -> Bool
viewValidation model =
case model.pull_request of
0 ->
True
_ ->
False
viewResult : Model -> Html Msg
@ -108,7 +131,8 @@ viewResult data =
prStr =
String.fromInt data.pull_request
in
table []
table
[]
[ tr []
[ td [] [ b [] [ text "Title:" ] ]
, td []