mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-20 14:37:43 +01:00
commit
0e07711b6a
2 changed files with 20 additions and 1 deletions
|
@ -10,7 +10,7 @@ import { convertSubtitlesToSrtDataurl } from "@/components/player/utils/captions
|
||||||
import { useOverlayRouter } from "@/hooks/useOverlayRouter";
|
import { useOverlayRouter } from "@/hooks/useOverlayRouter";
|
||||||
import { usePlayerStore } from "@/stores/player/store";
|
import { usePlayerStore } from "@/stores/player/store";
|
||||||
|
|
||||||
function useDownloadLink() {
|
export function useDownloadLink() {
|
||||||
const source = usePlayerStore((s) => s.source);
|
const source = usePlayerStore((s) => s.source);
|
||||||
const currentQuality = usePlayerStore((s) => s.currentQuality);
|
const currentQuality = usePlayerStore((s) => s.currentQuality);
|
||||||
const url = useMemo(() => {
|
const url = useMemo(() => {
|
||||||
|
|
|
@ -12,7 +12,10 @@ import { qualityToString } from "@/stores/player/utils/qualities";
|
||||||
import { useSubtitleStore } from "@/stores/subtitles";
|
import { useSubtitleStore } from "@/stores/subtitles";
|
||||||
import { getPrettyLanguageNameFromLocale } from "@/utils/language";
|
import { getPrettyLanguageNameFromLocale } from "@/utils/language";
|
||||||
|
|
||||||
|
import { useDownloadLink } from "./Downloads";
|
||||||
|
|
||||||
export function SettingsMenu({ id }: { id: string }) {
|
export function SettingsMenu({ id }: { id: string }) {
|
||||||
|
const downloadUrl = useDownloadLink();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const router = useOverlayRouter(id);
|
const router = useOverlayRouter(id);
|
||||||
const currentQuality = usePlayerStore((s) => s.currentQuality);
|
const currentQuality = usePlayerStore((s) => s.currentQuality);
|
||||||
|
@ -39,6 +42,14 @@ export function SettingsMenu({ id }: { id: string }) {
|
||||||
|
|
||||||
const downloadable = source?.type === "file" || source?.type === "hls";
|
const downloadable = source?.type === "file" || source?.type === "hls";
|
||||||
|
|
||||||
|
const handleWatchPartyClick = () => {
|
||||||
|
if (downloadUrl) {
|
||||||
|
const watchPartyUrl = `https://www.watchparty.me/create?video=${encodeURIComponent(
|
||||||
|
downloadUrl,
|
||||||
|
)}`;
|
||||||
|
window.open(watchPartyUrl);
|
||||||
|
}
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<Menu.Card>
|
<Menu.Card>
|
||||||
<Menu.SectionTitle>
|
<Menu.SectionTitle>
|
||||||
|
@ -67,6 +78,14 @@ export function SettingsMenu({ id }: { id: string }) {
|
||||||
>
|
>
|
||||||
{t("player.menus.settings.downloadItem")}
|
{t("player.menus.settings.downloadItem")}
|
||||||
</Menu.Link>
|
</Menu.Link>
|
||||||
|
<Menu.Link
|
||||||
|
clickable
|
||||||
|
onClick={handleWatchPartyClick}
|
||||||
|
rightSide={<Icon className="text-xl" icon={Icons.WATCH_PARTY} />}
|
||||||
|
className={downloadable ? "opacity-100" : "opacity-50"}
|
||||||
|
>
|
||||||
|
{t("Watch Party")}
|
||||||
|
</Menu.Link>
|
||||||
</Menu.Section>
|
</Menu.Section>
|
||||||
|
|
||||||
<Menu.SectionTitle>
|
<Menu.SectionTitle>
|
||||||
|
|
Loading…
Reference in a new issue