feat: track events in note creator
This commit is contained in:
@ -6,7 +6,7 @@ import { TagsInput } from "react-tag-input-component";
|
|||||||
|
|
||||||
import Icon from "@/Icons/Icon";
|
import Icon from "@/Icons/Icon";
|
||||||
import useEventPublisher from "@/Hooks/useEventPublisher";
|
import useEventPublisher from "@/Hooks/useEventPublisher";
|
||||||
import { appendDedupe, openFile } from "@/SnortUtils";
|
import { appendDedupe, openFile, trackEvent } from "@/SnortUtils";
|
||||||
import Textarea from "@/Element/Textarea";
|
import Textarea from "@/Element/Textarea";
|
||||||
import Modal from "@/Element/Modal";
|
import Modal from "@/Element/Modal";
|
||||||
import ProfileImage from "@/Element/User/ProfileImage";
|
import ProfileImage from "@/Element/User/ProfileImage";
|
||||||
@ -158,6 +158,16 @@ export function NoteCreator() {
|
|||||||
async function sendNote() {
|
async function sendNote() {
|
||||||
const ev = await buildNote();
|
const ev = await buildNote();
|
||||||
if (ev) {
|
if (ev) {
|
||||||
|
trackEvent("PostNote")
|
||||||
|
if (ev.tags.find(a => a[0] === "content-warning")) {
|
||||||
|
trackEvent("PostNote:WithContentWarning");
|
||||||
|
}
|
||||||
|
if (ev.tags.find(a => a[0] === "poll_option")) {
|
||||||
|
trackEvent("PostNote:WithPoll");
|
||||||
|
}
|
||||||
|
if (ev.tags.find(a => a[0] === "zap")) {
|
||||||
|
trackEvent("PostNote:WithZapSplit");
|
||||||
|
}
|
||||||
const events = (note.otherEvents ?? []).concat(ev);
|
const events = (note.otherEvents ?? []).concat(ev);
|
||||||
events.map(a =>
|
events.map(a =>
|
||||||
sendEventToRelays(system, a, note.selectedCustomRelays, r => {
|
sendEventToRelays(system, a, note.selectedCustomRelays, r => {
|
||||||
@ -193,7 +203,7 @@ export function NoteCreator() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function uploadFile(file: File | Blob) {
|
async function uploadFile(file: File) {
|
||||||
try {
|
try {
|
||||||
if (file) {
|
if (file) {
|
||||||
const rx = await uploader.upload(file, file.name);
|
const rx = await uploader.upload(file, file.name);
|
||||||
@ -259,6 +269,7 @@ export function NoteCreator() {
|
|||||||
note.update(v => (v.preview = undefined));
|
note.update(v => (v.preview = undefined));
|
||||||
} else if (publisher) {
|
} else if (publisher) {
|
||||||
const tmpNote = await buildNote();
|
const tmpNote = await buildNote();
|
||||||
|
trackEvent("PostNote:Preview");
|
||||||
note.update(v => (v.preview = tmpNote));
|
note.update(v => (v.preview = tmpNote));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user