-
-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implemented StarSearch share prompt #3324
base: beta
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for oss-insights ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for design-insights ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Thought this was the issue 😓 , but sharing my context. |
I've pushed changes to use the share dropdown @bdougie, but I think we could still run the risk of the prompt URL being too many characters for Twitter, but this should be an easy fix by either hashing it or using dub.co URLs. |
743c707
to
d4f5006
Compare
This is ready for initial review @nickytonline @isabensusan Screen.Recording.2024-05-30.at.10.49.31.AM.movNotes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the placement of the share icon and the logic to only take the first item in the chat session. Screen.Recording.2024-05-31.at.2.41.49.PM.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great @brandonroberts! One thing I wonder is for Twitter/X, we should truncate the prompt if it doesn't fit in a standard Tweet message length.
Also, a shorter URL would be great to increase the text count in a Tweet, but I imagine that unfurling potentially prevents an OG image from appearing?
Yea, we could truncate the prompt, or not include it as it will be in the OG image. The short URL shouldn't prevent the OG image from appearing |
Good point that it's in the OG image so no need for it in the Tweet. Sounds good with that tweak and the short URL. |
@nickytonline The prompt text has been removed from the social media text in favor of the OG image |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brandonroberts, it works great on Desktop, but on iPhone at least, the menu share menu opens, but clicking any of the menu items, like share to X do nothing. It looks like Safari/iOS (and any other browsers on iPhone) block window.open in an async call.
There's some solutions in https://stackoverflow.com/questions/20696041/window-openurl-blank-not-working-on-imac-safari that should work.
pages/star-search/index.tsx
Outdated
@@ -535,6 +576,65 @@ Need some ideas? Try hitting the **Need Inspiration?** button below!`; | |||
<span className="sr-only">Thumbs down</span> | |||
<ThumbsdownIcon size={16} /> | |||
</button> | |||
{prompt && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor (blocking): add some spacing between the thumbs down icon and the share icon to prevent users from accidentally clicking thumbs down instead of share.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pages/star-search/index.tsx
Outdated
} | ||
} | ||
|
||
function openWindow(url: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arrrgh, looks like that suggestion from StackOverflow doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh interesting, I tried it in Safari and Chrome and it worked for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm on Safari Version 16.6 (18615.3.12.11.2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works fine on Safari Desktop (I'm on 17.5), it's the iOS version that doesn't work. On iOS 17, it's Safari 17.3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, ok 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think one of the other solutions might work. There was one suggesting _top
for the window target. Maybe give that a go.
I tried this logged out and it fills the prompt input, but I'm not prompted to log in and can still run the prompt. CleanShot.2024-06-03.at.11.59.13.mp4 |
That's intended behavior for a shared prompt, otherwise we have to connect and redirect them back just to see the results that someone else already shared. Not sure if we should gate it if its shared |
For that particular prompt I guess not, but what if they do another prompt? |
Not sure, but I'd lean towards letting them enter more prompts to start. |
@nickytonline will you try it again with iOS Safari and see if the window opens now? |
Argh. Still no dice. If you have an Android phone, I can dig into this if you want. |
5fe7a42
to
6fefa5c
Compare
…rompt submitted automatically
…cannot create one
cb52412
to
3acbd33
Compare
5865c7e
to
576d3d7
Compare
ca135b1
to
3271bf2
Compare
twitterParams.set("url", shortUrl); | ||
twitterUrl += `?${twitterParams.toString()}`; | ||
openWindow(twitterUrl); | ||
href={twitterShareUrl} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made these actual links so that we don't run into iOS and other browser security restrictions.
} | ||
|
||
const Card: React.FC<CardProps> = ({ className, children, heading }) => { | ||
const Card = ({ className, children, heading, focusable = false }: CardProps) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't make it focusable by default because I wasn't sure if that's necessary or not.
|
607ac4a
to
7a1eebd
Compare
7a1eebd
to
a670dd6
Compare
Description
Now you can share StarSearch prompts. Note that some accessibility issues were also fixed while writing end to end tests for this feature.
Related Tickets & Documents
Closes #3325
Fixes #3478
Mobile & Desktop Screenshots/Recordings
Steps to QA
Tier (staff will fill in)
[optional] What gif best describes this PR or how it makes you feel?