1port module Sink exposing (main)
3import BigInt exposing (BigInt)
4import Browser exposing (Document)
5import Element exposing (..)
6import Element.Border as Border
7import Heroicons.Outline
8import Json.Decode as JD
13import Ur.Constructor as C
14import Ur.Deconstructor as D
18import Widget.Icon as Icon
19import Widget.Material as Material
24 "http://localhost:8080"
27main : Ur.Run.Program Model Msg
38 [ Ur.logIn url "lidlut-tabwed-pillex-ridrup"
39 |> Cmd.map (result (Debug.toString >> Error) (always Noop))
40 , Ur.getShipName url |> Cmd.map (result (always Noop) GotShipName)
46 , subscriptions = always Sub.none
47 , createEventSource = createEventSource
48 , urbitSubscriptions =
58 D.list (D.cell D.bigint D.cord)
65 , onEventSourceMsg = onEventSourceMessage
66 , onUrlChange = \_ -> Noop
67 , onUrlRequest = \_ -> Noop
68 , urbitUrl = \_ -> url
74 , entries : Maybe (List ( BigInt, String ))
76 , shipName : Maybe String
83 | GotListings (List ( BigInt, String ))
84 | UpdateNewEntry String
87 | RunCmd (Ur.Cmd.Cmd Msg)
91update : Msg -> Model -> ( Model, Ur.Cmd.Cmd Msg )
95 ( model, Ur.Cmd.none )
98 ( { model | error = err }, Ur.Cmd.none )
100 GotListings entries ->
101 ( { model | entries = Just entries }, Ur.Cmd.none )
103 UpdateNewEntry txt ->
104 ( { model | newEntry = txt }, Ur.Cmd.none )
111 , mark = "journal-action"
112 , noun = C.cell (C.cord "del") (C.bigint id)
117 ( { model | newEntry = "" }
124 , mark = "journal-action"
125 , noun = C.cell (C.cord "add") (C.cell (time |> Time.posixToMillis |> BigInt.fromInt |> C.bigint) (C.cord txt))
136 ( { model | shipName = Just name }, Ur.Cmd.none )
139view : Model -> Document Msg
143 ([ el [ alignTop ] (text model.error)
145 [ Widget.textInput (Material.textInput Material.defaultPalette)
147 , text = model.newEntry
148 , placeholder = Nothing
149 , label = "New entry"
150 , onChange = UpdateNewEntry
152 , Widget.iconButton (Material.containedButton Material.defaultPalette)
154 , icon = Icon.elmHeroicons Heroicons.Outline.check
155 , onPress = AddEntry model.newEntry |> Just
159 |> Maybe.withDefault []
164 , Border.shadow { offset = ( 0, 5 ), size = 1, blur = 10, color = rgba 0 0 0 0.3 }
169 [ paragraph [] [ text txt ]
170 , Widget.iconButton (Material.containedButton Material.defaultPalette)
172 , icon = Icon.elmHeroicons Heroicons.Outline.trash
173 , onPress = DeleteEntry id |> Just
177 |> column [ spacing 10, centerX ]
179 |> column [ spacing 18, centerX ]
186result : (a -> c) -> (b -> c) -> Result a b -> c
196port createEventSource : String -> Cmd msg
199port onEventSourceMessage : (JD.Value -> msg) -> Sub msg
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list