Add library events (#2448)

This commit is contained in:
Lipis 2020-12-04 19:18:20 +02:00 committed by GitHub
parent a2132c9bb7
commit e392bebc40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 4 deletions

View file

@ -181,7 +181,13 @@ import {
isSavedToFirebase,
} from "../data/firebase";
import { getNewZoom } from "../scene/zoom";
import { EVENT_SHAPE, EVENT_SHARE, trackEvent } from "../analytics";
import {
EVENT_DIALOG,
EVENT_LIBRARY,
EVENT_SHAPE,
EVENT_SHARE,
trackEvent,
} from "../analytics";
/**
* @param func handler taking at most single parameter (event).
@ -548,6 +554,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
)
) {
await Library.importLibrary(blob);
trackEvent(EVENT_LIBRARY, "import");
this.setState({
isLibraryOpen: true,
});
@ -1577,6 +1584,9 @@ class App extends React.Component<ExcalidrawProps, AppState> {
}
if (event.code === CODES.NINE) {
if (!this.state.isLibraryOpen) {
trackEvent(EVENT_DIALOG, "library");
}
this.setState({ isLibraryOpen: !this.state.isLibraryOpen });
}