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

Merged
merged 24 commits into from
Jun 6, 2024

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

StarSearch.Share.Prompt.mp4

Steps to QA

Share a Prompt

  1. Log in to StarSearch
  2. Choose a canned prompt or write your own.
  3. When the response is finished, notice the share menu at the bottom right of the last response.
  4. Click on it to show share to Twitter, LinkedIn and copy link.
  5. Try those out.
  6. Copy the shared prompt link

Try the shared prompt

Logged In User

  1. Paste the shared prompt link in the browser from the steps before.
  2. The prompt and response load even though you're logged out.
  3. Try another prompt once the response is completed.
  4. Nologin modal appears and the streaming response comes in.

Logged Out User

  1. Paste the shared prompt link in the browser from the steps before.
  2. The prompt and response load even though you're logged out.
  3. Try another prompt once the response is completed.
  4. A login modal appears and you are forced to log in to continue prompting.

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 f04e435
🔍 Latest deploy log https://app.netlify.com/sites/oss-insights/deploys/6661f73620b9fe0008d4c6e4
😎 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 f04e435
🔍 Latest deploy log https://app.netlify.com/sites/design-insights/deploys/6661f736d0d43500083a5453
😎 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.

@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 requested a review from BekahHW June 6, 2024 12:43
@BekahHW
Copy link
Member

BekahHW commented Jun 6, 2024

@nickytonline it won't even let me type a prompt rn. I can use one of the suggested prompts though.

Screen.Recording.2024-06-06.at.8.56.16.AM.mov

@BekahHW
Copy link
Member

BekahHW commented Jun 6, 2024

Is this what we intend the tweet to look like? It doesn't really give the viewer information about what the prompt was unless you're looking at the url.

I couldn't get the preview to generate for LI.

image

Copy link
Member

@BekahHW BekahHW left a comment

Choose a reason for hiding this comment

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

There are some things I'm not clear on, and I've left a couple of comments. Noteably, it's not allowing me to use it when logged in and the LI share isn't working.

@nickytonline
Copy link
Member Author

There are some things I'm not clear on, and I've left a couple of comments. Noteably, it's not allowing me to use it when logged in and the LI share isn't working.

I'm in the process of fixing the logged in experience. The check wasn't right. That fix will be up shortly.

I'll look at the LinkedIn (LI) share issue. For the LI share issue, does it not open LinkedIn for you? This was working previously.

@nickytonline
Copy link
Member Author

nickytonline commented Jun 6, 2024

Is this what we intend the tweet to look like? It doesn't really give the viewer information about what the prompt was unless you're looking at the url.

I couldn't get the preview to generate for LI.

image

That isn't loading the correct OG image. It should be the shared prompt one. 🤔 The copy looks fine though. Open to suggestions for better copy.

I'll look into the OG image issue as that wasn't an issue before.

@BekahHW
Copy link
Member

BekahHW commented Jun 6, 2024

