feat(telemetry): product interaction events
- h2h_viewed from match card, dock, profile, stats, predictions - reaction_sent with emoji and surface; score_report_opened from all three report entry points - stats_filtered and stats_sorted on stats route and profile - rules/teams/players/bracket/tournament view events with sources - match_history_viewed, badge_viewed, player_searched (count only)
This commit is contained in:
@@ -28,6 +28,7 @@ import { useNavigate } from "@tanstack/react-router";
|
||||
import { useAllPlayerStats } from "../queries";
|
||||
import { PlayerListItemSkeleton } from "./player-stats-table-skeleton";
|
||||
import { Trans, useLingui } from "@lingui/react/macro";
|
||||
import { track } from "@/lib/telemetry/client";
|
||||
|
||||
type SortKey = keyof PlayerStats | "mmr";
|
||||
type SortDirection = "asc" | "desc";
|
||||
@@ -177,6 +178,7 @@ const PlayerStatsTable = ({ viewType = 'all' }: PlayerStatsTableProps) => {
|
||||
const navigate = useNavigate();
|
||||
const [search, setSearch] = useState("");
|
||||
const deferredSearch = useDeferredValue(search);
|
||||
const searchedRef = useRef(false);
|
||||
const [sortConfig, setSortConfig] = useState<SortConfig>({
|
||||
key: "mmr" as SortKey,
|
||||
direction: "desc",
|
||||
@@ -291,6 +293,7 @@ const PlayerStatsTable = ({ viewType = 'all' }: PlayerStatsTableProps) => {
|
||||
}, [navigate]);
|
||||
|
||||
const handleSort = (key: SortKey) => {
|
||||
track("stats_sorted", { value: key });
|
||||
setSortConfig((prev) => ({
|
||||
key,
|
||||
direction: prev.key === key && prev.direction === "desc" ? "asc" : "desc",
|
||||
@@ -328,7 +331,14 @@ const PlayerStatsTable = ({ viewType = 'all' }: PlayerStatsTableProps) => {
|
||||
<TextInput
|
||||
placeholder={t`Search players`}
|
||||
value={search}
|
||||
onChange={(e) => setSearch(e.currentTarget.value)}
|
||||
onChange={(e) => {
|
||||
const value = e.currentTarget.value;
|
||||
if (value && !searchedRef.current) {
|
||||
searchedRef.current = true;
|
||||
track("player_searched");
|
||||
}
|
||||
setSearch(value);
|
||||
}}
|
||||
leftSection={<MagnifyingGlassIcon size={16} />}
|
||||
size="md"
|
||||
px="md"
|
||||
|
||||
Reference in New Issue
Block a user