mirror of
https://github.com/p-stream/p-stream.git
synced 2026-04-18 15:22:09 +00:00
add share sheet to details modal
This commit is contained in:
parent
200d3e69ac
commit
e145e53ee3
1 changed files with 15 additions and 3 deletions
|
|
@ -166,9 +166,21 @@ export function DetailsContent({ data, minimal = false }: DetailsContentProps) {
|
|||
? `${window.location.origin}/media/tmdb-movie-${data.id}-${data.title.toLowerCase().replace(/[^a-z0-9]+/g, "-")}`
|
||||
: `${window.location.origin}/media/tmdb-tv-${data.id}-${data.title.toLowerCase().replace(/[^a-z0-9]+/g, "-")}`;
|
||||
|
||||
copyToClipboard(shareUrl);
|
||||
setHasCopiedShare(true);
|
||||
setTimeout(() => setHasCopiedShare(false), 2000);
|
||||
// Check if the device is iOS and share API is available
|
||||
if (/iPad|iPhone|iPod/i.test(navigator.userAgent) && navigator.share) {
|
||||
navigator
|
||||
.share({
|
||||
title: "P-Stream",
|
||||
text: data.title,
|
||||
url: shareUrl,
|
||||
})
|
||||
.catch((error) => console.error("Error sharing:", error));
|
||||
} else {
|
||||
// Fall back to clipboard copy for non-iOS devices
|
||||
copyToClipboard(shareUrl);
|
||||
setHasCopiedShare(true);
|
||||
setTimeout(() => setHasCopiedShare(false), 2000);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in a new issue