feat: clarify ambiguous ux

This commit is contained in:
Ananth Venkatesh 2025-02-13 00:11:07 -05:00
parent c3c0a908a2
commit c8c799572f
Signed by: ananthv
GPG key ID: 4BB578E748CFE4FF
3 changed files with 21 additions and 14 deletions

View file

@ -1,4 +1,4 @@
port module Clipboard exposing (copyToClipboard) port module Clipboard exposing (copyToClipboard)
port copyToClipboard : String -> Cmd msg port copyToClipboard : ( String, String ) -> Cmd msg

View file

@ -97,7 +97,7 @@ type Msg
| GotMesh (Result Http.Error Object3d) | GotMesh (Result Http.Error Object3d)
| GotTexture (Result WebGL.Texture.Error (Material.Texture Color.Color)) | GotTexture (Result WebGL.Texture.Error (Material.Texture Color.Color))
| Rotate Time.Posix | Rotate Time.Posix
| Copy String | Copy String String
| Key String | Key String
| Scroll String | Scroll String
@ -150,8 +150,8 @@ update msg model =
Rotate time -> Rotate time ->
wrap { model | angle = canonicalize (model.angle + 2 * (2 + sin (toFloat (Time.posixToMillis time) / 1000))) } wrap { model | angle = canonicalize (model.angle + 2 * (2 + sin (toFloat (Time.posixToMillis time) / 1000))) }
Copy text -> Copy label text ->
( model, copyToClipboard text ) ( model, copyToClipboard ( label, text ) )
Key key -> Key key ->
( { model | last = key }, Cmd.none ) ( { model | last = key }, Cmd.none )
@ -359,16 +359,20 @@ view model =
++ heading ++ heading
) )
(column (column
[ spacing 20 [ spacing 35
] ]
[ text "MacGregor House" [ text "MacGregor House"
, row , column [ spacing 15 ]
[ spacing 20 [ row
[ spacing 15
] ]
[ linkBtn "See events" "https://calendar.google.com/calendar/embed?src=c_c9fb13003264d5becb74cf9ba42a087d8a4a180d927441994458a07ac146eb88%40group.calendar.google.com&ctz=America%2FNew_York"
, linkBtn "Reserve space" "https://forms.gle/KxFAG65TQuPxdYak8"
]
, row [ spacing 15 ]
[ btn "" (Scroll "one") [ btn "" (Scroll "one")
, linkBtn "Events" "https://calendar.google.com/calendar/embed?src=c_c9fb13003264d5becb74cf9ba42a087d8a4a180d927441994458a07ac146eb88%40group.calendar.google.com&ctz=America%2FNew_York" , btn "Copy iCal link" (Copy "iCal link" "https://calendar.google.com/calendar/ical/c_c9fb13003264d5becb74cf9ba42a087d8a4a180d927441994458a07ac146eb88%40group.calendar.google.com/public/basic.ics")
, linkBtn "Space" "https://forms.gle/KxFAG65TQuPxdYak8" ]
, btn "iCal" (Copy "https://calendar.google.com/calendar/ical/c_c9fb13003264d5becb74cf9ba42a087d8a4a180d927441994458a07ac146eb88%40group.calendar.google.com/public/basic.ics")
] ]
] ]
) )

View file

@ -19,13 +19,16 @@
flags: [window.innerWidth, window.innerHeight], flags: [window.innerWidth, window.innerHeight],
}); });
app.ports.copyToClipboard.subscribe((text) => { app.ports.copyToClipboard.subscribe((tuple) => {
var textArea = document.createElement("textarea"); let label = tuple[0];
let text = tuple[1];
let textArea = document.createElement("textarea");
textArea.value = text; textArea.value = text;
document.body.appendChild(textArea); document.body.appendChild(textArea);
textArea.select(); textArea.select();
document.execCommand("copy"); document.execCommand("copy");
document.body.removeChild(textArea); document.body.removeChild(textArea);
alert(`Copied ${label} to clipboard`);
}); });
app.ports.scrollTo.subscribe((id) => { app.ports.scrollTo.subscribe((id) => {