Skip to content

Commit 9d6fdb7

Browse files
remove Posthog
1 parent f30d371 commit 9d6fdb7

File tree

13 files changed

+3
-178
lines changed

13 files changed

+3
-178
lines changed

cypress/integration/utils/interface-test/named-entity-recognition.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const namedEntityRecognition = () => {
1515
cy.contains("Elon Musk Tweets").siblings("td").eq(2).click()
1616

1717
cy.log("should be able to setup Named Entity Recognition")
18-
cy.get("#tab-setup").click()
18+
cy.get("#tab-setup", { timeout: 5000 }).click()
1919
cy.contains("Named Entity Recognition").click()
2020
cy.get("input[value=food]").focus().clear().type("mars")
2121
cy.get("input[value=Food]").focus().clear().type("About Mars")

src/components/AdvancedOptionsView/index.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import React, { useState } from "react"
22
import Box from "@material-ui/core/Box"
33
import MuiButton from "@material-ui/core/Button"
4-
import { useUpdate } from "react-use"
54
import { styled } from "@material-ui/core/styles"
6-
import usePosthog from "../../hooks/use-posthog"
75
import { useAppConfig } from "../AppConfig"
86
import { useHotkeyStorage } from "../HotkeyStorage"
97
import KeyboardShortcutManagerDialog from "../KeyboardShortcutManagerDialog"
@@ -15,8 +13,6 @@ const Button = styled(MuiButton)({
1513
})
1614

1715
export const AdvancedOptionsView = ({ onClickEditJSON, onClearLabelData }) => {
18-
const forceUpdate = useUpdate()
19-
const posthog = usePosthog()
2016
const { fromConfig, setInConfig } = useAppConfig()
2117
const { hotkeys, changeHotkey, clearHotkeys } = useHotkeyStorage()
2218
const [hotkeyDialogOpen, setHotkeyDialogOpen] = useState(false)
@@ -40,20 +36,6 @@ export const AdvancedOptionsView = ({ onClickEditJSON, onClearLabelData }) => {
4036
>
4137
{t("clear-labels")}
4238
</Button>
43-
<Button
44-
variant="outlined"
45-
onClick={() => {
46-
if (posthog.has_opted_out_capturing()) {
47-
posthog.opt_in_capturing()
48-
} else {
49-
posthog.opt_out_capturing()
50-
}
51-
forceUpdate()
52-
}}
53-
>
54-
{posthog.has_opted_out_capturing() ? "Enable" : "Disable"}{" "}
55-
{t("telemetry")}
56-
</Button>
5739
<Button
5840
variant="outlined"
5941
onClick={() => {

src/components/App/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import AppErrorBoundary from "../AppErrorBoundary"
1111
import useEventCallback from "use-event-callback"
1212
import usePreventNavigation from "../../hooks/use-prevent-navigation"
1313
import { FileContext } from "../FileContext"
14-
import usePosthog from "../../hooks/use-posthog"
1514
import ManagePluginsDialog from "../ManagePluginsDialog"
1615
import usePluginProvider from "../PluginProvider"
1716
import download from "in-browser-download"
@@ -28,7 +27,6 @@ export default () => {
2827
const [datasetManager, setDatasetManager] = useActiveDatasetManager()
2928
usePreventNavigation(Boolean(datasetManager))
3029

31-
const posthog = usePosthog()
3230
const [errors] = useErrors()
3331

3432
const [managePluginsDialogOpen, setManagePluginsDialogOpen] = useState(false)
@@ -60,7 +58,6 @@ export default () => {
6058
setManagePluginsDialogOpen(true)
6159
)
6260
const onDownload = useEventCallback(async (format) => {
63-
posthog.capture("download_file", { file_type: format })
6461
const ds = await datasetManager.getDataset()
6562
const userProvidedFileName = (
6663
datasetManager.sessionId ||

src/components/CollaborateButton/index.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import InputAdornment from "@material-ui/core/InputAdornment"
1313
import AddBoxTwoTone from "@material-ui/icons/AddBoxTwoTone"
1414
import ExitToAppIcon from "@material-ui/icons/ExitToApp"
1515
import CircularProgress from "@material-ui/core/CircularProgress"
16-
import usePosthog from "../../hooks/use-posthog"
1716
import HeaderPopupBox from "../HeaderPopupBox"
1817
import useActiveDatasetManager from "../../hooks/use-active-dataset-manager"
1918

@@ -59,7 +58,6 @@ export default ({
5958
const [loadingSession, changeLoadingSession] = useState(false)
6059
const [sessionUrl, changeSessionUrl] = useState("")
6160
const [userName, changeUserName] = useLocalStorage("userName", "anonymous")
62-
const posthog = usePosthog()
6361

6462
// internalization hook
6563
const { t } = useTranslation()
@@ -106,7 +104,6 @@ export default ({
106104
<IconButton
107105
color="primary"
108106
onClick={() => {
109-
posthog.capture("join_collaborative_session")
110107
onJoinSession(sessionUrl)
111108
}}
112109
disabled={!sessionUrl}
@@ -122,7 +119,6 @@ export default ({
122119
fullWidth
123120
disabled={!fileOpen || loadingSession || error}
124121
onClick={() => {
125-
posthog.capture("create_collaborative_session")
126122
onCreateSession()
127123
changeLoadingSession(true)
128124
}}

src/components/DatasetEditor/index.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import useElectron from "../../hooks/use-electron"
1010
import useTimeToCompleteSample from "../../hooks/use-time-to-complete-sample.js"
1111
import { useToasts } from "../Toasts"
1212
import useEventCallback from "use-event-callback"
13-
import usePosthog from "../../hooks/use-posthog"
1413
import classnames from "classnames"
1514
import LabelView from "../LabelView"
1615
import useIsLabelOnlyMode from "../../hooks/use-is-label-only-mode"
@@ -59,7 +58,6 @@ export default ({
5958
const { addToast } = useToasts()
6059
const [mode, changeMode] = useState(labelOnlyMode ? "label" : initialMode)
6160
const { ipcRenderer } = useElectron() || {}
62-
const posthog = usePosthog()
6361
const { iface } = useInterface()
6462
const { summary } = useSummary()
6563
const removeSamples = useRemoveSamples()
@@ -88,16 +86,9 @@ export default ({
8886
}
8987
}, [ipcRenderer])
9088

91-
useEffect(() => {
92-
posthog.people.set({
93-
average_time_to_complete_sample: sampleTimeToComplete,
94-
})
95-
}, [sampleTimeToComplete, posthog.people])
96-
9789
useEffect(() => {
9890
if (mode !== "label") setSampleIndex(null)
99-
posthog.capture("open_editor_tab", { tab: mode })
100-
}, [mode, posthog])
91+
}, [mode])
10192

10293
const onChangeTab = useEventCallback((tab) => changeMode(tab.toLowerCase()))
10394

@@ -147,9 +138,6 @@ export default ({
147138
<SamplesView
148139
openSampleLabelEditor={(sampleIndex) => {
149140
setSampleIndex(sampleIndex)
150-
posthog.capture("open_sample", {
151-
interface_type: iface?.type,
152-
})
153141
changeMode("label")
154142
}}
155143
user={user}

src/components/ImportPage/index.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import ImportToyDataset from "../ImportToyDatasetDialog"
2626
import ImportFromYoutubeUrls from "../ImportFromYoutubeUrls"
2727
import ImportFromCOCODialog from "../ImportFromCOCODialog"
2828
import { FaGoogleDrive, FaYoutube } from "react-icons/fa"
29-
import usePosthog from "../../hooks/use-posthog"
3029
import promptAndGetSamplesFromLocalDirectory from "./prompt-and-get-samples-from-local-directory.js"
3130
import { useTranslation } from "react-i18next"
3231
import useAuth from "../../utils/auth-handlers/use-auth.js"
@@ -79,8 +78,6 @@ const Button = ({
7978
onlySupportType,
8079
type,
8180
}) => {
82-
const posthog = usePosthog()
83-
8481
const { isLoggedIn, authConfig } = useAuth()
8582

8683
const isDisabled = () => {
@@ -112,9 +109,6 @@ const Button = ({
112109
return (
113110
<ButtonBase
114111
onClick={() => {
115-
posthog.capture("import_button_clicked", {
116-
import_button: dialog,
117-
})
118112
onChangeDialog(dialog)
119113
}}
120114
className={classnames({ disabled })}

src/components/LabelHelpView/api-key-entry.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { styled } from "@material-ui/core/styles"
77
import { useAppConfig } from "../AppConfig"
88
import SaveIcon from "@material-ui/icons/Save"
99
import CircularProgress from "@material-ui/core/CircularProgress"
10-
import usePosthog from "../../hooks/use-posthog"
1110

1211
const Title = styled("div")({
1312
fontSize: 18,
@@ -35,7 +34,6 @@ export default () => {
3534
const [verifying, setVerifying] = useState(false)
3635
const [textFieldValue, setTextFieldValue] = useState("")
3736
const [error, setError] = useState("")
38-
const posthog = usePosthog()
3937

4038
return (
4139
<Box paddingTop={8} textAlign="center">
@@ -49,7 +47,6 @@ export default () => {
4947
href="https://labelhelp.universaldatatool.com"
5048
// eslint-disable-next-line
5149
target="_blank"
52-
onClick={() => posthog.capture("get_api_key_link_clicked")}
5350
>
5451
get an API key here
5552
</a>
@@ -94,7 +91,6 @@ export default () => {
9491

9592
setVerifying(false)
9693
setInConfig("labelhelp.apikey", textFieldValue)
97-
posthog.capture("save_api_key_button_clicked")
9894
}}
9995
>
10096
{verifying ? (

src/components/LabelHelpView/label-help-setup.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import TableCell from "@material-ui/core/TableCell"
77
import TableHead from "@material-ui/core/TableHead"
88
import TableRow from "@material-ui/core/TableRow"
99
import useLabelHelp from "./use-label-help"
10-
import usePosthog from "../../hooks/use-posthog"
1110
import CircularProgress from "@material-ui/core/CircularProgress"
1211
import { useAppConfig } from "../AppConfig"
1312
import useDataset from "../../hooks/use-dataset"
@@ -38,8 +37,6 @@ export const LabelHelpSetup = ({ onChangeActiveStep, onError }) => {
3837
myCredits = () => 0,
3938
} = useLabelHelp()
4039

41-
const posthog = usePosthog()
42-
4340
const [isCreating, setIsCreating] = useState(false)
4441

4542
const onStartLabelHelp = useEventCallback(async () => {
@@ -81,8 +78,6 @@ export const LabelHelpSetup = ({ onChangeActiveStep, onError }) => {
8178
)
8279

8380
onChangeActiveStep("running")
84-
85-
posthog.capture("start_label_help_button_clicked")
8681
})
8782

8883
return (
@@ -151,7 +146,6 @@ export const LabelHelpSetup = ({ onChangeActiveStep, onError }) => {
151146
<Button
152147
onClick={() => {
153148
setInConfig("labelhelp.apikey", null)
154-
posthog.capture("api_key_button_clicked")
155149
}}
156150
variant="outlined"
157151
>
@@ -162,9 +156,6 @@ export const LabelHelpSetup = ({ onChangeActiveStep, onError }) => {
162156
style={{ marginLeft: 12 }}
163157
variant="outlined"
164158
href="https://labelhelp.universaldatatool.com#addcredits"
165-
onClick={() => {
166-
posthog.capture("add_credits_button_clicked")
167-
}}
168159
>
169160
Add Credits
170161
</Button>

src/components/LabelView/index.js

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import React, { useEffect, useState } from "react"
1+
import React, { useState } from "react"
22
import LabelErrorBoundary from "../LabelErrorBoundary"
33
// import UniversalDataViewer from "../UniversalDataViewer"
44
import UniversalSampleEditor from "../UniversalSampleEditor"
55
import Stats from "../Stats"
66
import SampleGrid from "../SampleGrid"
77
import Box from "@material-ui/core/Box"
8-
import usePosthog from "../../hooks/use-posthog"
98
import duration from "duration"
109
import { styled } from "@material-ui/core/styles"
1110
import Tabs from "@material-ui/core/Tabs"
@@ -20,7 +19,6 @@ import useSummary from "../../hooks/use-summary"
2019
import useSample from "../../hooks/use-sample"
2120
import useRemoveSamples from "../../hooks/use-remove-samples"
2221
import useInterface from "../../hooks/use-interface"
23-
import useAppConfig from "../../hooks/use-app-config"
2422

2523
const OverviewContainer = styled("div")({
2624
padding: 8,
@@ -40,16 +38,12 @@ export default ({
4038
sampleTimeToComplete,
4139
}) => {
4240
const [currentTab, setTab] = useState("label")
43-
const posthog = usePosthog()
4441
const labelOnlyMode = useIsLabelOnlyMode()
45-
const { fromConfig } = useAppConfig()
4642
const [annotationStartTime, setAnnotationStartTime] = useState(null)
4743
const { summary } = useSummary()
4844
const removeSamples = useRemoveSamples()
4945
const { sample, updateSample, sampleLoading } = useSample(sampleIndex)
5046
const { iface } = useInterface()
51-
52-
const labelHelpEnabled = !fromConfig("labelhelp.disabled")
5347
const isInOverview = sampleIndex === null
5448

5549
let percentComplete = 0
@@ -59,18 +53,6 @@ export default ({
5953
summary.samples.length
6054
}
6155

62-
useEffect(() => {
63-
if (labelHelpEnabled) {
64-
posthog.capture("label_help_showed")
65-
}
66-
}, [labelHelpEnabled, posthog])
67-
68-
useEffect(() => {
69-
if (currentTab === "labelhelp") {
70-
posthog.capture("label_help_clicked")
71-
}
72-
}, [currentTab, posthog])
73-
7456
return !isInOverview ? (
7557
<LabelErrorBoundary>
7658
<UniversalSampleEditor
@@ -94,9 +76,6 @@ export default ({
9476
switch (nextAction) {
9577
case "go-to-next":
9678
if (sampleIndex !== summary.samples.length - 1) {
97-
posthog.capture("next_sample", {
98-
interface_type: iface?.type,
99-
})
10079
// TODO reset start time
10180
onChangeSampleIndex(sampleIndex + 1)
10281
setAnnotationStartTime(Date.now())
@@ -175,9 +154,6 @@ export default ({
175154
tablePaginationPadding={6}
176155
samples={summary?.samples || []}
177156
onClick={(selectedSampleIndex) => {
178-
posthog.capture("open_sample", {
179-
interface_type: iface?.type,
180-
})
181157
onChangeSampleIndex(selectedSampleIndex)
182158
}}
183159
/>

src/components/StartingPage/index.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { useDropzone } from "react-dropzone"
1010
import CreateFromTemplateDialog from "../CreateFromTemplateDialog"
1111
import AddAuthFromTemplateDialog from "../AddAuthFromTemplateDialog"
1212
import { styled } from "@material-ui/core/styles"
13-
import usePosthog from "../../hooks/use-posthog"
1413
import packageInfo from "../../../package.json"
1514
import useEventCallback from "use-event-callback"
1615
import Box from "@material-ui/core/Box"
@@ -156,7 +155,6 @@ export default ({
156155
onClickOpenSession,
157156
}) => {
158157
const c = useStyles()
159-
const posthog = usePosthog()
160158

161159
// internalization hook
162160
const { t, i18n } = useTranslation()
@@ -250,9 +248,6 @@ export default ({
250248
<ActionTitle>{t("start")}</ActionTitle>
251249
<Action
252250
onClick={() => {
253-
posthog.capture("template_clicked", {
254-
clicked_template: "empty",
255-
})
256251
onOpenTemplate(templates.find((t) => t.name === "Empty"))
257252
}}
258253
>
@@ -385,9 +380,6 @@ export default ({
385380
<CreateFromTemplateDialog
386381
open={createFromTemplateDialogOpen}
387382
onSelect={(template) => {
388-
posthog.capture("template_clicked", {
389-
clicked_template: template.name,
390-
})
391383
onOpenTemplate(template)
392384
}}
393385
onClose={() => changeCreateFromTemplateDialogOpen(false)}

0 commit comments

Comments
 (0)