Is this what we intend the tweet to look like? It doesn't really give the viewer information about what the prompt was unless you're looking at the url.
I couldn't get the preview to generate for LI.
![image](https://private-user-images.githubusercontent.com/34313413/337274207-

That isn't loading the correct OG image. It should be the shared prompt one. 🤔 The copy looks fine though. Open to suggestions for better copy.

If it's loading the correct OG image with the prompt, the copy is totally fine.

@BekahHW
Copy link
Member

BekahHW commented Jun 6, 2024

This is what I get for LI

image

Seems like it's taking too long to load.

@nickytonline
Copy link
Member Author

nickytonline commented Jun 6, 2024

This is what I get for LI

image Seems like it's taking too long to load.

Gotcha. So it is working in that it's doing what it's supposed to, just not loading the OG image. That could be because it's the dev environment in the deploy preview. I'll take a peek.

@nickytonline
Copy link
Member Author

The logged in experience and logged out experience should be fine now. I fixed the one time only prompt for a guest @BekahHW.

@BekahHW
Copy link
Member

BekahHW commented Jun 6, 2024

This is the full screenshot from LI

image

@nickytonline
Copy link
Member Author

nickytonline commented Jun 6, 2024

For the OG image, I think it's Twitter caching it from the deployment preview before we had the shared prompt OG image.

This is what I get when I share it on Twitter from the deploy preview. Same result as you.

CleanShot 2024-06-06 at 10 32 54

But if I go to share it on Slack OR Discord, it's all good.

CleanShot 2024-06-06 at 10 38 46

CleanShot 2024-06-06 at 10 43 40@2x

I think once this in beta it'll work properly, but Twitter caches aggressively so not sure how long it will take to start appearing correctly on Twitter.

@nickytonline
Copy link
Member Author

nickytonline commented Jun 6, 2024

I'm still investigating why the URL isn't shortened via https://github.com/open-sauced/app/pull/3324/files#diff-4e4544e2a158050d1656e7d4abaa1d7652c416028e87eb88f570db12ac922b21R241 . Is it because it's a deployment preview @brandonroberts?

  useEffect(() => {
    if (!promptMessage) {
      return;
    }

    const promptUrl = getSharedPromptUrl(promptMessage);
    let twitterUrl = "https://twitter.com/intent/tweet";
    let linkedinUrl = "https://www.linkedin.com/sharing/share-offsite/";
    const twitterParams = new URLSearchParams();
    const linkedinParams = new URLSearchParams();

    setTimeout(async () => {
      const shortUrl = await shortenUrl(`${promptUrl}`);

      twitterParams.set("text", `Here's my StarSearch prompt!\n\nTry it out for yourself. #StarSearch`);
      twitterParams.set("url", shortUrl);
      twitterUrl += `?${twitterParams.toString()}`;
      setTwitterShareUrl(twitterUrl);

      linkedinParams.set("url", shortUrl);
      linkedinUrl += `?${linkedinParams.toString()}`;
      setLinkedInShareUrl(linkedinUrl);
    }, 0);
  }, [promptMessage]);

@brandonroberts
Copy link
Contributor

@nickytonline I don't think so. It could that our Dub dev account is at its limit on the free tier. Let me delete some of those links and let's try it again

@brandonroberts
Copy link
Contributor

@nickytonline I cleared out all the non-essential links so it shouldn't return an error at least from the API side.

@nickytonline
Copy link
Member Author

nickytonline commented Jun 6, 2024

@nickytonline I cleared out all the non-essential links so it shouldn't return an error at least from the API side.

Looks like that fixed it. Thanks!

image

Looks like the URL shortener fixes OG images as well @BekahHW!

@BekahHW
Copy link
Member

BekahHW commented Jun 6, 2024

It definitely gets cut off on LI. If it's working though, I don't think it's worth blocking. We can create another issue to fix it.

image

@nickytonline
Copy link
Member Author

It definitely gets cut off on LI. If it's working though, I don't think it's worth blocking. We can create another issue to fix it.

image

This is how LinkedIn previews it sometimes. If you post it, it will be fine.

@nickytonline nickytonline merged commit c7ce190 into beta Jun 6, 2024
25 checks passed
@nickytonline nickytonline deleted the nickytonline/star-search-share branch June 6, 2024 18:34
open-sauced bot pushed a commit that referenced this pull request Jun 6, 2024
## [2.34.0-beta.1](v2.33.1-beta.1...v2.34.0-beta.1) (2024-06-06)

### 🍕 Features

* implemented StarSearch share prompt ([#3324](#3324)) ([c7ce190](c7ce190))
open-sauced bot pushed a commit that referenced this pull request Jun 6, 2024
## [2.34.0](v2.33.0...v2.34.0) (2024-06-06)

### 🐛 Bug Fixes

* now long words break so they fit in the StarSearch Share Prompt OG image ([#3532](#3532)) ([d752399](d752399))
* set `/star-search` user avatar after logging in ([#3531](#3531)) ([71b54b7](71b54b7))
* update user redirects to exclude notifications, settings, and card paths ([#3525](#3525)) ([efc893e](efc893e))

### 🍕 Features

* enforce upgrades on workspaces that exceed usage ([#3511](#3511)) ([d98d4b1](d98d4b1))
* implemented StarSearch share prompt ([#3324](#3324)) ([c7ce190](c7ce190))
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
6 participants