update to purescript v14, upgrade halogen to v6
This commit is contained in:
parent
a0b7c3c782
commit
3e7102e2d8
2381
purs/package-lock.json
generated
2381
purs/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -9,12 +9,12 @@
|
||||||
"parcel-build": "parcel build dist/bundle.js --out-file dist/app.min.js --public-url /static/js/"
|
"parcel-build": "parcel build dist/bundle.js --out-file dist/app.min.js --public-url /static/js/"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"marked": "^2.0.0",
|
"marked": "^2.0.7",
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"parcel-bundler": "^1.12.4",
|
"parcel-bundler": "^1.12.5",
|
||||||
"purescript": "^0.13.8",
|
"purescript": "^0.14.2",
|
||||||
"spago": "^0.19.1",
|
"spago": "^0.20.3",
|
||||||
"terser": "^5.6.0"
|
"terser": "^5.7.0"
|
||||||
},
|
},
|
||||||
"dependencies": {}
|
"dependencies": {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,6 @@ in upstream
|
||||||
}
|
}
|
||||||
-}
|
-}
|
||||||
let upstream =
|
let upstream =
|
||||||
https://raw.githubusercontent.com/purescript/package-sets/psc-0.13.8-20210118/src/packages.dhall sha256:a59c5c93a68d5d066f3815a89f398bcf00e130a51cb185b2da29b20e2d8ae115
|
https://raw.githubusercontent.com/purescript/package-sets/psc-0.14.1-20210516/src/packages.dhall sha256:f5e978371d4cdc4b916add9011021509c8d869f4c3f6d0d2694c0e03a85046c8
|
||||||
|
|
||||||
in upstream
|
in upstream
|
||||||
|
|
|
@ -1,26 +1,40 @@
|
||||||
{ sources =
|
{ sources = [ "src/**/*.purs", "test/**/*.purs" ]
|
||||||
[ "src/**/*.purs", "test/**/*.purs" ]
|
, name = "espial"
|
||||||
, name =
|
|
||||||
"espial"
|
|
||||||
, dependencies =
|
, dependencies =
|
||||||
[ "aff"
|
[ "aff"
|
||||||
, "simple-json"
|
, "affjax"
|
||||||
, "affjax"
|
, "argonaut"
|
||||||
, "argonaut"
|
, "arrays"
|
||||||
, "arrays"
|
, "console"
|
||||||
, "console"
|
, "const"
|
||||||
, "debug"
|
, "effect"
|
||||||
, "effect"
|
, "either"
|
||||||
, "either"
|
, "foldable-traversable"
|
||||||
, "functions"
|
, "foreign"
|
||||||
, "halogen"
|
, "foreign-object"
|
||||||
, "prelude"
|
, "form-urlencoded"
|
||||||
, "psci-support"
|
, "functions"
|
||||||
, "strings"
|
, "halogen"
|
||||||
, "transformers"
|
, "http-methods"
|
||||||
, "web-html"
|
, "integers"
|
||||||
, "profunctor-lenses"
|
, "js-uri"
|
||||||
]
|
, "math"
|
||||||
, packages =
|
, "maybe"
|
||||||
./packages.dhall
|
, "media-types"
|
||||||
|
, "newtype"
|
||||||
|
, "nullable"
|
||||||
|
, "partial"
|
||||||
|
, "prelude"
|
||||||
|
, "profunctor-lenses"
|
||||||
|
, "psci-support"
|
||||||
|
, "simple-json"
|
||||||
|
, "strings"
|
||||||
|
, "transformers"
|
||||||
|
, "tuples"
|
||||||
|
, "web-dom"
|
||||||
|
, "web-events"
|
||||||
|
, "web-html"
|
||||||
|
, "web-xhr"
|
||||||
|
]
|
||||||
|
, packages = ./packages.dhall
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ data EditField
|
||||||
|
|
||||||
|
|
||||||
-- | The bookmark component definition.
|
-- | The bookmark component definition.
|
||||||
usetting :: forall q i o. AccountSettings -> H.Component HTML q i o Aff
|
usetting :: forall q i o. AccountSettings -> H.Component q i o Aff
|
||||||
usetting u' =
|
usetting u' =
|
||||||
H.mkComponent
|
H.mkComponent
|
||||||
{ initialState: const (mkState u')
|
{ initialState: const (mkState u')
|
||||||
|
@ -72,8 +72,8 @@ usetting u' =
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
editField :: forall a. (a -> EditField) -> a -> Maybe UAction
|
editField :: forall a. (a -> EditField) -> a -> UAction
|
||||||
editField f = Just <<< UEditField <<< f
|
editField f = UEditField <<< f
|
||||||
|
|
||||||
handleAction :: UAction -> H.HalogenM UState UAction () o Aff Unit
|
handleAction :: UAction -> H.HalogenM UState UAction () o Aff Unit
|
||||||
handleAction (UEditField f) = do
|
handleAction (UEditField f) = do
|
||||||
|
|
|
@ -54,7 +54,7 @@ _bm = lens _.bm (_ { bm = _ })
|
||||||
_edit_bm :: Lens' BState Bookmark
|
_edit_bm :: Lens' BState Bookmark
|
||||||
_edit_bm = lens _.edit_bm (_ { edit_bm = _ })
|
_edit_bm = lens _.edit_bm (_ { edit_bm = _ })
|
||||||
|
|
||||||
addbmark :: forall q i o. Bookmark -> H.Component HTML q i o Aff
|
addbmark :: forall q i o. Bookmark -> H.Component q i o Aff
|
||||||
addbmark b' =
|
addbmark b' =
|
||||||
H.mkComponent
|
H.mkComponent
|
||||||
{ initialState: const (mkState b')
|
{ initialState: const (mkState b')
|
||||||
|
@ -79,7 +79,7 @@ addbmark b' =
|
||||||
display_destroyed
|
display_destroyed
|
||||||
where
|
where
|
||||||
display_edit _ =
|
display_edit _ =
|
||||||
form [ onSubmit (Just <<< BEditSubmit) ]
|
form [ onSubmit BEditSubmit ]
|
||||||
[ table [ class_ "w-100" ]
|
[ table [ class_ "w-100" ]
|
||||||
[ tbody_
|
[ tbody_
|
||||||
[ tr_
|
[ tr_
|
||||||
|
@ -97,7 +97,7 @@ addbmark b' =
|
||||||
[ td_ [ label [ for "title" ] [ text "title" ] ]
|
[ td_ [ label [ for "title" ] [ text "title" ] ]
|
||||||
, td [class_ "flex"]
|
, td [class_ "flex"]
|
||||||
[ input [ type_ InputText , id_ "title", class_ "w-100 mv1 flex-auto" , name "title" , value (edit_bm.title) , onValueChange (editField Etitle)]
|
[ input [ type_ InputText , id_ "title", class_ "w-100 mv1 flex-auto" , name "title" , value (edit_bm.title) , onValueChange (editField Etitle)]
|
||||||
, button [ disabled s.loading, type_ ButtonButton, onClick \_ -> Just BLookupTitle, class_ ("ml2 input-reset ba b--navy pointer f6 di dim pa1 ma1 mr0 " <> guard s.loading "bg-light-silver") ] [ text "fetch" ]
|
, button [ disabled s.loading, type_ ButtonButton, onClick \_ -> BLookupTitle, class_ ("ml2 input-reset ba b--navy pointer f6 di dim pa1 ma1 mr0 " <> guard s.loading "bg-light-silver") ] [ text "fetch" ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
, tr_
|
, tr_
|
||||||
|
@ -136,10 +136,10 @@ addbmark b' =
|
||||||
[ text (maybe " " fst mmoment) ]
|
[ text (maybe " " fst mmoment) ]
|
||||||
, div [ class_ "edit_links dib ml1" ]
|
, div [ class_ "edit_links dib ml1" ]
|
||||||
[ div [ class_ "delete_link di" ]
|
[ div [ class_ "delete_link di" ]
|
||||||
[ button ([ type_ ButtonButton, onClick \_ -> Just (BDeleteAsk true), class_ "delete" ] <> guard s.deleteAsk [ attr "hidden" "hidden" ]) [ text "delete" ]
|
[ button ([ type_ ButtonButton, onClick \_ -> BDeleteAsk true, class_ "delete" ] <> guard s.deleteAsk [ attr "hidden" "hidden" ]) [ text "delete" ]
|
||||||
, span ([ class_ "confirm red" ] <> guard (not s.deleteAsk) [ attr "hidden" "hidden" ])
|
, span ([ class_ "confirm red" ] <> guard (not s.deleteAsk) [ attr "hidden" "hidden" ])
|
||||||
[ button [ type_ ButtonButton, onClick \_ -> Just (BDeleteAsk false)] [ text "cancel / " ]
|
[ button [ type_ ButtonButton, onClick \_ -> BDeleteAsk false] [ text "cancel / " ]
|
||||||
, button [ type_ ButtonButton, onClick \_ -> Just BDestroy, class_ "red" ] [ text "destroy" ]
|
, button [ type_ ButtonButton, onClick \_ -> BDestroy, class_ "red" ] [ text "destroy" ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
@ -147,8 +147,8 @@ addbmark b' =
|
||||||
|
|
||||||
display_destroyed _ = p [ class_ "red"] [text "you killed this bookmark"]
|
display_destroyed _ = p [ class_ "red"] [text "you killed this bookmark"]
|
||||||
|
|
||||||
editField :: forall a. (a -> EditField) -> a -> Maybe BAction
|
editField :: forall a. (a -> EditField) -> a -> BAction
|
||||||
editField f = Just <<< BEditField <<< f
|
editField f = BEditField <<< f
|
||||||
mmoment = mmoment8601 bm.time
|
mmoment = mmoment8601 bm.time
|
||||||
toTextarea =
|
toTextarea =
|
||||||
drop 1
|
drop 1
|
||||||
|
|
|
@ -10,7 +10,7 @@ import Data.Maybe (Maybe(..))
|
||||||
import Effect.Aff (Aff)
|
import Effect.Aff (Aff)
|
||||||
import Halogen as H
|
import Halogen as H
|
||||||
import Halogen.HTML as HH
|
import Halogen.HTML as HH
|
||||||
import Data.Symbol (SProxy(..))
|
import Type.Proxy (Proxy(..))
|
||||||
|
|
||||||
data LAction =
|
data LAction =
|
||||||
HandleBMessage BookmarkId BMessage
|
HandleBMessage BookmarkId BMessage
|
||||||
|
@ -19,9 +19,9 @@ type ChildSlots =
|
||||||
( bookmark :: BSlot Int
|
( bookmark :: BSlot Int
|
||||||
)
|
)
|
||||||
|
|
||||||
_bookmark = SProxy :: SProxy "bookmark"
|
_bookmark = Proxy :: Proxy "bookmark"
|
||||||
|
|
||||||
blist :: forall q i o. Array Bookmark -> H.Component HH.HTML q i o Aff
|
blist :: forall q i o. Array Bookmark -> H.Component q i o Aff
|
||||||
blist st =
|
blist st =
|
||||||
H.mkComponent
|
H.mkComponent
|
||||||
{ initialState: const st
|
{ initialState: const st
|
||||||
|
@ -32,7 +32,7 @@ blist st =
|
||||||
|
|
||||||
render :: Array Bookmark -> H.ComponentHTML LAction ChildSlots Aff
|
render :: Array Bookmark -> H.ComponentHTML LAction ChildSlots Aff
|
||||||
render bms =
|
render bms =
|
||||||
HH.div_ $ map (\b -> HH.slot _bookmark b.bid (bmark b) unit (Just <<< HandleBMessage b.bid)) bms
|
HH.div_ $ map (\b -> HH.slot _bookmark b.bid (bmark b) unit (HandleBMessage b.bid)) bms
|
||||||
|
|
||||||
handleAction :: LAction -> H.HalogenM (Array Bookmark) LAction ChildSlots o Aff Unit
|
handleAction :: LAction -> H.HalogenM (Array Bookmark) LAction ChildSlots o Aff Unit
|
||||||
handleAction (HandleBMessage bid BNotifyRemove) = do
|
handleAction (HandleBMessage bid BNotifyRemove) = do
|
||||||
|
|
|
@ -11,7 +11,7 @@ import Data.Monoid (guard)
|
||||||
import Data.Nullable (toMaybe)
|
import Data.Nullable (toMaybe)
|
||||||
import Data.String (null, split, take, replaceAll) as S
|
import Data.String (null, split, take, replaceAll) as S
|
||||||
import Data.String.Pattern (Pattern(..), Replacement(..))
|
import Data.String.Pattern (Pattern(..), Replacement(..))
|
||||||
import Data.Symbol (SProxy(..))
|
import Type.Proxy (Proxy(..))
|
||||||
import Effect.Aff (Aff)
|
import Effect.Aff (Aff)
|
||||||
import Globals (app', setFocus, toLocaleDateString)
|
import Globals (app', setFocus, toLocaleDateString)
|
||||||
import Halogen as H
|
import Halogen as H
|
||||||
|
@ -66,13 +66,13 @@ _edit_bm = lens _.edit_bm (_ { edit_bm = _ })
|
||||||
_edit :: Lens' BState Boolean
|
_edit :: Lens' BState Boolean
|
||||||
_edit = lens _.edit (_ { edit = _ })
|
_edit = lens _.edit (_ { edit = _ })
|
||||||
|
|
||||||
_markdown = SProxy :: SProxy "markdown"
|
_markdown = Proxy :: Proxy "markdown"
|
||||||
|
|
||||||
type ChildSlots =
|
type ChildSlots =
|
||||||
( markdown :: Markdown.Slot Unit
|
( markdown :: Markdown.Slot Unit
|
||||||
)
|
)
|
||||||
|
|
||||||
bmark :: forall q i. Bookmark -> H.Component HTML q i BMessage Aff
|
bmark :: forall q i. Bookmark -> H.Component q i BMessage Aff
|
||||||
bmark b' =
|
bmark b' =
|
||||||
H.mkComponent
|
H.mkComponent
|
||||||
{ initialState: const (mkState b')
|
{ initialState: const (mkState b')
|
||||||
|
@ -104,7 +104,7 @@ bmark b' =
|
||||||
|
|
||||||
star _ =
|
star _ =
|
||||||
div [ class_ ("star fl pointer" <> guard bm.selected " selected") ]
|
div [ class_ ("star fl pointer" <> guard bm.selected " selected") ]
|
||||||
[ button [ class_ "moon-gray", onClick \_ -> Just (BStar (not bm.selected)) ] [ text "✭" ] ]
|
[ button [ class_ "moon-gray", onClick \_ -> BStar (not bm.selected) ] [ text "✭" ] ]
|
||||||
|
|
||||||
display _ =
|
display _ =
|
||||||
div [ class_ "display" ] $
|
div [ class_ "display" ] $
|
||||||
|
@ -131,12 +131,12 @@ bmark b' =
|
||||||
-- links
|
-- links
|
||||||
, whenH app.dat.isowner $ \_ ->
|
, whenH app.dat.isowner $ \_ ->
|
||||||
div [ class_ "edit_links di" ]
|
div [ class_ "edit_links di" ]
|
||||||
[ button [ type_ ButtonButton, onClick \_ -> Just (BEdit true), class_ "edit light-silver hover-blue" ] [ text "edit " ]
|
[ button [ type_ ButtonButton, onClick \_ -> BEdit true, class_ "edit light-silver hover-blue" ] [ text "edit " ]
|
||||||
, div [ class_ "delete_link di" ]
|
, div [ class_ "delete_link di" ]
|
||||||
[ button [ type_ ButtonButton, onClick \_ -> Just (BDeleteAsk true), class_ ("delete light-silver hover-blue" <> guard s.deleteAsk " dn") ] [ text "delete" ]
|
[ button [ type_ ButtonButton, onClick \_ -> BDeleteAsk true, class_ ("delete light-silver hover-blue" <> guard s.deleteAsk " dn") ] [ text "delete" ]
|
||||||
, span ([ class_ ("confirm red" <> guard (not s.deleteAsk) " dn") ] )
|
, span ([ class_ ("confirm red" <> guard (not s.deleteAsk) " dn") ] )
|
||||||
[ button [ type_ ButtonButton, onClick \_ -> Just (BDeleteAsk false)] [ text "cancel / " ]
|
[ button [ type_ ButtonButton, onClick \_ -> BDeleteAsk false] [ text "cancel / " ]
|
||||||
, button [ type_ ButtonButton, onClick \_ -> Just BDestroy, class_ "red" ] [ text "destroy" ]
|
, button [ type_ ButtonButton, onClick \_ -> BDestroy, class_ "red" ] [ text "destroy" ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
@ -144,14 +144,14 @@ bmark b' =
|
||||||
div [ class_ "read di" ] $
|
div [ class_ "read di" ] $
|
||||||
guard bm.toread
|
guard bm.toread
|
||||||
[ text " "
|
[ text " "
|
||||||
, button [ onClick \_ -> Just BMarkRead, class_ "mark_read" ] [ text "mark as read"]
|
, button [ onClick \_ -> BMarkRead, class_ "mark_read" ] [ text "mark as read"]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
display_edit _ =
|
display_edit _ =
|
||||||
div [ class_ "edit_bookmark_form pa2 pt0 bg-white" ] $
|
div [ class_ "edit_bookmark_form pa2 pt0 bg-white" ] $
|
||||||
[ form [ onSubmit (Just <<< BEditSubmit) ]
|
[ form [ onSubmit BEditSubmit ]
|
||||||
[ div_ [ text "url" ]
|
[ div_ [ text "url" ]
|
||||||
, input [ type_ InputUrl , class_ "url w-100 mb2 pt1 edit_form_input" , required true , name "url"
|
, input [ type_ InputUrl , class_ "url w-100 mb2 pt1 edit_form_input" , required true , name "url"
|
||||||
, value (edit_bm.url) , onValueChange (editField Eurl) ]
|
, value (edit_bm.url) , onValueChange (editField Eurl) ]
|
||||||
|
@ -159,7 +159,7 @@ bmark b' =
|
||||||
, div [class_ "flex"]
|
, div [class_ "flex"]
|
||||||
[input [ type_ InputText , class_ "title w-100 mb2 pt1 edit_form_input" , name "title"
|
[input [ type_ InputText , class_ "title w-100 mb2 pt1 edit_form_input" , name "title"
|
||||||
, value (edit_bm.title) , onValueChange (editField Etitle) ]
|
, value (edit_bm.title) , onValueChange (editField Etitle) ]
|
||||||
, button [ disabled s.loading, type_ ButtonButton, onClick \_ -> Just BLookupTitle, class_ ("ml1 pa1 mb2 dark-gray ba b--moon-gray bg-near-white pointer rdim f7 " <> guard s.loading "bg-light-silver") ] [ text "fetch" ]
|
, button [ disabled s.loading, type_ ButtonButton, onClick \_ -> BLookupTitle, class_ ("ml1 pa1 mb2 dark-gray ba b--moon-gray bg-near-white pointer rdim f7 " <> guard s.loading "bg-light-silver") ] [ text "fetch" ]
|
||||||
]
|
]
|
||||||
, div_ [ text "description" ]
|
, div_ [ text "description" ]
|
||||||
, textarea [ class_ "description w-100 mb1 pt1 edit_form_input" , name "description", rows 5
|
, textarea [ class_ "description w-100 mb1 pt1 edit_form_input" , name "description", rows 5
|
||||||
|
@ -184,13 +184,13 @@ bmark b' =
|
||||||
, input [ type_ InputSubmit , class_ "mr1 pv1 ph2 dark-gray ba b--moon-gray bg-near-white pointer rdim" , value "save" ]
|
, input [ type_ InputSubmit , class_ "mr1 pv1 ph2 dark-gray ba b--moon-gray bg-near-white pointer rdim" , value "save" ]
|
||||||
, text " "
|
, text " "
|
||||||
, input [ type_ InputReset , class_ "pv1 ph2 dark-gray ba b--moon-gray bg-near-white pointer rdim" , value "cancel"
|
, input [ type_ InputReset , class_ "pv1 ph2 dark-gray ba b--moon-gray bg-near-white pointer rdim" , value "cancel"
|
||||||
, onClick \_ -> Just (BEdit false) ]
|
, onClick \_ -> BEdit false ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
editField :: forall a. (a -> EditField) -> a -> Maybe BAction
|
editField :: forall a. (a -> EditField) -> a -> BAction
|
||||||
editField f = Just <<< BEditField <<< f
|
editField f = BEditField <<< f
|
||||||
linkToFilterSingle slug = fromNullableStr app.userR <> "/b:" <> slug
|
linkToFilterSingle slug = fromNullableStr app.userR <> "/b:" <> slug
|
||||||
linkToFilterTag tag = fromNullableStr app.userR <> "/t:" <> tag
|
linkToFilterTag tag = fromNullableStr app.userR <> "/t:" <> tag
|
||||||
shdate = toLocaleDateString bm.time
|
shdate = toLocaleDateString bm.time
|
||||||
|
|
|
@ -10,5 +10,5 @@ import Prelude (Void)
|
||||||
|
|
||||||
type Slot = H.Slot (Const Void) Void
|
type Slot = H.Slot (Const Void) Void
|
||||||
|
|
||||||
component :: forall q o. H.Component HH.HTML q String o Aff
|
component :: forall q o. H.Component q String o Aff
|
||||||
component = RH.mkComponent marked
|
component = RH.mkComponent marked
|
||||||
|
|
|
@ -27,7 +27,7 @@ type NLState =
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nlist :: forall q i o. Array Note -> H.Component HH.HTML q i o Aff
|
nlist :: forall q i o. Array Note -> H.Component q i o Aff
|
||||||
nlist st' =
|
nlist st' =
|
||||||
H.mkComponent
|
H.mkComponent
|
||||||
{ initialState: const (mkState st')
|
{ initialState: const (mkState st')
|
||||||
|
|
|
@ -12,7 +12,7 @@ import Data.Monoid (guard)
|
||||||
import Data.String (null)
|
import Data.String (null)
|
||||||
import Data.String (null, split) as S
|
import Data.String (null, split) as S
|
||||||
import Data.String.Pattern (Pattern(..))
|
import Data.String.Pattern (Pattern(..))
|
||||||
import Data.Symbol (SProxy(..))
|
import Type.Proxy (Proxy(..))
|
||||||
import Data.Tuple (fst, snd)
|
import Data.Tuple (fst, snd)
|
||||||
import Effect.Aff (Aff)
|
import Effect.Aff (Aff)
|
||||||
import Effect.Class (liftEffect)
|
import Effect.Class (liftEffect)
|
||||||
|
@ -59,13 +59,13 @@ data EditField
|
||||||
| EisMarkdown Boolean
|
| EisMarkdown Boolean
|
||||||
| Eshared Boolean
|
| Eshared Boolean
|
||||||
|
|
||||||
_markdown = SProxy :: SProxy "markdown"
|
_markdown = Proxy :: Proxy "markdown"
|
||||||
|
|
||||||
type ChildSlots =
|
type ChildSlots =
|
||||||
( markdown :: Markdown.Slot Unit
|
( markdown :: Markdown.Slot Unit
|
||||||
)
|
)
|
||||||
|
|
||||||
nnote :: forall q i o. Note -> H.Component HH.HTML q i o Aff
|
nnote :: forall q i o. Note -> H.Component q i o Aff
|
||||||
nnote st' =
|
nnote st' =
|
||||||
H.mkComponent
|
H.mkComponent
|
||||||
{ initialState: const (mkState st')
|
{ initialState: const (mkState st')
|
||||||
|
@ -111,12 +111,12 @@ nnote st' =
|
||||||
]
|
]
|
||||||
, whenH app.dat.isowner $ \_ ->
|
, whenH app.dat.isowner $ \_ ->
|
||||||
div [ class_ "edit_links db mt3" ]
|
div [ class_ "edit_links db mt3" ]
|
||||||
[ button [ type_ ButtonButton, onClick \_ -> Just (NEdit true), class_ "edit light-silver hover-blue" ] [ text "edit " ]
|
[ button [ type_ ButtonButton, onClick \_ -> NEdit true, class_ "edit light-silver hover-blue" ] [ text "edit " ]
|
||||||
, div [ class_ "delete_link di" ]
|
, div [ class_ "delete_link di" ]
|
||||||
[ button [ type_ ButtonButton, onClick \_ -> Just (NDeleteAsk true), class_ ("delete light-silver hover-blue" <> guard st.deleteAsk " dn") ] [ text "delete" ]
|
[ button [ type_ ButtonButton, onClick \_ -> NDeleteAsk true, class_ ("delete light-silver hover-blue" <> guard st.deleteAsk " dn") ] [ text "delete" ]
|
||||||
, span ([ class_ ("confirm red" <> guard (not st.deleteAsk) " dn") ] )
|
, span ([ class_ ("confirm red" <> guard (not st.deleteAsk) " dn") ] )
|
||||||
[ button [ type_ ButtonButton, onClick \_ -> Just (NDeleteAsk false)] [ text "cancel / " ]
|
[ button [ type_ ButtonButton, onClick \_ -> NDeleteAsk false] [ text "cancel / " ]
|
||||||
, button [ type_ ButtonButton, onClick \_ -> Just NDestroy, class_ "red" ] [ text "destroy" ]
|
, button [ type_ ButtonButton, onClick \_ -> NDestroy, class_ "red" ] [ text "destroy" ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
@ -124,7 +124,7 @@ nnote st' =
|
||||||
]
|
]
|
||||||
|
|
||||||
renderNote_edit _ =
|
renderNote_edit _ =
|
||||||
form [ onSubmit (Just <<< NEditSubmit) ]
|
form [ onSubmit NEditSubmit ]
|
||||||
[ p [ class_ "mt2 mb1"] [ text "title:" ]
|
[ p [ class_ "mt2 mb1"] [ text "title:" ]
|
||||||
, input [ type_ InputText , class_ "title w-100 mb1 pt1 edit_form_input" , name "title"
|
, input [ type_ InputText , class_ "title w-100 mb1 pt1 edit_form_input" , name "title"
|
||||||
, value (edit_note.title) , onValueChange (editField Etitle), autofocus (null edit_note.title)
|
, value (edit_note.title) , onValueChange (editField Etitle), autofocus (null edit_note.title)
|
||||||
|
@ -155,15 +155,15 @@ nnote st' =
|
||||||
, input [ type_ InputReset
|
, input [ type_ InputReset
|
||||||
, class_ "pv1 ph2 dark-gray ba b--moon-gray bg-near-white pointer rdim"
|
, class_ "pv1 ph2 dark-gray ba b--moon-gray bg-near-white pointer rdim"
|
||||||
, value "cancel"
|
, value "cancel"
|
||||||
, onClick \_ -> Just (NEdit false)
|
, onClick \_ -> NEdit false
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
display_destroyed _ = p [ class_ "red"] [text "you killed this note"]
|
display_destroyed _ = p [ class_ "red"] [text "you killed this note"]
|
||||||
|
|
||||||
mmoment n = mmoment8601 n.created
|
mmoment n = mmoment8601 n.created
|
||||||
editField :: forall a. (a -> EditField) -> a -> Maybe NAction
|
editField :: forall a. (a -> EditField) -> a -> NAction
|
||||||
editField f = Just <<< NEditField <<< f
|
editField f = NEditField <<< f
|
||||||
toTextarea input =
|
toTextarea input =
|
||||||
S.split (Pattern "\n") input
|
S.split (Pattern "\n") input
|
||||||
# foldMap (\x -> [br_, text x])
|
# foldMap (\x -> [br_, text x])
|
||||||
|
@ -204,8 +204,7 @@ nnote st' =
|
||||||
H.liftEffect (preventDefault e)
|
H.liftEffect (preventDefault e)
|
||||||
edit_note <- use _edit_note
|
edit_note <- use _edit_note
|
||||||
res' <- H.liftAff (editNote edit_note)
|
res' <- H.liftAff (editNote edit_note)
|
||||||
for_ res' \res -> do
|
for_ res' \_ -> do
|
||||||
let r = res.body
|
|
||||||
if (edit_note.id == 0)
|
if (edit_note.id == 0)
|
||||||
then do
|
then do
|
||||||
liftEffect (setHref (fromNullableStr app.noteR) =<< _loc)
|
liftEffect (setHref (fromNullableStr app.noteR) =<< _loc)
|
||||||
|
|
|
@ -26,10 +26,10 @@ type State i =
|
||||||
, inputval :: Input i
|
, inputval :: Input i
|
||||||
}
|
}
|
||||||
|
|
||||||
component :: forall q o. H.Component HH.HTML q (Input String) o Aff
|
component :: forall q o. H.Component q (Input String) o Aff
|
||||||
component = mkComponent RawHTML
|
component = mkComponent RawHTML
|
||||||
|
|
||||||
mkComponent :: forall q i o. (Input i -> RawHTML) -> H.Component HH.HTML q (Input i) o Aff
|
mkComponent :: forall q i o. (Input i -> RawHTML) -> H.Component q (Input i) o Aff
|
||||||
mkComponent toRawHTML =
|
mkComponent toRawHTML =
|
||||||
H.mkComponent
|
H.mkComponent
|
||||||
{ initialState: \inputval -> { elRef: H.RefLabel "inputval", inputval }
|
{ initialState: \inputval -> { elRef: H.RefLabel "inputval", inputval }
|
||||||
|
|
|
@ -38,7 +38,7 @@ type TState =
|
||||||
_mode :: Lens' TState TagCloudModeF
|
_mode :: Lens' TState TagCloudModeF
|
||||||
_mode = lens _.mode (_ { mode = _ })
|
_mode = lens _.mode (_ { mode = _ })
|
||||||
|
|
||||||
tagcloudcomponent :: forall q i o. TagCloudModeF -> H.Component HTML q i o Aff
|
tagcloudcomponent :: forall q i o. TagCloudModeF -> H.Component q i o Aff
|
||||||
tagcloudcomponent m' =
|
tagcloudcomponent m' =
|
||||||
H.mkComponent
|
H.mkComponent
|
||||||
{ initialState: const (mkState m')
|
{ initialState: const (mkState m')
|
||||||
|
@ -64,42 +64,42 @@ tagcloudcomponent m' =
|
||||||
ifElseA (isRelated mode)
|
ifElseA (isRelated mode)
|
||||||
(\_ -> do --RELATED
|
(\_ -> do --RELATED
|
||||||
[ button [ type_ ButtonButton, class_ ("pa1 f7 link hover-blue mr1 b")
|
[ button [ type_ ButtonButton, class_ ("pa1 f7 link hover-blue mr1 b")
|
||||||
, onClick \_ -> Just (TExpanded (not (isExpanded mode)))
|
, onClick \_ -> TExpanded (not (isExpanded mode))
|
||||||
] [text "Related Tags"]
|
] [text "Related Tags"]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
(\_ -> do -- NOT RELATED
|
(\_ -> do -- NOT RELATED
|
||||||
[ button [ type_ ButtonButton, class_ ("pa1 f7 link hover-blue mr1" <> guard (mode == modetop) " b")
|
[ button [ type_ ButtonButton, class_ ("pa1 f7 link hover-blue mr1" <> guard (mode == modetop) " b")
|
||||||
, title "show a cloud of your most-used tags"
|
, title "show a cloud of your most-used tags"
|
||||||
, onClick \_ -> Just (TChangeMode modetop)
|
, onClick \_ -> TChangeMode modetop
|
||||||
] [text "Top Tags"]
|
] [text "Top Tags"]
|
||||||
, button [ type_ ButtonButton, class_ ("pa1 f7 link hover-blue ml2 " <> guard (mode == modelb1) " b")
|
, button [ type_ ButtonButton, class_ ("pa1 f7 link hover-blue ml2 " <> guard (mode == modelb1) " b")
|
||||||
, title "show all tags"
|
, title "show all tags"
|
||||||
, onClick \_ -> Just (TChangeMode modelb1)
|
, onClick \_ -> TChangeMode modelb1
|
||||||
] [text "all"]
|
] [text "all"]
|
||||||
, text "‧"
|
, text "‧"
|
||||||
, button [ type_ ButtonButton, class_ ("pa1 f7 link hover-blue" <> guard (mode == modelb2) " b")
|
, button [ type_ ButtonButton, class_ ("pa1 f7 link hover-blue" <> guard (mode == modelb2) " b")
|
||||||
, title "show tags with at least 2 bookmarks"
|
, title "show tags with at least 2 bookmarks"
|
||||||
, onClick \_ -> Just (TChangeMode modelb2)
|
, onClick \_ -> TChangeMode modelb2
|
||||||
] [text "2"]
|
] [text "2"]
|
||||||
, text "‧"
|
, text "‧"
|
||||||
, button [ type_ ButtonButton, class_ ("pa1 f7 link hover-blue" <> guard (mode == modelb5) " b")
|
, button [ type_ ButtonButton, class_ ("pa1 f7 link hover-blue" <> guard (mode == modelb5) " b")
|
||||||
, title "show tags with at least 5 bookmarks"
|
, title "show tags with at least 5 bookmarks"
|
||||||
, onClick \_ -> Just (TChangeMode modelb5)
|
, onClick \_ -> TChangeMode modelb5
|
||||||
] [text "5"]
|
] [text "5"]
|
||||||
, text "‧"
|
, text "‧"
|
||||||
, button [ type_ ButtonButton, class_ ("pa1 f7 link hover-blue" <> guard (mode == modelb10) " b")
|
, button [ type_ ButtonButton, class_ ("pa1 f7 link hover-blue" <> guard (mode == modelb10) " b")
|
||||||
, title "show tags with at least 10 bookmarks"
|
, title "show tags with at least 10 bookmarks"
|
||||||
, onClick \_ -> Just (TChangeMode modelb10)
|
, onClick \_ -> TChangeMode modelb10
|
||||||
] [text "10"]
|
] [text "10"]
|
||||||
, text "‧"
|
, text "‧"
|
||||||
, button [ type_ ButtonButton, class_ ("pa1 f7 link hover-blue" <> guard (mode == modelb20) " b")
|
, button [ type_ ButtonButton, class_ ("pa1 f7 link hover-blue" <> guard (mode == modelb20) " b")
|
||||||
, title "show tags with at least 20 bookmarks"
|
, title "show tags with at least 20 bookmarks"
|
||||||
, onClick \_ -> Just (TChangeMode modelb20)
|
, onClick \_ -> TChangeMode modelb20
|
||||||
] [text "20"]
|
] [text "20"]
|
||||||
])
|
])
|
||||||
<> [button [ type_ ButtonButton, class_ "pa1 ml2 f7 link silver hover-blue "
|
<> [button [ type_ ButtonButton, class_ "pa1 ml2 f7 link silver hover-blue "
|
||||||
, onClick \_ -> Just (TExpanded (not (isExpanded mode)))]
|
, onClick \_ -> TExpanded (not (isExpanded mode))]
|
||||||
[ text (if isExpanded mode then "hide" else "show") ]]
|
[ text (if isExpanded mode then "hide" else "show") ]]
|
||||||
, whenH (isExpanded mode) \_ -> do
|
, whenH (isExpanded mode) \_ -> do
|
||||||
let n = fromMaybe 1 (minimum (F.values tagcloud))
|
let n = fromMaybe 1 (minimum (F.values tagcloud))
|
||||||
|
|
|
@ -10,7 +10,6 @@ import Data.Nullable (Nullable, toMaybe)
|
||||||
import Data.String (Pattern(..), Replacement(..), drop, replaceAll, split, take)
|
import Data.String (Pattern(..), Replacement(..), drop, replaceAll, split, take)
|
||||||
import Data.Tuple (Tuple(..), fst, snd)
|
import Data.Tuple (Tuple(..), fst, snd)
|
||||||
import Effect (Effect)
|
import Effect (Effect)
|
||||||
import Global.Unsafe (unsafeDecodeURIComponent)
|
|
||||||
import Halogen (ClassName(..))
|
import Halogen (ClassName(..))
|
||||||
import Halogen.HTML as HH
|
import Halogen.HTML as HH
|
||||||
import Halogen.HTML.Properties as HP
|
import Halogen.HTML.Properties as HP
|
||||||
|
@ -28,6 +27,13 @@ import Web.HTML.HTMLElement (HTMLElement)
|
||||||
import Web.HTML.HTMLElement (fromElement) as HE
|
import Web.HTML.HTMLElement (fromElement) as HE
|
||||||
import Web.HTML.Location (search)
|
import Web.HTML.Location (search)
|
||||||
import Web.HTML.Window (document, location)
|
import Web.HTML.Window (document, location)
|
||||||
|
import JSURI (decodeURIComponent)
|
||||||
|
|
||||||
|
import Partial.Unsafe (unsafePartial)
|
||||||
|
import Data.Maybe (fromJust)
|
||||||
|
|
||||||
|
unsafeDecode :: String -> String
|
||||||
|
unsafeDecode str = unsafePartial $ fromJust $ decodeURIComponent str
|
||||||
|
|
||||||
-- Halogen
|
-- Halogen
|
||||||
|
|
||||||
|
@ -94,7 +100,7 @@ _parseQueryString srh = do
|
||||||
let qs = let srh' = take 1 srh in if (srh' == "#" || srh' == "?") then drop 1 srh else srh
|
let qs = let srh' = take 1 srh in if (srh' == "#" || srh' == "?") then drop 1 srh else srh
|
||||||
mapMaybe go $ (filter (_ /= "") <<< split (Pattern "&")) qs
|
mapMaybe go $ (filter (_ /= "") <<< split (Pattern "&")) qs
|
||||||
where
|
where
|
||||||
decode = unsafeDecodeURIComponent <<< replaceAll (Pattern "+") (Replacement " ")
|
decode = unsafeDecode <<< replaceAll (Pattern "+") (Replacement " ")
|
||||||
go kv =
|
go kv =
|
||||||
case split (Pattern "=") kv of
|
case split (Pattern "=") kv of
|
||||||
[k] -> Just (Tuple (decode k) Nothing)
|
[k] -> Just (Tuple (decode k) Nothing)
|
||||||
|
|
4
static/js/app.min.js
vendored
4
static/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
Reference in a new issue