Skip to content

Commit

Permalink
Merge branch 'main' into bugfix/responsiveness-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodriguespn authored Jan 15, 2024
2 parents ea7639d + 3020012 commit d7cd326
Show file tree
Hide file tree
Showing 10 changed files with 148 additions and 13 deletions.
12 changes: 11 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
VITE_WARD_API_BASE_URL=https://wardanalyticsapi.com
VITE_WARD_API_KEY=
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=
33 changes: 33 additions & 0 deletions .github/workflows/firebase-dev-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -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
23 changes: 18 additions & 5 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
21 changes: 19 additions & 2 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -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 }}"
Expand All @@ -14,4 +30,5 @@ jobs:
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_GRAPHAPP_BCA04 }}"
expires: 7d
projectId: graphapp-bca04
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
1 change: 1 addition & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
17 changes: 14 additions & 3 deletions src/components/Graph/Graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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 (
<div className="h-full w-full overflow-hidden">
<Transition
Expand All @@ -542,9 +555,7 @@ const Graph: FC = () => {
className="fixed flex h-full w-full flex-col items-center justify-center"
>
<LandingPage
setSearchedAddress={(address: string) => {
setSearchedAddresses([address]);
}}
setSearchedAddress={onSetSearchedAddress}
/>
</Transition>
<Transition
Expand Down
32 changes: 32 additions & 0 deletions src/firebase/firebase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Import the functions you need from the SDKs you need
import { Analytics, getAnalytics } from "firebase/analytics";
import { FirebaseApp, initializeApp } from "firebase/app";

const {
VITE_FIREBASE_API_KEY: apiKey,
VITE_FIREBASE_AUTH_DOMAIN: authDomain,
VITE_FIREBASE_PROJECT_ID: projectId,
VITE_FIREBASE_STORAGE_BUCKET: storageBucket,
VITE_FIREBASE_MESSAGING_SENDER_ID: messagingSenderId,
VITE_FIREBASE_APP_ID: appId,
VITE_FIREBASE_MEASUREMENT_ID: measurementId,
} = import.meta.env;

const firebaseConfig = {
apiKey: apiKey,
authDomain: authDomain,
projectId: projectId,
storageBucket: storageBucket,
messagingSenderId: messagingSenderId,
appId: appId,
measurementId: measurementId,
};

// Initialize Firebase
const app: FirebaseApp = initializeApp(firebaseConfig);
const analytics: Analytics = getAnalytics(app);

export default {
app,
analytics,
};
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3007,7 +3007,7 @@ [email protected], find-up@^5.0.0:

firebase@^10.7.1:
version "10.7.1"
resolved "https://registry.npmjs.org/firebase/-/firebase-10.7.1.tgz"
resolved "https://registry.yarnpkg.com/firebase/-/firebase-10.7.1.tgz#71fa17a10146f388746ecc216a3e1e477a7bf9b5"
integrity sha512-Mlt7y7zQ43FtKp4SCyYie3tnrOL3UMF2XXiV4ZXMrC0d0wtcOYmABuybhkJpJCKILpdekxr39wjnaai0DZlWFg==
dependencies:
"@firebase/analytics" "0.10.0"
Expand Down

0 comments on commit d7cd326

Please sign in to comment.