stacker.news icon indicating copy to clipboard operation
stacker.news copied to clipboard

Add nostr note and nevent embeds

Open benalleng opened this issue 1 year ago • 1 comments

Description

Adds nostr note and nevent embeds through the jump.me embed system, shoutout to @sfr0x for pointing out its existence!

Closes #1170

Screenshots

image

image

image

Additional Context

TODO

  • I need to figure out the scrolling within an iframe issue as I am passing through the scrolling prop which is deprecated
  • I have the height set to a fixed 485px after expansion but again needing to deal with scrolling because of this on long posts

Additional note: the duplicates catch for nevent posts are giving a bunch of false positives, but that can be for a future PR

Checklist

Are your changes backwards compatible? Please answer below:

Did you QA this? Could we deploy this straight to production? Please answer below:

For frontend changes: Tested on mobile? Please answer below:

Did you introduce any new environment variables? If so, call them out explicitly here:

benalleng avatar May 15 '24 21:05 benalleng

Setting a dynamic height has proven more difficult than I anticipated using the https://njump.me/embed/$ script. It has logic for setting maxHeight to 50vh but since the src.setAttribute('height', px) logic is passed to the creation of iframe and not the created HTML I am not able to set something like height: max-content;. I ended up opting for a fixed 50dvh height using the https://njump.me/${nevent}?embed=yes direct iframe link and just have a small and expanded version that scrolls on notes larger than the height I set.

benalleng avatar May 21 '24 17:05 benalleng

nostr embeds were added in https://github.com/stackernews/stacker.news/pull/1368

ekzyis avatar Sep 13 '24 00:09 ekzyis