mirror of
https://github.com/p-stream/p-stream.git
synced 2026-04-19 15:22:04 +00:00
commit 6034a1ebeaa97a97552dc249f97cc935dcbd1cd6
Author: Pas <74743263+Pasithea0@users.noreply.github.com>
Date: Sat May 17 20:02:36 2025 -0600
update stuff
commit 91d1370668a3e05fed3687ffef697a96c28a0b2c
Author: Pas <74743263+Pasithea0@users.noreply.github.com>
Date: Sat May 17 19:47:34 2025 -0600
Update Downloads.tsx
commit 1c25c88175abebe761d27194f22eec9fd3bcf2e1
Author: Pas <74743263+Pasithea0@users.noreply.github.com>
Date: Sat May 17 19:46:27 2025 -0600
clean some more stuff
commit d6c24e76348c135f3c1ae0444491ff0b302eca2e
Author: Pas <74743263+Pasithea0@users.noreply.github.com>
Date: Sat May 17 19:38:07 2025 -0600
clean this again
commit 6511de68a1b1397e4884dfc6e6f0599497b9afee
Author: Pas <74743263+Pasithea0@users.noreply.github.com>
Date: Sat May 17 19:30:08 2025 -0600
clean up a bit
commit 467358c1f50c1555b42f9ae8d22f955ebc9bba1b
Author: Pas <74743263+Pasithea0@users.noreply.github.com>
Date: Sat May 17 17:45:04 2025 -0600
validate content
commit 59d4a1665b32bdf4ca453859816a2245b184b025
Author: Pas <74743263+Pasithea0@users.noreply.github.com>
Date: Sat May 17 17:35:22 2025 -0600
add auto join link
commit 6f3c334d2157f1c82f9d26e9a7db49371e6a2b5e
Author: Pas <74743263+Pasithea0@users.noreply.github.com>
Date: Sat May 17 17:08:35 2025 -0600
watch partyyyy
commit 1497377692fba86ea1ef40191dbaa648abc38e2e
Author: Pas <74743263+Pasithea0@users.noreply.github.com>
Date: Sat May 17 13:56:04 2025 -0600
add watch party view stuff
commit 80003f78d0adf6071d4f2c6b6a6d8fdcb2aa204a
Author: Pas <74743263+Pasithea0@users.noreply.github.com>
Date: Sat May 17 13:14:07 2025 -0600
init sending webhooks
testing on a discord hook
commit f5293c2eae5d5a12be6153ab37e50214289e20b6
Author: Pas <74743263+Pasithea0@users.noreply.github.com>
Date: Sat May 17 12:31:41 2025 -0600
remove duplicate class
commit 7871162e6b2c580eb2bcb9c8abc5ecc19d706a06
Author: Pas <74743263+Pasithea0@users.noreply.github.com>
Date: Sat May 17 12:25:49 2025 -0600
update legacy button
commit a2948f3aa1b7481a3ac5b69e2e4dab71552816de
Author: Pas <74743263+Pasithea0@users.noreply.github.com>
Date: Sat May 17 12:21:52 2025 -0600
move watchparty to new atoms menu
54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
import { useCallback, useMemo } from "react";
|
|
|
|
import { Icons } from "@/components/Icon";
|
|
import { useBookmarkStore } from "@/stores/bookmarks";
|
|
import { PlayerMeta } from "@/stores/player/slices/source";
|
|
import { MediaItem } from "@/utils/mediaTypes";
|
|
|
|
import { IconPatch } from "../buttons/IconPatch";
|
|
|
|
interface MediaBookmarkProps {
|
|
media: MediaItem;
|
|
}
|
|
|
|
export function MediaBookmarkButton({ media }: MediaBookmarkProps) {
|
|
const addBookmark = useBookmarkStore((s) => s.addBookmark);
|
|
const removeBookmark = useBookmarkStore((s) => s.removeBookmark);
|
|
const bookmarks = useBookmarkStore((s) => s.bookmarks);
|
|
const meta: PlayerMeta | undefined = useMemo(() => {
|
|
return media.year !== undefined
|
|
? {
|
|
type: media.type,
|
|
title: media.title,
|
|
tmdbId: media.id,
|
|
releaseYear: media.year,
|
|
poster: media.poster,
|
|
}
|
|
: undefined;
|
|
}, [media]);
|
|
const isBookmarked = !!bookmarks[meta?.tmdbId ?? ""];
|
|
|
|
const toggleBookmark = useCallback(() => {
|
|
if (!meta) return;
|
|
if (isBookmarked) removeBookmark(meta.tmdbId);
|
|
else addBookmark(meta);
|
|
}, [isBookmarked, meta, addBookmark, removeBookmark]);
|
|
|
|
const buttonOpacityClass =
|
|
media.year === undefined ? "hover:opacity-100" : "hover:opacity-95";
|
|
|
|
return (
|
|
<div
|
|
onClick={(e) => {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
toggleBookmark();
|
|
}}
|
|
>
|
|
<IconPatch
|
|
icon={isBookmarked ? Icons.BOOKMARK : Icons.BOOKMARK_OUTLINE}
|
|
className={`${buttonOpacityClass} p-2 opacity-75 transition-opacity duration-300 hover:scale-110 hover:cursor-pointer`}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|