add download video event

This commit is contained in:
MarconLP 2023-04-23 14:53:58 +02:00
parent 51eaa538f1
commit 9be8efeadf
No known key found for this signature in database
GPG key ID: A08A9C8B623F5EA5

View file

@ -8,6 +8,7 @@ import {
TrashIcon, TrashIcon,
} from "@radix-ui/react-icons"; } from "@radix-ui/react-icons";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { usePostHog } from "posthog-js/react";
interface Props { interface Props {
video: RouterOutputs["video"]["get"]; video: RouterOutputs["video"]["get"];
@ -18,6 +19,7 @@ export default function VideoMoreMenu({ video }: Props) {
const [renameMenuOpen, setRenameMenuOpen] = useState<boolean>(false); const [renameMenuOpen, setRenameMenuOpen] = useState<boolean>(false);
const utils = api.useContext(); const utils = api.useContext();
const router = useRouter(); const router = useRouter();
const posthog = usePostHog();
const items = [ const items = [
{ {
@ -42,7 +44,10 @@ export default function VideoMoreMenu({ video }: Props) {
a.download = video.title; a.download = video.title;
a.click(); a.click();
}); });
//window.location.href = response.url; });
posthog?.capture("download existing video", {
videoId: video.id,
}); });
}, },
}, },