KL13NT / badeel

An Egyptian alternatives listing project with UX in mind
https://badeel.wiki/
GNU Affero General Public License v3.0
221 stars 23 forks source link

Shareable product URL #18

Closed hatemhosny closed 10 months ago

hatemhosny commented 11 months ago

Allow users to share specific product status by URL.

KL13NT commented 10 months ago

Hello @hatemhosny, currently Badeel modifies the URL which allows you to copy it and share it with anyone to end up with the same result. Does this make sense to your Feature Request? Would you require a UI modification for it?

hatemhosny commented 10 months ago

Hi @KL13NT

Currently search query is persisted in URL e.g. https://badeel-masr.netlify.app/?query=%D8%A8%D9%8A%D8%A8%D8%B3%D9%8A&page=1&sort=accuracy

However, I would expect to be able to share a specific product e.g. in the modal of: عرض التفاصيل, I would like to have a share link that would take me to this specific product.

KL13NT commented 10 months ago

Hello Hatem, this feature is now implemented. You can now find a "شارك المنتج" button in every product modal. Feel free to provide feedback on this. Thank you!

Resolved in ac605a9

hatemhosny commented 10 months ago

Nice work 👍

We can make this even better using Web Share API to show the OS share screen e.g. WhatsApp, Messenger, Copy URL, ...etc.

This is a sample code

const shareData = {
  title: "Product 1",
  text: "Check Product 1 on Badeel!",
  url: shareUrl,
};

// check that share is supported by OS/browser and the data is valid
if (navigator.canShare && navigator.canShare(shareData)) {
  navigator.share(shareData);
} else {
  // copy URL to clipboard as we do now
}
KL13NT commented 10 months ago

Nice suggestion! Done, mobile devices use the Web Share API now. Thank you!