Skip to content
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

Open
wants to merge 20 commits into
base: beta
Choose a base branch
from

Conversation

nickytonline
Copy link
Member

@nickytonline nickytonline commented May 6, 2024

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

CleanShot 2024-05-06 at 21 13 21

Steps to QA

Tier (staff will fill in)

  • Tier 1
  • Tier 2
  • Tier 3
  • Tier 4

[optional] What gif best describes this PR or how it makes you feel?

Copy link

netlify bot commented May 6, 2024

Deploy Preview for oss-insights ready!

Name Link
🔨 Latest commit cc7d86e
🔍 Latest deploy log https://app.netlify.com/sites/oss-insights/deploys/6661ae696f55c30007a30be8
😎 Deploy Preview https://deploy-preview-3324--oss-insights.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented May 6, 2024

Deploy Preview for design-insights ready!

Name Link
🔨 Latest commit cc7d86e
🔍 Latest deploy log https://app.netlify.com/sites/design-insights/deploys/6661ae696c71ab00082ae2e1
😎 Deploy Preview https://deploy-preview-3324--design-insights.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@bdougie
Copy link
Member

bdougie commented May 6, 2024

I'd love to see us reuse elements from other places.

Gemini uses a share icon.

Screenshot 2024-05-06 at 4 50 30 PM

OpenSauced Highlights already have a share experience with the 3 dots.

Screenshot 2024-05-06 at 4 51 17 PM

I'd love to avoid adding more design debt with whatever solution we approach.

@bdougie
Copy link
Member

bdougie commented May 6, 2024

Thought this was the issue 😓 , but sharing my context.

@nickytonline
Copy link
Member Author

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.

@isabensusan
Copy link
Member

Loving the exploration!! The UI is looking a bit too busy, I'll do a quick design for just icons to simplify

image

@isabensusan
Copy link
Member

isabensusan commented May 28, 2024

@nickytonline

Icon

import { HiOutlineShare } from "react-icons/hi";
<HiOutlineShare />
image

@brandonroberts brandonroberts force-pushed the nickytonline/star-search-share branch from 743c707 to d4f5006 Compare May 30, 2024 15:02
@brandonroberts
Copy link
Contributor

brandonroberts commented May 30, 2024

This is ready for initial review @nickytonline @isabensusan

Screen.Recording.2024-05-30.at.10.49.31.AM.mov

Notes:

  • The Prompt URL will be shortened
  • If they aren't logged in, it doesn't auto-submit the prompt, but also doesn't force login
  • I can open a new PR if needed

@brandonroberts brandonroberts marked this pull request as ready for review May 30, 2024 15:51
Copy link
Member Author

@nickytonline nickytonline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The share menu works but it seems put of place. Beside the two thumbs up with some gap would probably look better and only show it once the prompt response is completed.

CleanShot 2024-05-31 at 11 53 29

@brandonroberts
Copy link
Contributor

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

Copy link
Member Author

@nickytonline nickytonline left a 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?

@brandonroberts
Copy link
Contributor

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

@nickytonline
Copy link
Member Author

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.

@brandonroberts
Copy link
Contributor

@nickytonline The prompt text has been removed from the social media text in favor of the OG image

Copy link
Member Author

@nickytonline nickytonline left a 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.

@@ -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 && (
Copy link
Member Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, added some padding

image

}
}

function openWindow(url: string) {
Copy link
Member Author

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.

Copy link
Contributor

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

Copy link
Contributor

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)

Copy link
Member Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, ok 👀

Copy link
Member Author

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.

@nickytonline
Copy link
Member Author

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

@brandonroberts
Copy link
Contributor

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

@nickytonline
Copy link
Member Author

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?

@brandonroberts
Copy link
Contributor

Not sure, but I'd lean towards letting them enter more prompts to start.

@brandonroberts
Copy link
Contributor

@nickytonline will you try it again with iOS Safari and see if the window opens now?

@nickytonline
Copy link
Member Author

nickytonline commented Jun 3, 2024

@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.

@nickytonline nickytonline force-pushed the nickytonline/star-search-share branch 4 times, most recently from 5fe7a42 to 6fefa5c Compare June 4, 2024 21:02
@nickytonline nickytonline force-pushed the nickytonline/star-search-share branch from cb52412 to 3acbd33 Compare June 4, 2024 22:41
@nickytonline nickytonline force-pushed the nickytonline/star-search-share branch from 5865c7e to 576d3d7 Compare June 5, 2024 03:11
@nickytonline nickytonline force-pushed the nickytonline/star-search-share branch from ca135b1 to 3271bf2 Compare June 5, 2024 11:50
twitterParams.set("url", shortUrl);
twitterUrl += `?${twitterParams.toString()}`;
openWindow(twitterUrl);
href={twitterShareUrl}
Copy link
Member Author

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) => {
Copy link
Member Author

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.

e2e/star-search.spec.ts Outdated Show resolved Hide resolved
@nickytonline nickytonline requested a review from a team June 5, 2024 12:36
@nickytonline
Copy link
Member Author

nickytonline commented Jun 5, 2024

Just looking at some flaky tests fixed!

  4 flaky
    [chromium] › star-search.spec.ts:4:5 › StarSearch (Logged Out Experience) ──────────────────────
    [firefox] › star-search.spec.ts:4:5 › StarSearch (Logged Out Experience) ───────────────────────
    [webkit] › star-search.spec.ts:4:5 › StarSearch (Logged Out Experience) ────────────────────────
    [webkit] › star-search.spec.ts:90:5 › StarSearch shared prompt ─────────────────────────────────
  44 passed (1.4m)

@nickytonline nickytonline force-pushed the nickytonline/star-search-share branch from 607ac4a to 7a1eebd Compare June 6, 2024 02:31
@nickytonline nickytonline force-pushed the nickytonline/star-search-share branch from 7a1eebd to a670dd6 Compare June 6, 2024 02:53
@nickytonline nickytonline requested a review from BekahHW June 6, 2024 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: StarSearch is removing the user input and overwriting it feat: Shareable StarSearch prompts
5 participants