Skip to content

Commit 457f5fa

Browse files
committed
support tracking moves
1 parent 400e2f9 commit 457f5fa

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

website/fridge.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ interface FridgeWordType {
2424
word: string;
2525
color?: string;
2626
}
27+
2728
interface Props extends FridgeWordType {
2829
deleteMode?: boolean;
2930
onDeleteWord?: () => void;
3031
className?: string;
32+
userColor: string;
33+
wall: string;
3134
}
3235

3336
const DefaultRoom = "fridge";
@@ -39,18 +42,25 @@ const RestrictedWords = [...profaneWords];
3942
const FridgeWord = withSharedState(
4043
{
4144
tagInfo: [TagType.CanMove],
42-
onDrag: () => {
43-
// Track word movement
44-
window.plausible?.("MovedWord");
45-
},
4645
},
4746
({}, props: Props) => {
48-
const { id, word, deleteMode, onDeleteWord, className } = props;
47+
const { id, word, deleteMode, onDeleteWord, className, userColor, wall } =
48+
props;
4949
return (
5050
<div
5151
id={id}
5252
selector-id="#fridge .fridgeWordHolder"
5353
className="fridgeWordHolder"
54+
// TODO: this is a hack since we dont support a callback for TagType.CanMove
55+
onPointerDown={() => {
56+
if (!userColor || !wall) return;
57+
window.plausible?.("MovedWord", {
58+
props: {
59+
userColor: userColor,
60+
wall: wall,
61+
},
62+
});
63+
}}
5464
>
5565
<div
5666
className={`fridgeWord ${className}`}
@@ -284,6 +294,8 @@ const WordControls = withSharedState<FridgeWordType[]>(
284294
onDeleteWord={() => {
285295
handleDeleteWord(id, word, color);
286296
}}
297+
userColor={userColor}
298+
wall={wall}
287299
/>
288300
))}
289301
<div

0 commit comments

Comments
 (0)