Skip to content

Commit

Permalink
added new events
Browse files Browse the repository at this point in the history
  • Loading branch information
istvan-kreisz committed Jun 15, 2021
1 parent f0f0401 commit 5e18540
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Settings/SettingsTab.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { useState, useRef, useEffect } from 'react';
import { useState, useRef, useEffect, useContext } from 'react';
import {
Currency,
ALLCURRENCIES,
Expand All @@ -17,6 +17,7 @@ import { is } from 'superstruct';
import { SettingsSchema, Settings } from '../utils/types';
import { IpcRenderer } from 'electron';
const ipcRenderer: IpcRenderer = window.require('electron').ipcRenderer;
import FirebaseContext from '../context/firebaseContext';

const SettingsTab = (prop: {
setToastMessage: React.Dispatch<
Expand All @@ -31,6 +32,8 @@ const SettingsTab = (prop: {
const goatTaxesField = useRef<HTMLInputElement>(null);
const stockxTaxesField = useRef<HTMLInputElement>(null);

const firebase = useContext(FirebaseContext);

const [updateInterval, setUpdateInterval] = useState('5');
const [notificationFrequency, setNotificationFrequency] = useState('24');
const [selectedCurrency, setSelectedCurrency] = useState<Currency>(EUR);
Expand Down Expand Up @@ -204,6 +207,14 @@ const SettingsTab = (prop: {
);
};

const clickedDonate = () => {
firebase?.analytics().logEvent('desktop_clicked_donate', {});
};

const clickedDiscord = () => {
firebase?.analytics().logEvent('desktop_clicked_discord', {});
};

return (
<>
<div className="bg-gray-100 p-3 w-full h-full overflow-y-scroll overflow-x-hidden">
Expand Down Expand Up @@ -429,6 +440,7 @@ const SettingsTab = (prop: {
href="https://copdeck.com/donate"
className="button-default p-0 text-lg text-theme-blue border-transparent underline"
type="submit"
onClick={clickedDonate}
>
Donate now!
</a>
Expand All @@ -453,6 +465,7 @@ const SettingsTab = (prop: {
href="https://discord.com/invite/cQh6VTvXas"
className="button-default p-0 text-theme-blue border-transparent underline"
type="submit"
onClick={clickedDiscord}
>
Join us on Discord!
</a>
Expand Down

0 comments on commit 5e18540

Please sign in to comment.