From 1a48f9456dcd2ca839a19dc3c14e3ef3d76c5acb Mon Sep 17 00:00:00 2001
From: Mohd Zishan <72738005+Zishan-7@users.noreply.github.com>
Date: Mon, 14 Oct 2024 18:12:40 +0530
Subject: [PATCH 1/2] Add feature flag for Google Login (#222)
---
.env.development | 1 +
src/onboarding/Login.jsx | 51 +++++++++++++-------------
src/onboarding/Register.jsx | 73 +++++++++++++++++++------------------
3 files changed, 64 insertions(+), 61 deletions(-)
diff --git a/.env.development b/.env.development
index 7230ecd1..bf526681 100644
--- a/.env.development
+++ b/.env.development
@@ -1,3 +1,4 @@
VITE_API_BASE_URL=http://localhost:3000
VITE_CLERK_PUBLISHABLE_KEY=pk_test_b3B0aW1hbC1jaGlja2VuLTU3LmNsZXJrLmFjY291bnRzLmRldiQ
+VITE_GOOGLE_REDIRECT_URL=https://optimal-chicken-57.clerk.accounts.dev/v1/oauth_callback
VITE_LOG_LEVEL=debug
diff --git a/src/onboarding/Login.jsx b/src/onboarding/Login.jsx
index c34032ff..32fb94e6 100644
--- a/src/onboarding/Login.jsx
+++ b/src/onboarding/Login.jsx
@@ -1,4 +1,4 @@
-import { Button, Input } from '@nextui-org/react';
+import { Button, Divider, Image, Input } from '@nextui-org/react';
import { Link, Navigate, useNavigate } from 'react-router-dom';
import { useSignIn, useUser } from '@clerk/clerk-react';
import { reduceState } from '../shared/helpers';
@@ -54,14 +54,13 @@ export default function Login() {
}
};
- // const handleGoogleLogin = async () => {
- // await signIn.authenticateWithRedirect({
- // strategy: 'oauth_google',
- // redirectUrl:
- // 'https://hip-primate-84.clerk.accounts.dev/v1/oauth_callback',
- // redirectUrlComplete: '/'
- // });
- // };
+ const handleGoogleLogin = async () => {
+ await signIn.authenticateWithRedirect({
+ strategy: 'oauth_google',
+ redirectUrl: import.meta.env.VITE_GOOGLE_REDIRECT_URL,
+ redirectUrlComplete: '/'
+ });
+ };
if (isSignedIn) {
return ;
@@ -78,8 +77,6 @@ export default function Login() {
- {/* */}
-
- {/* */}
- {/* }
- variant="bordered"
- >
- Continue with Google
- */}
+ {localStorage.getItem('isGoogleOAuthEnabled') && (
+
+ )}
+ {localStorage.getItem('isGoogleOAuthEnabled') && (
+ }
+ variant="bordered"
+ >
+ Continue with Google
+
+ )}
*/}
+ {localStorage.getItem('isGoogleOAuthEnabled') && (
+ }
+ variant="bordered"
+ >
+ Continue with Google
+
+ )}
Date: Mon, 14 Oct 2024 14:48:32 -0700
Subject: [PATCH 2/2] add VITE_CLERK_PUBLISHABLE_KEY and refine terraform code
for release (#220)
---
terraform/Amplify/main.tf | 33 ++++++++++++++++++++++++++++++++-
terraform/Amplify/output.tf | 8 ++++++++
2 files changed, 40 insertions(+), 1 deletion(-)
create mode 100644 terraform/Amplify/output.tf
diff --git a/terraform/Amplify/main.tf b/terraform/Amplify/main.tf
index 2daed176..1ed102b9 100644
--- a/terraform/Amplify/main.tf
+++ b/terraform/Amplify/main.tf
@@ -1,5 +1,5 @@
resource "aws_amplify_app" "main" {
- name = "restaking-dashboard"
+ name = "restaking-dashboard-app"
repository = "https://github.com/NethermindEth/restaking-dashboard"
environment_variables = {
@@ -16,11 +16,21 @@ resource "aws_amplify_app" "main" {
status = "200"
target = "/index.html"
}
+
}
resource "aws_amplify_branch" "main" {
app_id = aws_amplify_app.main.id
branch_name = "main"
+ stage = "DEVELOPMENT"
+
+ enable_auto_build = false
+}
+
+# Release branch for production environment
+resource "aws_amplify_branch" "release" {
+ app_id = aws_amplify_app.main.id
+ branch_name = "release/v0.1.0"
stage = "PRODUCTION"
enable_auto_build = false
@@ -37,6 +47,21 @@ resource "aws_amplify_domain_association" "main" {
branch_name = aws_amplify_branch.main.branch_name
prefix = "stage"
}
+
+ # add this for pre-production domain
+ # https://prod.restaking.info
+ sub_domain {
+ branch_name = aws_amplify_branch.release.branch_name
+ prefix = "prod"
+ }
+
+ # add this for production domain
+ # https://restaking.info
+ sub_domain {
+ branch_name = aws_amplify_branch.release.branch_name
+ prefix = ""
+ }
+
}
@@ -46,3 +71,9 @@ resource "aws_amplify_webhook" "stage" {
description = "stage"
}
+
+resource "aws_amplify_webhook" "release" {
+ app_id = aws_amplify_app.main.id
+ branch_name = aws_amplify_branch.release.branch_name
+ description = "release"
+}
diff --git a/terraform/Amplify/output.tf b/terraform/Amplify/output.tf
new file mode 100644
index 00000000..467073b5
--- /dev/null
+++ b/terraform/Amplify/output.tf
@@ -0,0 +1,8 @@
+
+output "aws_amplify_domain_association" {
+ value = aws_amplify_domain_association.main.sub_domain
+}
+
+output "aws_amplify_webhook"{
+value = aws_amplify_webhook.stage.url
+}