papermark icon indicating copy to clipboard operation
papermark copied to clipboard

feat: og image for link (shared file)

Open zaCKoZAck0 opened this issue 1 year ago • 22 comments

Related to #629 [WIP]: add og images for file sharing url.

Draft:

  • [x] Dynamically render og image
    • [x] Add icon according to file type
    • [x] Add metadata according to file
  • [ ] Add first page preview of file [Skipped]
  • [ ] Option to disable file preview. [Skipped]

Currently og image looks something like this: image

Last updated 30-10-24

zaCKoZAck0 avatar Oct 11 '24 22:10 zaCKoZAck0

@zaCKoZAck0 is attempting to deploy a commit to the mftsio Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Oct 11 '24 22:10 vercel[bot]

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

github-actions[bot] avatar Oct 11 '24 22:10 github-actions[bot]

@zaCKoZAck0 looks good for now. Let me know if you have any questions

mfts avatar Oct 12 '24 05:10 mfts

I have read the CLA Document and I hereby sign the CLA

zaCKoZAck0 avatar Oct 12 '24 18:10 zaCKoZAck0

@zaCKoZAck0 are you still working on this issue?

mfts avatar Oct 16 '24 11:10 mfts

Hi @mfts , I was exploring on how to show the preview but og image has a few limitations.

  1. Can only render images and native JSX elements.
  2. We can't utilize any element that relies on client-side functionality or interactivity / custom React components that use hooks, state, or other advanced React features are not supported, so we can't use our existing methods or most of the external libraries.

Few workarounds:

  1. We can convert first page of our documents to image and then render it on the og. 1.1. But issue with the above is we have to add multiple dependencies to convert each file type to an image. 1.2. The fix would be to add preview of selected types for e.g. Image, PDFs etc. which would require minimum dependencies.
  2. We can ask users to upload a preview? But it won't be as intuitive as other methods.

What path should I take next?, I've updated the current state of OG preview in the PR description.

zaCKoZAck0 avatar Oct 18 '24 23:10 zaCKoZAck0

@zaCKoZAck0 thanks for the transparency.

Perhaps you can then design a OG image that takes the name of the document, Papermark and then a standard papermark image. Something that we could swap out in the future as a standard image.

mfts avatar Oct 19 '24 09:10 mfts

@zaCKoZAck0 let me know if you'd like to proceed with this PR?

mfts avatar Oct 22 '24 06:10 mfts

Hi @mfts , Yes I would like to continue with the PR I was just exploring some ideas for the placeholder image and office.com uses something like this which we can take inspiration from.

image

Here's from another office suite. image

We can replace the grey area of the og image with a placeholder illustration image like this. That will let the user know what type of document it is.

zaCKoZAck0 avatar Oct 22 '24 07:10 zaCKoZAck0

Placeholder Image for PDF, DOC, CAD and Notion image

zaCKoZAck0 avatar Oct 22 '24 11:10 zaCKoZAck0

For Sheet, Image, Slides, Dataroom and other files image

@mfts please review the above placeholder images.

zaCKoZAck0 avatar Oct 22 '24 17:10 zaCKoZAck0

@zaCKoZAck0 these placeholders aren't really professional looking. I'm thinking we need to go basic and minimalist.

something like cal.com CleanShot 2024-10-29 at 12 25 18@2x

mfts avatar Oct 29 '24 03:10 mfts

Hi @mfts I've created an OG (V2) that is minimal and according to papermark's design language. Let me know what you think.

If brand is present image

If brand is not present image

zaCKoZAck0 avatar Oct 30 '24 03:10 zaCKoZAck0

@mfts this is a more minimal option V3 image

zaCKoZAck0 avatar Oct 30 '24 18:10 zaCKoZAck0

@zaCKoZAck0 I like this one this one the best (without the avatar)

CleanShot 2024-10-31 at 12 32 12@2x

mfts avatar Oct 31 '24 03:10 mfts

Thanks, I'll do the required changes.

zaCKoZAck0 avatar Oct 31 '24 07:10 zaCKoZAck0

Hi @mfts

It's ready for review now.

zaCKoZAck0 avatar Oct 31 '24 08:10 zaCKoZAck0

Thanks for working with me to get this over the line!

May I ask where you go the tiled background from. I may want to reuse it in other places :)

mfts avatar Oct 31 '24 10:10 mfts

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

Name Status Preview Comments Updated (UTC)
papermark ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2024 10:57am

vercel[bot] avatar Oct 31 '24 10:10 vercel[bot]

Hi @mfts

Here's the background I used https://www.svgbackgrounds.com/set/free-svg-backgrounds-and-patterns/#pattern-randomized

Use stroke width around 0.1 0.2 to get that github like grid 😁

zaCKoZAck0 avatar Oct 31 '24 12:10 zaCKoZAck0

/award 1500

awarding you and merging it later

mfts avatar Oct 31 '24 12:10 mfts

Awarding zaCKoZAck0: 1500 points 🕹️ Well done! Check out your new contribution on oss.gg/zaCKoZAck0

oss-gg[bot] avatar Oct 31 '24 12:10 oss-gg[bot]