diff --git a/Makefile b/Makefile index cc51e645..71a1d846 100644 --- a/Makefile +++ b/Makefile @@ -98,11 +98,3 @@ test-e2e-exec: test-e2e-up: $(TEST_E2E_DOCKER_COMPOSE) up -d -.PHONY: deploy -deploy: - cd client && \ - export GATSBY_GRAPHQL_ENDPOINT=https://api.devmentorpal.org/graphql/graphql && \ - export GATSBY_STAGE=dev && \ - npm run build && \ - aws s3 sync ./public/ s3://mentorpal-us-east-1-newdev-mentorpal-origin/chat && \ - aws cloudfront create-invalidation --distribution-id E6VOL8BYUVNWS --paths "/chat*" diff --git a/cicd/deployspec-dev.yml b/cicd/deployspec-dev.yml index 804cefc0..94e2fd10 100644 --- a/cicd/deployspec-dev.yml +++ b/cicd/deployspec-dev.yml @@ -7,8 +7,6 @@ env: GATSBY_STAGE: 'dev' GATSBY_IS_SENTRY_ENABLED: false parameter-store: - S3_DEPLOY_BUCKET_NEWDEV: "/mentorpal/newdev/s3-websites/NAME" - CDN_ID_NEWDEV: "/mentorpal/newdev/CLOUDFRONT_DISTRIBUTION_ID" S3_DEPLOY_BUCKET_DEV: "/devmentorpal/s3-websites/NAME" CDN_ID_DEV: "/devmentorpal/CLOUDFRONT_DISTRIBUTION_ID" @@ -22,9 +20,6 @@ phases: build: commands: - cd client && npm run build - - echo Deploying to $S3_DEPLOY_BUCKET_NEWDEV - - aws s3 sync ./public s3://$S3_DEPLOY_BUCKET_NEWDEV/chat - - aws cloudfront create-invalidation --distribution-id $CDN_ID_NEWDEV --paths "/chat*" - echo Deploying to $S3_DEPLOY_BUCKET_DEV - aws s3 sync ./public s3://$S3_DEPLOY_BUCKET_DEV/chat - aws cloudfront create-invalidation --distribution-id $CDN_ID_DEV --paths "/chat*" diff --git a/cicd/deployspec-prod.yml b/cicd/deployspec-prod.yml index 64c51e63..dabf61b7 100644 --- a/cicd/deployspec-prod.yml +++ b/cicd/deployspec-prod.yml @@ -4,11 +4,9 @@ env: variables: GATSBY_GRAPHQL_ENDPOINT: 'https://api.mentorpal.org/graphql/graphql' GATSBY_NPCEDITOR_ENDPOINT: 'https://api.mentorpal.org/npceditor' - GATSBY_STAGE: 'cf' + GATSBY_STAGE: 'prod' GATSBY_IS_SENTRY_ENABLED: true parameter-store: - S3_DEPLOY_BUCKET_CF: "/mentorpal/cf/s3-websites/NAME" - CDN_ID_CF: "/mentorpal/cf/CLOUDFRONT_DISTRIBUTION_ID" S3_DEPLOY_BUCKET: "/mentorpal/s3-websites/NAME" CDN_ID: "/mentorpal/CLOUDFRONT_DISTRIBUTION_ID" @@ -22,9 +20,6 @@ phases: build: commands: - cd client && npm run build - - echo Deploying to $S3_DEPLOY_BUCKET_CF - - aws s3 sync ./public s3://$S3_DEPLOY_BUCKET_CF/chat - - aws cloudfront create-invalidation --distribution-id $CDN_ID_CF --paths "/chat*" - echo Deploying to $S3_DEPLOY_BUCKET - aws s3 sync ./public s3://$S3_DEPLOY_BUCKET/chat - aws cloudfront create-invalidation --distribution-id $CDN_ID --paths "/chat*" diff --git a/cicd/deployspec-qa.yml b/cicd/deployspec-qa.yml index 9866d6db..6dd0725a 100644 --- a/cicd/deployspec-qa.yml +++ b/cicd/deployspec-qa.yml @@ -4,11 +4,9 @@ env: variables: GATSBY_GRAPHQL_ENDPOINT: 'https://api.qamentorpal.org/graphql/graphql' GATSBY_NPCEDITOR_ENDPOINT: 'https://api.qamentorpal.org/npceditor' - GATSBY_STAGE: 'v2' + GATSBY_STAGE: 'qa' GATSBY_IS_SENTRY_ENABLED: true parameter-store: - S3_DEPLOY_BUCKET_V2: "/mentorpal/v2/s3-websites/NAME" - CDN_ID_V2: "/mentorpal/v2/CLOUDFRONT_DISTRIBUTION_ID" S3_DEPLOY_BUCKET_QA: "/qamentorpal/s3-websites/NAME" CDN_ID_QA: "/qamentorpal/CLOUDFRONT_DISTRIBUTION_ID" @@ -22,9 +20,6 @@ phases: build: commands: - cd client && npm run build - - echo Deploying to $S3_DEPLOY_BUCKET_V2 - - aws s3 sync ./public s3://$S3_DEPLOY_BUCKET_V2/chat - - aws cloudfront create-invalidation --distribution-id $CDN_ID_V2 --paths "/chat*" - echo Deploying to $S3_DEPLOY_BUCKET_QA - aws s3 sync ./public s3://$S3_DEPLOY_BUCKET_QA/chat - aws cloudfront create-invalidation --distribution-id $CDN_ID_QA --paths "/chat*" diff --git a/client/Makefile b/client/Makefile index 9ba3713c..308b6fc4 100644 --- a/client/Makefile +++ b/client/Makefile @@ -14,7 +14,7 @@ clean: .PHONY: develop develop: .env.development node_modules/gatsby - npx gatsby develop -p 8000 + npx gatsby develop -p 80 .PHONY: format format: diff --git a/client/src/api.ts b/client/src/api.ts index 787ab97d..91fe3d04 100644 --- a/client/src/api.ts +++ b/client/src/api.ts @@ -5,6 +5,7 @@ Permission to use, copy, modify, and distribute this software and its documentat The full terms of this copyright and license should always be found in the root directory of this software deliverable as "license.txt" and if these terms are not found with this software, please contact the USC Stevens Center for the full license. */ import axios, { AxiosResponse } from "axios"; +import { LS_LEFT_HOME_PAGE } from "local-constants"; import { Utterance, Config, @@ -21,6 +22,7 @@ import { UtteranceGQL, convertUtteranceGQL, } from "types-gql"; +import { getLocalStorage } from "utils"; export const GATSBY_GRAPHQL_ENDPOINT = process.env.GATSBY_GRAPHQL_ENDPOINT || "/graphql"; @@ -170,12 +172,13 @@ export async function fetchMentor( accessToken: string, subjectId?: string ): Promise { + const leftHomePageData = getLocalStorage(LS_LEFT_HOME_PAGE); const gqlRes = await axios.post>( GATSBY_GRAPHQL_ENDPOINT, { query: ` - query FetchMentor($mentor: ID!, $subject: ID) { - mentorClientData(mentor: $mentor, subject: $subject) { + query FetchMentor($mentor: ID!, $subject: ID, $leftHomePageData: String!) { + mentorClientData(mentor: $mentor, subject: $subject, leftHomePageData: $leftHomePageData) { _id name title @@ -218,6 +221,7 @@ export async function fetchMentor( variables: { mentor: mentorId, subject: subjectId, + leftHomePageData: leftHomePageData, }, }, { diff --git a/client/src/local-constants.ts b/client/src/local-constants.ts index dd53c789..89cf081b 100644 --- a/client/src/local-constants.ts +++ b/client/src/local-constants.ts @@ -18,6 +18,7 @@ export const LS_X_API_EMAIL_KEY = "xapiUserEmail"; // Other export const REFERRER_KEY = "referrer"; export const EVENTS_KEY = "events"; +export const LS_LEFT_HOME_PAGE = "leftHomePage"; // Survey Popup export const TIMER_TEXT_KEY = "timertext"; diff --git a/client/src/pages/index.tsx b/client/src/pages/index.tsx index 5612da34..06897cfe 100644 --- a/client/src/pages/index.tsx +++ b/client/src/pages/index.tsx @@ -535,7 +535,9 @@ function IndexPage(props: { }); updateLocalStorageUserData(newUserData); } - + if (typeof window !== "undefined") { + console.log(document.referrer); + } return (