diff --git a/src/Applications/UI.elm b/src/Applications/UI.elm index 1b278382..625e07a7 100644 --- a/src/Applications/UI.elm +++ b/src/Applications/UI.elm @@ -37,6 +37,7 @@ import Task import Time import Tracks.Encoding import UI.Authentication as Authentication +import UI.Authentication.ContextMenu import UI.Backdrop as Backdrop import UI.Console import UI.ContextMenu @@ -213,6 +214,13 @@ update msg model = Core.ExternalAuth _ _ -> R2.withNoCmd model + Core.ShowMoreAuthenticationOptions coordinates -> + coordinates + |> UI.Authentication.ContextMenu.moreOptionsMenu + |> Just + |> (\c -> { model | contextMenu = c }) + |> R2.withNoCmd + ----------------------------------------- -- Brain ----------------------------------------- @@ -588,6 +596,9 @@ translateReply reply = Reply.ShowErrorNotification string -> ShowNotification (Notifications.stickyError string) + Reply.ShowMoreAuthenticationOptions coordinates -> + Core.ShowMoreAuthenticationOptions coordinates + Reply.ShowSuccessNotification string -> ShowNotification (Notifications.success string) @@ -911,6 +922,7 @@ globalCss = -- Bits & Pieces ----------------------------------------- , Css.Global.selector ".lh-0" [ Css.lineHeight Css.zero ] + , Css.Global.selector ".pointer-events-none" [ Css.pointerEvents Css.none ] ] diff --git a/src/Applications/UI/Authentication.elm b/src/Applications/UI/Authentication.elm index 56e6de79..4b501ecf 100644 --- a/src/Applications/UI/Authentication.elm +++ b/src/Applications/UI/Authentication.elm @@ -4,18 +4,22 @@ import Alien import Authentication exposing (Method(..)) import Base64 import Chunky exposing (..) +import Classes as C import Color exposing (Color) import Color.Ext as Color import Common exposing (Switch(..)) import Conditional exposing (..) +import Coordinates import Crypto.Hash import Css exposing (pct, px, solid, transparent) +import Html.Events.Extra.Mouse as Mouse import Html.Styled as Html exposing (Html, a, button, div, em, fromUnstyled, img, span, text) -import Html.Styled.Attributes exposing (attribute, css, href, placeholder, src, style, type_, value, width) +import Html.Styled.Attributes as Attributes exposing (attribute, css, href, placeholder, src, style, title, type_, value, width) import Html.Styled.Events exposing (onClick, onSubmit) import Json.Decode as Json import Json.Encode import Material.Icons.Av as Icons +import Material.Icons.Navigation as Icons import Replying exposing (R3D3, andThen3) import Return2 as R2 import Return3 as R3 @@ -105,6 +109,7 @@ extractMethod model = type Msg = Bypass | Cancel + | ShowMoreOptions Mouse.Event | SignIn Method | SignInWithPassphrase Method String | SignedIn Method @@ -146,6 +151,22 @@ update msg model = Unauthenticated -> R3.withNothing Unauthenticated + ShowMoreOptions mouseEvent -> + ( model + , Cmd.none + , ( mouseEvent.clientPos + , mouseEvent.offsetPos + ) + |> (\( ( a, b ), ( c, d ) ) -> + { x = a - c + 15 + , y = b - d + 12 + } + ) + |> ShowMoreAuthenticationOptions + |> List.singleton + |> Just + ) + SignIn method -> ( Unauthenticated -- @@ -392,13 +413,6 @@ choicesScreen = , label = "Blockstack" , outOfOrder = True } - , choiceButton - { action = ShowNewEncryptionKeyScreen Authentication.Ipfs - , icon = \_ _ -> Svg.map never UI.Svg.Elements.ipfsLogo - , isLast = False - , label = "IPFS" - , outOfOrder = False - } , choiceButton { action = AskForInput @@ -413,11 +427,27 @@ choicesScreen = } , choiceButton { action = Bypass - , icon = \_ _ -> Svg.map never UI.Svg.Elements.solidLogo - , isLast = True - , label = "Solid" + , icon = \_ _ -> Svg.map never UI.Svg.Elements.textileLogo + , isLast = False + , label = "Textile" , outOfOrder = True } + + -- More options + --------------- + , chunk + [ T.pb1, T.pt3, T.tc ] + [ slab + Html.span + [ title "More options" + , Attributes.fromUnstyled (Mouse.onClick ShowMoreOptions) + ] + [ T.dib, T.ph1, T.pointer, C.lh_0 ] + [ chunk + [ C.pointer_events_none ] + [ fromUnstyled (Icons.more_horiz UI.Kit.colors.text 22) ] + ] + ] ] diff --git a/src/Applications/UI/Authentication/ContextMenu.elm b/src/Applications/UI/Authentication/ContextMenu.elm new file mode 100644 index 00000000..fb87b5b0 --- /dev/null +++ b/src/Applications/UI/Authentication/ContextMenu.elm @@ -0,0 +1,29 @@ +module UI.Authentication.ContextMenu exposing (moreOptionsMenu) + +import Authentication +import ContextMenu exposing (..) +import Coordinates exposing (Coordinates) +import Material.Icons.Action as Icons +import Svg +import UI.Authentication as Authentication +import UI.Core exposing (Msg(..)) +import UI.Svg.Elements + + + +-- 🔱 + + +moreOptionsMenu : Coordinates -> ContextMenu Msg +moreOptionsMenu = + ContextMenu + [ ( \_ _ -> Svg.map never UI.Svg.Elements.ipfsLogo + , "IPFS" + , AuthenticationMsg (Authentication.ShowNewEncryptionKeyScreen Authentication.Ipfs) + ) + + -- , ( \_ _ -> Svg.map never UI.Svg.Elements.solidLogo + -- , "Solid" + -- , AuthenticationMsg (Authentication.ShowNewEncryptionKeyScreen Authentication.Ipfs) + -- ) + ] diff --git a/src/Applications/UI/Core.elm b/src/Applications/UI/Core.elm index 6df64d97..fdb50f8d 100644 --- a/src/Applications/UI/Core.elm +++ b/src/Applications/UI/Core.elm @@ -98,6 +98,7 @@ type Msg -- Authentication ----------------------------------------- | ExternalAuth Authentication.Method String + | ShowMoreAuthenticationOptions Coordinates ----------------------------------------- -- Brain ----------------------------------------- diff --git a/src/Applications/UI/Reply.elm b/src/Applications/UI/Reply.elm index 03c6b03c..e8d107a3 100644 --- a/src/Applications/UI/Reply.elm +++ b/src/Applications/UI/Reply.elm @@ -35,6 +35,7 @@ type Reply | SaveSources | SaveTracks | ShowErrorNotification String + | ShowMoreAuthenticationOptions Coordinates | ShowSuccessNotification String | ShowWarningNotification String | ShowTracksContextMenu Coordinates (List IdentifiedTrack) diff --git a/src/Applications/UI/Svg/Elements.elm b/src/Applications/UI/Svg/Elements.elm index 77f11bb3..bbf4e611 100644 --- a/src/Applications/UI/Svg/Elements.elm +++ b/src/Applications/UI/Svg/Elements.elm @@ -1,4 +1,4 @@ -module UI.Svg.Elements exposing (blockstackLogo, ipfsLogo, loading, remoteStorageLogo, solidLogo) +module UI.Svg.Elements exposing (blockstackLogo, ipfsLogo, loading, remoteStorageLogo, solidLogo, textileLogo) import Color import Svg exposing (..) @@ -161,3 +161,47 @@ loading = ] [] ] + + + +-- TEXTILE + + +textileLogo : Svg Never +textileLogo = + svg + [ fill (Color.toCssString UI.Kit.colors.text) + , height "16" + , viewBox "0 0 4030 4050" + , width "16" + ] + [ g + [ fillOpacity "1", stroke "none" ] + [ Svg.path [ d "M305 3150 l-280 -280 288 0 287 0 0 280 c0 154 -3 280 -8 280 -4 0 -133 -126 -287 -280z" ] [] + , Svg.path [ d "M1160 3150 l0 -280 282 0 283 0 -280 280 c-154 154 -281 280 -282 280 -2 0 -3 -126 -3 -280z" ] [] + , Svg.path [ d "M2575 2580 l-280 -280 283 0 282 0 0 280 c0 154 -1 280 -3 280 -1 0 -128 -126 -282 -280z" ] [] + , Svg.path [ d "M1155 1735 l-570 -564 573 -1 572 0 0 565 c0 311 -1 565 -2 565 -2 -1 -259 -255 -573 -565z" ] [] + , Svg.path [ d "M2575 1460 l280 -280 -280 -2 -280 -3 -3 -282 c-1 -156 1 -283 5 -283 5 0 133 125 286 278 l277 277 0 288 0 287 -282 0 -283 0 280 -280z" ] [] + ] + , g + [ fillOpacity "0.5", stroke "none" ] + [ Svg.path [ d "M870 3715 l-285 -285 575 0 575 0 -285 285 c-157 157 -287 285 -290 285 -3 0 -133 -128 -290 -285z" ] [] + , Svg.path [ d "M30 2862 c0 -6 373 -380 923 -922 l207 -205 0 568 0 567 -565 0 c-311 0 -565 -3 -565 -8z" ] [] + , Svg.path [ d "M2007 2582 l-277 -277 0 -568 0 -567 148 0 c81 0 333 3 560 7 l414 6 -276 276 -276 276 0 563 c0 309 -3 562 -8 562 -4 0 -132 -125 -285 -278z" ] [] + , Svg.path [ d "M2860 1733 l0 -568 565 565 c311 311 565 566 565 567 0 2 -254 3 -565 3 l-565 0 0 -567z" ] [] + , Svg.path [ d "M1443 323 l287 -288 287 288 288 287 -575 0 -575 0 288 -287z" ] [] + ] + , g + [ fillOpacity "1", stroke "none" ] + [ Svg.path [ d "M2860 2865 l0 -565 565 0 c311 0 565 3 565 8 0 9 -1113 1122 -1123 1122 -4 0 -7 -254 -7 -565z" ] [] + , Svg.path [ d "M1160 2310 c0 -308 3 -560 8 -560 4 0 259 252 567 560 l560 560 -568 0 -567 0 0 -560z" ] [] + , Svg.path [ d "M1440 895 c151 -151 278 -275 282 -275 5 0 8 124 8 275 l0 275 -282 0 -283 0 275 -275z" ] [] + ] + , g + [ fillOpacity "0.75", stroke "none" ] + [ Svg.path [ d "M2576 3161 l-279 -280 -281 274 -281 274 -285 1 -285 0 280 -280 280 -280 285 -2 285 -3 5 -278 5 -277 277 277 278 278 2 288 c2 158 1 287 -2 287 -3 0 -131 -126 -284 -279z" ] [] + , Svg.path [ d "M600 3150 l0 -280 280 0 280 0 0 280 0 280 -280 0 -280 0 0 -280z" ] [] + , Svg.path [ d "M2300 2020 l0 -280 280 0 280 0 0 280 0 280 -280 0 -280 0 0 -280z" ] [] + , Svg.path [ d "M875 890 l280 -280 567 0 568 0 0 280 0 280 -280 0 -280 0 0 -275 c0 -151 -3 -275 -8 -275 -4 0 -131 124 -282 275 l-275 275 -285 0 -285 0 280 -280z" ] [] + ] + ] diff --git a/src/Library/Classes.elm b/src/Library/Classes.elm index 71bc5db7..04eb020f 100644 --- a/src/Library/Classes.elm +++ b/src/Library/Classes.elm @@ -1,4 +1,4 @@ -module Classes exposing (lh_0) +module Classes exposing (lh_0, pointer_events_none) {-| Some class names used for global css. @@ -10,3 +10,8 @@ This is an extension of Tachyons. lh_0 : String lh_0 = "lh-0" + + +pointer_events_none : String +pointer_events_none = + "pointer-events-none" diff --git a/src/Library/Coordinates.elm b/src/Library/Coordinates.elm index 58957725..34f5812b 100644 --- a/src/Library/Coordinates.elm +++ b/src/Library/Coordinates.elm @@ -1,7 +1,18 @@ -module Coordinates exposing (Coordinates) +module Coordinates exposing (Coordinates, fromTuple) -- 🌳 type alias Coordinates = { x : Float, y : Float } + + + +-- 🔱 + + +fromTuple : ( Float, Float ) -> Coordinates +fromTuple ( x, y ) = + { x = x + , y = y + }