From 8f856e982d20bc35b425ef48aed9aeb0e567f7d5 Mon Sep 17 00:00:00 2001 From: Pedro Rodrigues <44656907+Rodriguespn@users.noreply.github.com> Date: Mon, 15 Jan 2024 13:36:44 +0000 Subject: [PATCH] Feature/firebase (#9) * Initial deployment graph app (#8) * removed unnused imports * fixed spell errors on README * searchbar with logo and footer v1.0 * aligned logo with search buttons and minor styling fixes * changed analyze text, added icons to the buttons and text to footer * fixed footer margins * removed unused imports and comments unused variables * Feature/landing page (#5) * a * removed unused imports and comments unused variables * Fix everything * removed unused imports and comments unused variables * Initial deploy of graph app (#2) * removed unnused imports * fixed spell errors on README * searchbar with logo and footer v1.0 * aligned logo with search buttons and minor styling fixes * changed analyze text, added icons to the buttons and text to footer * fixed footer margins * removed unused imports and comments unused variables * removed unused imports and comments unused variables * add github action to deploy on pull request * fixed github actions to deploy app to firebase * ignore -.firebase directory --------- Co-authored-by: Pedro Ribeiro <47680931+tubarao312@users.noreply.github.com> * Initial deployment graph app (#7) * a * removed unused imports and comments unused variables * Fix everything * removed unused imports and comments unused variables * Initial deploy of graph app (#2) * removed unnused imports * fixed spell errors on README * searchbar with logo and footer v1.0 * aligned logo with search buttons and minor styling fixes * changed analyze text, added icons to the buttons and text to footer * fixed footer margins * removed unused imports and comments unused variables * removed unused imports and comments unused variables * add github action to deploy on pull request * fixed github actions to deploy app to firebase * ignore -.firebase directory * Revert "Initial deploy of graph app" (#6) --------- Co-authored-by: Pedro Ribeiro <47680931+tubarao312@users.noreply.github.com> --------- Co-authored-by: Pedro Ribeiro <47680931+tubarao312@users.noreply.github.com> * added google analytics to firebase configuration * new google analytics event on search address --------- Co-authored-by: Pedro Ribeiro <47680931+tubarao312@users.noreply.github.com> --- .env.example | 12 +++++++++++- package.json | 2 +- src/App.tsx | 1 + src/components/Graph/Graph.tsx | 13 ++++++++++++- src/firebase/firebase.ts | 32 ++++++++++++++++++++++++++++++++ yarn.lock | 2 +- 6 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 src/firebase/firebase.ts diff --git a/.env.example b/.env.example index e99df4b8..73a5365d 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,12 @@ VITE_WARD_API_BASE_URL=https://wardanalyticsapi.com -VITE_WARD_API_KEY= \ No newline at end of file +VITE_WARD_API_KEY= + +# Firebase config +VITE_FIREBASE_API_KEY= +VITE_FIREBASE_AUTH_DOMAIN= +VITE_FIREBASE_PROJECT_ID= +VITE_FIREBASE_STORAGE_BUCKET= +VITE_FIREBASE_MESSAGING_SENDER_ID= +VITE_FIREBASE_APP_ID= +# For Google Analytics +VITE_FIREBASE_MEASUREMENT_ID= \ No newline at end of file diff --git a/package.json b/package.json index 27424339..2a20f425 100644 --- a/package.json +++ b/package.json @@ -59,4 +59,4 @@ "prettier-plugin-tailwindcss" ] } -} \ No newline at end of file +} diff --git a/src/App.tsx b/src/App.tsx index dcd44725..3fcfa0c3 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,6 +3,7 @@ import { QueryClientProvider } from 'react-query' import Routes from './Routes'; import useCustomQueryClient from './hooks/useCustomQueryClient'; +import './firebase/firebase' function App() { const queryClient = useCustomQueryClient() diff --git a/src/components/Graph/Graph.tsx b/src/components/Graph/Graph.tsx index c6ac318e..5d7276eb 100644 --- a/src/components/Graph/Graph.tsx +++ b/src/components/Graph/Graph.tsx @@ -49,6 +49,9 @@ import TransactionTooltip, { } from "./TransactionTooltip"; import { Transition } from "@headlessui/react"; +import { default as firebase } from "../../firebase/firebase" +import { logEvent } from "firebase/analytics"; + /* Pan on drag settings */ const panOnDrag = [1, 2]; @@ -394,6 +397,14 @@ const GraphProvided: FC = ({ initialNodes }) => { const Graph: FC = () => { const [searchedAddress, setSearchedAddress] = useState(null); + const onSetSearchedAddress = (newAddress: string) => { + setSearchedAddress(newAddress); + + logEvent(firebase.analytics, "search_address", { + address: newAddress, + }); + } + return (
{ leaveTo="opacity-0 scale-50" className="fixed flex h-full w-full flex-col items-center justify-center" > - +