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: various social image improvements #270

Merged
merged 1 commit into from
Dec 20, 2023
Merged

Conversation

bripkens
Copy link
Member

@bripkens bripkens commented Dec 20, 2023

Why

  • There are some things I noticed after the review that we should clean up.
  • The ability to generate the image server-side is incredible. Folks can actually use this to link to the image from within documentation systems!

What

  • Expose the feature more prominently in the share dialog
  • Clean up the URL paths to make this easier to discover
  • Some cleanup

Screenshots

image

Copy link

vercel bot commented Dec 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
otelbin ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2023 7:44pm

@bripkens bripkens requested a review from roshan-gh December 20, 2023 18:01
@bripkens bripkens self-assigned this Dec 20, 2023
@bripkens bripkens force-pushed the social-image-improvements branch from 9ed1fe6 to 63efa31 Compare December 20, 2023 18:06
@bripkens bripkens force-pushed the social-image-improvements branch from 63efa31 to 9298900 Compare December 20, 2023 18:15
@bripkens bripkens force-pushed the social-image-improvements branch from 9298900 to c7cc550 Compare December 20, 2023 18:22
@bripkens bripkens force-pushed the social-image-improvements branch from c7cc550 to a14efbb Compare December 20, 2023 18:38
@bripkens bripkens force-pushed the social-image-improvements branch from a14efbb to 52e69e2 Compare December 20, 2023 18:43
@bripkens bripkens force-pushed the social-image-improvements branch from 52e69e2 to a63d9c3 Compare December 20, 2023 18:49
@bripkens bripkens force-pushed the social-image-improvements branch from a63d9c3 to db2b453 Compare December 20, 2023 18:52
@bripkens bripkens force-pushed the social-image-improvements branch from db2b453 to 3b0c758 Compare December 20, 2023 19:41
@@ -66,7 +66,7 @@ const Node = ({ data, icon, type }: { data: IData; icon: React.ReactNode; type:
<div style={customNodeStyles} tw="flex-col">
<div
tw={`flex w-full flex-col items-center justify-center px-2 ${
splitLabel[1] && splitLabel[1].length > 0 && "mt-[2px]"
splitLabel[1] && splitLabel[1].length > 0 ? "mt-[2px]" : ""
Copy link
Member Author

Choose a reason for hiding this comment

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

This caused warnings in the logic because of an unknown tailwind utility called undefined

const shortLink = await redis.get<string>(getShortLinkPersistenceKey(params.id));
return NextResponse.redirect(shortLink || "/", {
headers: {
"Cache-Control": "public, max-age=3600, stale-while-revalidate=3600, stale-if-error=3600",
Copy link
Member Author

Choose a reason for hiding this comment

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

This can actually cause issues without the correct Vary response header. Hence caching is removed for this code path.

@@ -55,13 +54,14 @@ export async function POST(request: NextRequest): Promise<NextResponse> {
);
}

const uuid = crypto.randomUUID();
await redis.set(getShortLinkPersistenceKey(uuid), longURL);
const id = crypto.createHash("sha1").update(longURL).digest("hex");
Copy link
Member Author

Choose a reason for hiding this comment

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

This ensures that there are fewer short link permutations for the same data.

# Why
 - There are some things I noticed after the review that we should clean up.
 - The ability to generate the image server-side is incredible. Folks can
   actually use this to link to the image from within documentation systems!

# What
 - Expose the feature more prominently in the share dialog
 - Clean up the URL paths to make this easier to discover
 - Some cleanup
@bripkens bripkens force-pushed the social-image-improvements branch from 3b0c758 to 92c80c0 Compare December 20, 2023 19:43
Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@bripkens bripkens merged commit 5bcae08 into main Dec 20, 2023
7 checks passed
@bripkens bripkens deleted the social-image-improvements branch December 20, 2023 19:52
@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant