From 3020012b440424090ff1d1d8b046024e05af50d7 Mon Sep 17 00:00:00 2001 From: Pedro Rodrigues <44656907+Rodriguespn@users.noreply.github.com> Date: Mon, 15 Jan 2024 23:02:08 +0000 Subject: [PATCH] New hotbar, github actions and bug fixing (#23) * 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> * 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> * Configure github actions to PR and main merge (#13) * 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 * ignores .env.developement and .env.prod * configured github action to deploy when PR merged into main and to deploy to temporary URL when PR is created * add comments to github actions files * set an expiration period for temporary url and fixed projectId * new github action to deploy on merge to development environment * rename github action file * fixed pre build command issue * added new comment to github actions files * add firebase.json file * added env variables to github actions script * add echo command to debug --------- Co-authored-by: Pedro Ribeiro <47680931+tubarao312@users.noreply.github.com> * Feature/firebase (#15) * 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 * ignores .env.development and .env.production * ignores .env.developement and .env.prod * configured github action to deploy when PR merged into main and to deploy to temporary URL when PR is created * add comments to github actions files * set an expiration period for temporary url and fixed projectId * new github action to deploy on merge to development environment * rename github action file * fixed pre build command issue * added new comment to github actions files * add firebase.json file * added env variables to github actions script * add echo command to debug * removed echo command from github action --------- Co-authored-by: Pedro Ribeiro <47680931+tubarao312@users.noreply.github.com> * New hotbar and bug fixing (#22) * 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 * ignores .env.development and .env.production * ignores .env.developement and .env.prod * configured github action to deploy when PR merged into main and to deploy to temporary URL when PR is created * add comments to github actions files * set an expiration period for temporary url and fixed projectId * new github action to deploy on merge to development environment * rename github action file * fixed pre build command issue * added new comment to github actions files * add firebase.json file * added env variables to github actions script * add echo command to debug * removed echo command from github action * Code Organization, New Features, Bug Fixing (#14) * Add link and layout * Update Hotbar.tsx --------- Co-authored-by: Pedro Ribeiro <47680931+tubarao312@users.noreply.github.com> --------- Co-authored-by: Pedro Ribeiro <47680931+tubarao312@users.noreply.github.com> --- .env.example | 12 ++++++- .../workflows/firebase-dev-hosting-merge.yml | 33 +++++++++++++++++++ .github/workflows/firebase-hosting-merge.yml | 23 ++++++++++--- .../firebase-hosting-pull-request.yml | 21 ++++++++++-- .gitignore | 4 ++- firebase.json | 16 +++++++++ src/App.tsx | 1 + src/components/Graph/Graph.tsx | 17 ++++++++-- src/firebase/firebase.ts | 32 ++++++++++++++++++ yarn.lock | 2 +- 10 files changed, 148 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/firebase-dev-hosting-merge.yml create mode 100644 firebase.json 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/.github/workflows/firebase-dev-hosting-merge.yml b/.github/workflows/firebase-dev-hosting-merge.yml new file mode 100644 index 00000000..1c88a3e7 --- /dev/null +++ b/.github/workflows/firebase-dev-hosting-merge.yml @@ -0,0 +1,33 @@ +# Configuration for deploying to production on merge to development +# For more information, see https://github.com/marketplace/actions/deploy-to-firebase-hosting#options + +name: Deploy to Firebase Dev Hosting on merge +"on": + push: + branches: + - development + +env: + VITE_WARD_API_BASE_URL: "https://wardanalyticsapi.com" + VITE_WARD_API_KEY: ${{ secrets.WARD_API_KEY }} + VITE_FIREBASE_API_KEY: "AIzaSyBZCnEQus6G42SodGNRf6o2zmBnGN0nXes" + VITE_FIREBASE_AUTH_DOMAIN: "graphapp-dev.firebaseapp.com" + VITE_FIREBASE_PROJECT_ID: "graphapp-dev" + VITE_FIREBASE_STORAGE_BUCKET: "graphapp-dev.appspot.com" + VITE_FIREBASE_MESSAGING_SENDER_ID: "897485812844" + VITE_FIREBASE_APP_ID: "1:897485812844:web:039de3b976c1559fded449" + # For Google Analytics + VITE_FIREBASE_MEASUREMENT_ID: "G-V2S9JPMH7S" + +jobs: + build_and_deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: yarn install && yarn build + - uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: "${{ secrets.GITHUB_TOKEN }}" + firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_GRAPHAPP_DEV }}" + channelId: live + projectId: graphapp-dev diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 2cce8761..6b8edeff 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -1,11 +1,24 @@ -# This file was auto-generated by the Firebase CLI -# https://github.com/firebase/firebase-tools +# Configuration for deploying to production on merge to main +# For more information, see https://github.com/marketplace/actions/deploy-to-firebase-hosting#options name: Deploy to Firebase Hosting on merge -'on': +"on": push: branches: - main + +env: + VITE_WARD_API_BASE_URL: https://wardanalyticsapi.com + VITE_WARD_API_KEY: ${{ secrets.WARD_API_KEY }} + VITE_FIREBASE_API_KEY: AIzaSyD1LUGU2RM-bhxKgeYdnzItbwBC0VSTOV0 + VITE_FIREBASE_AUTH_DOMAIN: graphapp-bca04.firebaseapp.com + VITE_FIREBASE_PROJECT_ID: graphapp-bca04 + VITE_FIREBASE_STORAGE_BUCKET: graphapp-bca04.appspot.com + VITE_FIREBASE_MESSAGING_SENDER_ID: "1030502540585" + VITE_FIREBASE_APP_ID: "1:1030502540585:web:cfe727695aad44d0494338" + # For Google Analytics + VITE_FIREBASE_MEASUREMENT_ID: G-RYB03B2Q13 + jobs: build_and_deploy: runs-on: ubuntu-latest @@ -14,7 +27,7 @@ jobs: - run: yarn install && yarn build - uses: FirebaseExtended/action-hosting-deploy@v0 with: - repoToken: '${{ secrets.GITHUB_TOKEN }}' - firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_GRAPHAPP_BCA04 }}' + repoToken: "${{ secrets.GITHUB_TOKEN }}" + firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_GRAPHAPP_BCA04 }}" channelId: live projectId: graphapp-bca04 diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index 0fcd0aa9..282f5328 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -1,8 +1,24 @@ -# This file was auto-generated by the Firebase CLI -# https://github.com/firebase/firebase-tools +# Configuration for deploy a preview of the PR to a temporary url +# The goal is to be able to test the PR before merging it +# This action is triggered on every PR, regardless of the branch +# The preview url has a lifetime of 7 days +# For more information, see https://github.com/marketplace/actions/deploy-to-firebase-hosting#options name: Deploy to Firebase Hosting on PR "on": pull_request + +env: + VITE_WARD_API_BASE_URL: "https://wardanalyticsapi.com" + VITE_WARD_API_KEY: ${{ secrets.WARD_API_KEY }} + VITE_FIREBASE_API_KEY: "AIzaSyD1LUGU2RM-bhxKgeYdnzItbwBC0VSTOV0" + VITE_FIREBASE_AUTH_DOMAIN: "graphapp-bca04.firebaseapp.com" + VITE_FIREBASE_PROJECT_ID: "graphapp-bca04" + VITE_FIREBASE_STORAGE_BUCKET: "graphapp-bca04.appspot.com" + VITE_FIREBASE_MESSAGING_SENDER_ID: "1030502540585" + VITE_FIREBASE_APP_ID: "1:1030502540585:web:cfe727695aad44d0494338" + # For Google Analytics + VITE_FIREBASE_MEASUREMENT_ID: "G-RYB03B2Q13" + jobs: build_and_preview: if: "${{ github.event.pull_request.head.repo.full_name == github.repository }}" @@ -14,4 +30,5 @@ jobs: with: repoToken: "${{ secrets.GITHUB_TOKEN }}" firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_GRAPHAPP_BCA04 }}" + expires: 7d projectId: graphapp-bca04 diff --git a/.gitignore b/.gitignore index b63cb8f3..ed96b29a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,13 +14,15 @@ dist-ssr build *.local .env +.env.development +.env.test +.env.production # Yarn installation state file .yarn/install-state.gz # Firebase .firebase/* -firebase.json .firebaserc # Editor directories and files diff --git a/firebase.json b/firebase.json new file mode 100644 index 00000000..340ed5b7 --- /dev/null +++ b/firebase.json @@ -0,0 +1,16 @@ +{ + "hosting": { + "public": "build", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], + "rewrites": [ + { + "source": "**", + "destination": "/index.html" + } + ] + } +} 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 40a3a247..d05c1224 100644 --- a/src/components/Graph/Graph.tsx +++ b/src/components/Graph/Graph.tsx @@ -49,6 +49,8 @@ import Legend from "./Legend"; import TransactionTooltip, { TransactionTooltipProps, } from "./TransactionTooltip"; +import { default as firebase } from "../../firebase/firebase" +import { logEvent } from "firebase/analytics"; /* Pan on drag settings */ const panOnDrag = [1, 2]; @@ -531,6 +533,17 @@ const Graph: FC = () => { } }, []); + const onSetSearchedAddress = (newAddress: string) => { + setSearchedAddresses([newAddress]); + + logEvent(firebase.analytics, "search_address", { + address: newAddress, + }); + + console.log("Searched address: ", newAddress); + console.log(firebase.analytics) + } + return (
{ className="fixed flex h-full w-full flex-col items-center justify-center" > { - setSearchedAddresses([address]); - }} + setSearchedAddress={onSetSearchedAddress} />