Skip to content
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.

Commit

Permalink
feat: track mixpanel search event
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-calavera authored and sunnygleason committed Aug 13, 2019
1 parent c6f3bcf commit 24c418c
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/v2/components/Search/result.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, {memo} from 'react';
import {map} from 'lodash/fp';
import {Link} from 'react-router-dom';
import type {Validator} from 'v2/@types/validator';
import MixPanel from 'v2/mixpanel';

import useStyles from './styles';

Expand All @@ -20,13 +21,20 @@ const SearchResult = ({
onClear,
}: SearchResultProps) => {
const classes = useStyles();
const renderItem = ({nodePubkey}: {nodePubkey: string}) => (
<li className={classes.item} key={nodePubkey}>
<Link onClick={onClear} to={`/validators/${nodePubkey}`}>
{nodePubkey}
</Link>
</li>
);

const renderItem = ({nodePubkey}: {nodePubkey: string}) => {
const handleClick = () => {
onClear();
MixPanel.track('Click Search Dropdown', { nodePubkey });
};
return (
<li className={classes.item} key={nodePubkey}>
<Link onClick={handleClick} to={`/validators/${nodePubkey}`}>
{nodePubkey}
</Link>
</li>
);
};
if ((!isDirty && !items.length) || !isFocus) {
return null;
}
Expand Down

0 comments on commit 24c418c

Please sign in to comment.