From f257b9a4b0683d1e9c097bd0f685e2e51449da7a Mon Sep 17 00:00:00 2001 From: tejaskh3 Date: Sat, 4 Jan 2025 22:26:54 +0530 Subject: [PATCH 1/7] resolve merge commits --- app/constants/urls.js | 1 + app/router.js | 1 + app/routes/identity.js | 29 +++++++++++++++++++++++++++++ app/templates/identity.hbs | 3 +++ app/utils/redirect-auth.js | 9 +++++++++ 5 files changed, 43 insertions(+) create mode 100644 app/routes/identity.js create mode 100644 app/templates/identity.hbs create mode 100644 app/utils/redirect-auth.js diff --git a/app/constants/urls.js b/app/constants/urls.js index 019846c3..cb2d3413 100644 --- a/app/constants/urls.js +++ b/app/constants/urls.js @@ -71,6 +71,7 @@ export const AUTH = { GOOGLE_SIGN_IN: `${APPS.API_BACKEND}/auth/google/login?dev=true`, SIGN_UP: `${APPS.PROFILE}/new-signup`, }; +export const AUTH_URL = `https://github.com/login/oauth/authorize?client_id=23c78f66ab7964e5ef97`; export const SOCIALS = { LINKEDIN: { diff --git a/app/router.js b/app/router.js index 47338ac7..ae71582e 100644 --- a/app/router.js +++ b/app/router.js @@ -17,4 +17,5 @@ Router.map(function () { this.route('debug'); this.route('subscribe'); this.route('login'); + this.route('identity'); }); diff --git a/app/routes/identity.js b/app/routes/identity.js new file mode 100644 index 00000000..3b9dc7a6 --- /dev/null +++ b/app/routes/identity.js @@ -0,0 +1,29 @@ +import Route from '@ember/routing/route'; +import { service } from '@ember/service'; +import { TOAST_OPTIONS } from '../constants/toast-options'; +import redirectAuth from '../utils/redirect-auth'; + +export default class IdentityRoute extends Route { + @service toast; + @service login; + @service router; + + async model() { + try { + if (!this.login.isLoggedIn) { + throw new Error('You are not logged in. Please login to continue.'); + } + + const userData = this.login.userData; + if (!userData.in_discord) { + this.router.transitionTo('/'); + } + return userData; + } catch (error) { + console.error('Error fetching user data on identity route', error); + this.toast.error(error, '', TOAST_OPTIONS); + // added setTimeout here because before new page opens user should be notified of error by toast + setTimeout(redirectAuth, 2000); + } + } +} diff --git a/app/templates/identity.hbs b/app/templates/identity.hbs new file mode 100644 index 00000000..707849ae --- /dev/null +++ b/app/templates/identity.hbs @@ -0,0 +1,3 @@ +
+ hello +
\ No newline at end of file diff --git a/app/utils/redirect-auth.js b/app/utils/redirect-auth.js new file mode 100644 index 00000000..11de3fcb --- /dev/null +++ b/app/utils/redirect-auth.js @@ -0,0 +1,9 @@ +import { AUTH_URL } from '../constants/urls'; + +export default function () { + let authUrl = AUTH_URL; + if (typeof window !== 'undefined') { + authUrl = `${authUrl}&state=${window.location.href}`; + } + window.open(authUrl, '_self'); +} From be6229be63d1aacede56b1d81952c78e2adf0027 Mon Sep 17 00:00:00 2001 From: tejaskh3 Date: Sat, 4 Jan 2025 23:47:28 +0530 Subject: [PATCH 2/7] feat: add get started page --- .DS_Store | Bin 0 -> 8196 bytes app/components/identity/get-started.hbs | 16 ++ app/controllers/identity.js | 33 +++ app/routes/identity.js | 28 +-- app/styles/app.css | 2 + app/styles/identity.module.css | 202 ++++++++++++++++++ app/templates/identity.hbs | 36 +++- app/utils/redirect-auth.js | 16 +- public/.DS_Store | Bin 0 -> 6148 bytes public/assets/.DS_Store | Bin 0 -> 6148 bytes public/assets/images/.DS_Store | Bin 0 -> 8196 bytes public/assets/images/identity/closeeye.svg | 4 + public/assets/images/identity/copy.svg | 3 + public/assets/images/identity/footer.svg | 3 + public/assets/images/identity/header-hero.svg | 9 + public/assets/images/identity/header.svg | 3 + public/assets/images/identity/hero.svg | 9 + public/assets/images/identity/logo.svg | 9 + public/assets/images/identity/openeye.svg | 3 + 19 files changed, 338 insertions(+), 38 deletions(-) create mode 100644 .DS_Store create mode 100644 app/components/identity/get-started.hbs create mode 100644 app/controllers/identity.js create mode 100644 app/styles/identity.module.css create mode 100644 public/.DS_Store create mode 100644 public/assets/.DS_Store create mode 100644 public/assets/images/.DS_Store create mode 100644 public/assets/images/identity/closeeye.svg create mode 100644 public/assets/images/identity/copy.svg create mode 100644 public/assets/images/identity/footer.svg create mode 100644 public/assets/images/identity/header-hero.svg create mode 100644 public/assets/images/identity/header.svg create mode 100644 public/assets/images/identity/hero.svg create mode 100644 public/assets/images/identity/logo.svg create mode 100644 public/assets/images/identity/openeye.svg diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..66239c84a9c40e97571db717e3edbb0e35757f99 GIT binary patch literal 8196 zcmeHM-EI;=6h2dESyHRS)TB2in|RwIZH=+<25E_D;!jelUZ}xcptyF~AuN=brU}>j z4!(l7K8f$*m40VtN_H2xHAZI0oNs>4nV)aY>~esJL~YdGCE6k)2br<74lyTjKj)dW zVp=wV0`??Zekgs^N;A5)!7^YOunbrRECZH-e}e(MvpG2n-ut@OO3Q#{U?~~k=YxyP zST#7&s2&{dQaSHTn~c+MI-% z8RM9lg^5sv2|a|X)Jaq|T4@=u49qgXv3rg@>QnzXOvUd{&{O`ck}@+|{y6TNDF27w z4}*AEsr(cxx%}!{!6`WF&ilqkIc^NS;V7bJts_5Lg zcmMH8^E~WD@{8W4Fpmn_(DkYOijvvQMPm?!GU}p*wb!Uck|H{zfVvqzzN0_M$1OUf zm-K>8>4c7{Mz2shM*S(3sYmU!wYZzH&Qlw6#5Bz4@!FEJ+@=mj^C1VcgVlww+ChB; z3^7KTK2e+*<5y-32mA4OF4#$YGIOr*?$dK-^f6cTFz-dYF(4i)H;?fAbbY?hVUek7caMGf4$S(BN zo@Q4kn9HQy8g9x6Jn}iT(rZ&ZF4X-`?oDd{ncGvuO{l{Yj_5gX&Mjas5jPWFQiM<9 ztd#7{^JVsql*Q`QBJ1_IVJXcbea6`i;2&k2mgKWepO=77q%3gMHdzLihJl>k>DD^1 zzWDe5rQySF)H1M)42b+uiFlEAUHi~IqZ6YEVhDia75jssOV4xIjBh_VY+ cwy7GNXhaLrU;iOs`VXaj|EmMAVksH;1E&;dxc~qF literal 0 HcmV?d00001 diff --git a/app/components/identity/get-started.hbs b/app/components/identity/get-started.hbs new file mode 100644 index 00000000..03877160 --- /dev/null +++ b/app/components/identity/get-started.hbs @@ -0,0 +1,16 @@ +
Qualification + Criteria
+
+ To update your profile details, link your profile service URL with + RealDevSquad Service.
+ Profile Service Template: + https://github.com/Real-Dev-Squad/sample-profile-service +
+ \ No newline at end of file diff --git a/app/controllers/identity.js b/app/controllers/identity.js new file mode 100644 index 00000000..49bb7347 --- /dev/null +++ b/app/controllers/identity.js @@ -0,0 +1,33 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; +import { tracked } from '@glimmer/tracking'; +import { action } from '@ember/object'; + +export default class IdentityController extends Controller { + @service login; + + @tracked userData = null; + @tracked state = 'getStarted'; + + constructor() { + super(...arguments); + this.userData = this.login.userData; + this.state = this.initialState; + } + + get initialState() { + if (this.userData?.profileStatus === 'PENDING') { + return 'reload'; + } else if (this.userData?.profileStatus === 'VERIFIED') { + return 'verified'; + } else if (this.userData?.profileStatus === 'BLOCKED') { + return 'blocked'; + } + return 'getStarted'; + } + + @action + setState(newState) { + this.state = newState; + } +} diff --git a/app/routes/identity.js b/app/routes/identity.js index 3b9dc7a6..91162325 100644 --- a/app/routes/identity.js +++ b/app/routes/identity.js @@ -1,29 +1,3 @@ import Route from '@ember/routing/route'; -import { service } from '@ember/service'; -import { TOAST_OPTIONS } from '../constants/toast-options'; -import redirectAuth from '../utils/redirect-auth'; -export default class IdentityRoute extends Route { - @service toast; - @service login; - @service router; - - async model() { - try { - if (!this.login.isLoggedIn) { - throw new Error('You are not logged in. Please login to continue.'); - } - - const userData = this.login.userData; - if (!userData.in_discord) { - this.router.transitionTo('/'); - } - return userData; - } catch (error) { - console.error('Error fetching user data on identity route', error); - this.toast.error(error, '', TOAST_OPTIONS); - // added setTimeout here because before new page opens user should be notified of error by toast - setTimeout(redirectAuth, 2000); - } - } -} +export default class IdentityRoute extends Route {} diff --git a/app/styles/app.css b/app/styles/app.css index 2ce11118..37eb26f6 100644 --- a/app/styles/app.css +++ b/app/styles/app.css @@ -44,6 +44,8 @@ @import url("subscribe.module.css"); @import url("phone-input.module.css"); @import url("login.module.css"); +@import url("identity.module.css"); +@import url("get-started.module.css"); * { margin: 0; diff --git a/app/styles/identity.module.css b/app/styles/identity.module.css new file mode 100644 index 00000000..403ae1db --- /dev/null +++ b/app/styles/identity.module.css @@ -0,0 +1,202 @@ +@import url("https://fonts.googleapis.com/css2?family=Hanuman:wght@700&family=Inter:wght@400;700&display=swap"); + +.identity-page { + height: 91.5vh; + position: relative; + display: flex; + flex-direction: column; + align-items: center; +} + +.identity-hero { + width: 25%; + position: absolute; + left: 0; + bottom: 0; + z-index: 1; +} + +.identity-heading { + font-family: Hanuman, serif; + color: #000; + text-align: center; + font-size: 28px; + font-style: normal; + font-weight: 700; + line-height: normal; +} + +.identity-box { + position: relative; + height: 252px; + width: 656px; + max-width: 90%; + margin-top: 24px; + border-radius: 47px; + border: 1px solid rgb(0 0 0 / 25%); + background: #fff; + box-shadow: 3px 3px 3px 0 rgb(0 0 0 / 25%); + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + padding: 20px; +} + +.identity-box-heading { + color: #1d1283; + text-align: center; + font-family: Inter, sans-serif; + font-size: 26px; + font-style: normal; + font-weight: 700; + line-height: normal; + margin-bottom: 12px; +} + +.identity-box-desc { + color: #000; + font-family: Inter, sans-serif; + font-size: 21px; + font-style: normal; + font-weight: 400; + line-height: normal; + text-align: center; +} + +.identity-box-desc-bold { + color: #000; + font-family: Inter, sans-serif; + font-size: 17px; + font-style: normal; + font-weight: 700; + line-height: normal; +} + +.identity-box-desc-a { + color: #0000af; + font-family: Inter, sans-serif; + font-size: 15px; + font-style: normal; + font-weight: 400; + line-height: normal; +} + +.identity-rds-logo { + width: 214px; + margin-top: 6%; +} + +.identity-header-hero { + position: absolute; + right: 22px; + top: 32px; +} + +.identity-header { + position: absolute; + width: 100%; + z-index: 0; +} + +.identity-footer { + bottom: 0; + position: absolute; +} + +.identity-box-button { + padding: 12px; + border-radius: 15px; + background: #1d1283; + color: #fff; + text-align: center; + font-family: Inter, sans-serif; + font-size: 18px; + font-style: normal; + font-weight: 700; + line-height: normal; + margin-top: 20px; +} + +@media (width <= 460px) { + .identity-box-button { + font-size: 12px; + padding: 8px; + border-radius: 8px; + } + + .identity-hero { + width: 50%; + } + + .identity-box { + border-radius: 25px; + } + + .identity-rds-logo { + margin-top: 5%; + margin-bottom: 0; + height: 100px; + width: 100px; + } + + .identity-header-hero { + position: absolute; + width: 20%; + right: 12px; + top: 8px; + } + + .identity-box-heading { + font-size: 16px; + } + + .identity-box-desc { + font-size: 12px; + } + + .identity-heading { + font-size: 16px; + max-width: 90%; + line-height: normal; + margin-top: 8px; + } + + .identity-box-desc-bold { + font-size: 12px; + } + + .identity-box-desc-a { + font-size: 12px; + } +} + +@media (height <= 870px) and (width >= 460px) { + .identity-rds-logo { + width: 174px; + margin-top: 3%; + } + + .identity-heading { + font-size: 24px; + } + + .identity-box { + height: 202px; + padding-top: 12px; + } + + .identity-box-heading { + font-size: 22px; + } + + .identity-box-desc { + font-size: 18px; + } + + .identity-box-button { + padding: 10px; + font-size: 16px; + margin-top: 18px; + } +} diff --git a/app/templates/identity.hbs b/app/templates/identity.hbs index 707849ae..d5b0f001 100644 --- a/app/templates/identity.hbs +++ b/app/templates/identity.hbs @@ -1,3 +1,33 @@ -
- hello -
\ No newline at end of file +{{page-title "Identity"}} + +
+ header + hero + + + {{#if (eq this.initialState "getStarted")}} +
+ Connect your Profile Service with Identity Service +
+ {{/if}} + +
+ {{#if (eq this.state "getStarted")}} + + {{/if}} +
+ + header-hero + footer +
+ diff --git a/app/utils/redirect-auth.js b/app/utils/redirect-auth.js index 11de3fcb..5daae60f 100644 --- a/app/utils/redirect-auth.js +++ b/app/utils/redirect-auth.js @@ -1,9 +1,9 @@ -import { AUTH_URL } from '../constants/urls'; +// import { AUTH_URL } from '../constants/urls'; -export default function () { - let authUrl = AUTH_URL; - if (typeof window !== 'undefined') { - authUrl = `${authUrl}&state=${window.location.href}`; - } - window.open(authUrl, '_self'); -} +// export default function () { +// let authUrl = AUTH_URL; +// if (typeof window !== 'undefined') { +// authUrl = `${authUrl}&state=${window.location.href}`; +// } +// window.open(authUrl, '_self'); +// } diff --git a/public/.DS_Store b/public/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..227e2a173a2eef73be4c83841506abe521d81593 GIT binary patch literal 6148 zcmeHKO;6iE5SL=A;m7pK zFX8XdH@lk(D{zIVnz3fz?Cgxae!JQaB2t}UZ;Pl&L>`o}) zFD@;6%ifCjGrZKJu!xFb-iZdMT>Gwd8c*#g{*m-Y-R9aCofT1%^#>*)>GctEc9LX0 zJ?iLT*2_(9XdAqS*XTCa$K&mTcFW({+Ml%i@xeCi-JQM3q~U%1w0ZcgdzD^i`p)#4 z6y~RqRfki!hf(>b+i;MjI=g_Mb3V|3G{sPGLmMc6Q}Jw$Ge>`*&pAR>L>LeTgn_wc zz^#ei%3SwSIwuSW1Mk5AuMa+yF>qK~G)o5xa|HnMG13TZJ`!<`?=Wy!T0{#(*;JrS zRql$RY&!hDiwhi<7Hv8ycll86%gWtQl=(W|@0)N^fki2W0b!uZz=EwddH?_V`u)F} zBsF0`82GOkQ1zqmsDoc}d+W^4@m}jge?eI|uC(|s1%}y*5zAZgI@AdKJ{!QmVQCQ_ Ph#UkA4N?dLZ_2=5HPdFE literal 0 HcmV?d00001 diff --git a/public/assets/.DS_Store b/public/assets/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..8fc71db8e9ebcb0fdaf0d19243f7878eb39417b3 GIT binary patch literal 6148 zcmeHKO>fgc5S>la)KP>KB#?TkWU1G-q#r_5TufRHT?b_=lBGsPs_KBKAk6_=?2 zl{rV3G-b3$33XT4lK3AL;IV7aM~djmjN0w^={KqF#;K0M;OX%SzW37@BBJ#he!j%~ zw#2M~Im8tP)Tbq`+PaGyPxFzxgYWSuP4c4E`k^Xo)%Dtjx8XIs%kYz)hDB6N@^&H0^7{Y!@B9D7BI$_&qQHYvKvhq} z(>5N-t*t8$$7`(*{{UxWUTN{B1c6zK!R4iR6K)K7p95gvu(XH_OnwB64AO`K|5Slr D9iD*D literal 0 HcmV?d00001 diff --git a/public/assets/images/.DS_Store b/public/assets/images/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e74af0bd0178d208126e55c7a2b9af1c3fa3097f GIT binary patch literal 8196 zcmeHMzi$&U6n;+A_M(7Dph#JePGW6J(pHFyC4?}r5(ERFkV`^x>g62rgMgw)nPFvS zWn|?qU}j?EUtnf}@7X3?a~A;%qQb81@6PwWXZ!Q>IldB+s7~5tq5=^)$c(uxiiE_^ zImc4U)Z~Eze4^3qK(@R|^(Mw5v{7t~~ zX-qHH_;|JA!+|yTA_PbAR@(du`!|tM#_YZ6Xkfl-y!QryKN^=xpG0aSy}7mRY&%)! zQN1Up^>K4N8C9FZ2Yh!|%E0?^-SqDHooOStb5n-nrXO~Oir}|9FnM_258HBDm6NbN zQrxicEMn#9Hxbj$UY><^Y!2{wIMtC_JopWl8Ne0=?Zqax<3FWbLmH|YJk&1dyt7|5`T zc6dBHm~%-U<}Sc27IDYXdW>tHPsGrgIN*7WMsF4o$C32JcuI`G6t@~><>@IRu7lX+ z)+E~d*@Hw6YSl#J>0B)Ki?mPAlY6b!QIvfq#!hTit(+(?PgC?dFsp`j^ObU4)Fyl2 z7>Rmd?OkNXiou0OuHt&N3j^)`&w|)w6*xr-Z0Nog`22rs{rCS + + + diff --git a/public/assets/images/identity/copy.svg b/public/assets/images/identity/copy.svg new file mode 100644 index 00000000..57829ce6 --- /dev/null +++ b/public/assets/images/identity/copy.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/assets/images/identity/footer.svg b/public/assets/images/identity/footer.svg new file mode 100644 index 00000000..4db6119c --- /dev/null +++ b/public/assets/images/identity/footer.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/assets/images/identity/header-hero.svg b/public/assets/images/identity/header-hero.svg new file mode 100644 index 00000000..17888ed0 --- /dev/null +++ b/public/assets/images/identity/header-hero.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/public/assets/images/identity/header.svg b/public/assets/images/identity/header.svg new file mode 100644 index 00000000..4890d550 --- /dev/null +++ b/public/assets/images/identity/header.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/assets/images/identity/hero.svg b/public/assets/images/identity/hero.svg new file mode 100644 index 00000000..62cace42 --- /dev/null +++ b/public/assets/images/identity/hero.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/public/assets/images/identity/logo.svg b/public/assets/images/identity/logo.svg new file mode 100644 index 00000000..6d03df9a --- /dev/null +++ b/public/assets/images/identity/logo.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/public/assets/images/identity/openeye.svg b/public/assets/images/identity/openeye.svg new file mode 100644 index 00000000..40220d51 --- /dev/null +++ b/public/assets/images/identity/openeye.svg @@ -0,0 +1,3 @@ + + + From 8cfeb14b9fb454866d6ca672a86143910e430a4e Mon Sep 17 00:00:00 2001 From: tejaskh3 Date: Sat, 4 Jan 2025 23:53:12 +0530 Subject: [PATCH 3/7] remove: unused auth url --- app/constants/urls.js | 1 - app/utils/redirect-auth.js | 9 --------- 2 files changed, 10 deletions(-) delete mode 100644 app/utils/redirect-auth.js diff --git a/app/constants/urls.js b/app/constants/urls.js index cb2d3413..019846c3 100644 --- a/app/constants/urls.js +++ b/app/constants/urls.js @@ -71,7 +71,6 @@ export const AUTH = { GOOGLE_SIGN_IN: `${APPS.API_BACKEND}/auth/google/login?dev=true`, SIGN_UP: `${APPS.PROFILE}/new-signup`, }; -export const AUTH_URL = `https://github.com/login/oauth/authorize?client_id=23c78f66ab7964e5ef97`; export const SOCIALS = { LINKEDIN: { diff --git a/app/utils/redirect-auth.js b/app/utils/redirect-auth.js deleted file mode 100644 index 5daae60f..00000000 --- a/app/utils/redirect-auth.js +++ /dev/null @@ -1,9 +0,0 @@ -// import { AUTH_URL } from '../constants/urls'; - -// export default function () { -// let authUrl = AUTH_URL; -// if (typeof window !== 'undefined') { -// authUrl = `${authUrl}&state=${window.location.href}`; -// } -// window.open(authUrl, '_self'); -// } From ac93d6538f8ce4a3b36357a44276ca786f287a24 Mon Sep 17 00:00:00 2001 From: tejaskh3 Date: Sun, 5 Jan 2025 00:01:33 +0530 Subject: [PATCH 4/7] fix: css for get started on identity page --- app/styles/app.css | 1 - 1 file changed, 1 deletion(-) diff --git a/app/styles/app.css b/app/styles/app.css index 37eb26f6..9c7d3d6c 100644 --- a/app/styles/app.css +++ b/app/styles/app.css @@ -45,7 +45,6 @@ @import url("phone-input.module.css"); @import url("login.module.css"); @import url("identity.module.css"); -@import url("get-started.module.css"); * { margin: 0; From d9ed93b8676fb1d8095364cc4d8483a3bc21931a Mon Sep 17 00:00:00 2001 From: tejaskh3 Date: Sun, 5 Jan 2025 00:36:31 +0530 Subject: [PATCH 5/7] feat: add identity page behind feature flag --- app/routes/identity.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/routes/identity.js b/app/routes/identity.js index 91162325..e9fe8671 100644 --- a/app/routes/identity.js +++ b/app/routes/identity.js @@ -1,3 +1,11 @@ import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; +export default class IdentityRoute extends Route { + @service router; -export default class IdentityRoute extends Route {} + beforeModel(transition) { + if (transition?.to?.queryParams?.dev !== 'true') { + this.router.transitionTo('/page-not-found'); + } + } +} From 774b0e00fffec89effb3b4a430baba4e9bedf2bf Mon Sep 17 00:00:00 2001 From: tejaskh3 Date: Sun, 5 Jan 2025 00:55:35 +0530 Subject: [PATCH 6/7] feat: setp1 page in identity linking --- app/components/identity/step1.hbs | 45 ++++++++++++++ app/components/identity/step1.js | 78 ++++++++++++++++++++++++ app/styles/identity.module.css | 99 +++++++++++++++++++++++++++++++ app/templates/identity.hbs | 2 + app/utils/redirect-auth.js | 9 +++ 5 files changed, 233 insertions(+) create mode 100644 app/components/identity/step1.hbs create mode 100644 app/components/identity/step1.js create mode 100644 app/utils/redirect-auth.js diff --git a/app/components/identity/step1.hbs b/app/components/identity/step1.hbs new file mode 100644 index 00000000..2f3d9421 --- /dev/null +++ b/app/components/identity/step1.hbs @@ -0,0 +1,45 @@ +
Step 1: Chaincode + Generation
+
A private key that you need + to use in your profile service URL and deploy for validation that you’re the + source of URL.
+{{#if this.isChaincodeGenerated}} +
+
+ {{if this.isChaincodeVisible this.chaincode '********************'}} + {{if
+ +
+{{else}} + +{{/if}} +{{#if this.isChaincodeGenerated}} + +{{/if}} \ No newline at end of file diff --git a/app/components/identity/step1.js b/app/components/identity/step1.js new file mode 100644 index 00000000..e0feb9b8 --- /dev/null +++ b/app/components/identity/step1.js @@ -0,0 +1,78 @@ +import Component from '@glimmer/component'; +import { action } from '@ember/object'; +import { tracked } from '@glimmer/tracking'; +import { inject as service } from '@ember/service'; +import { toastNotificationTimeoutOptions } from '../../constants/toast-notification'; +import { APPS } from '../../constants/urls'; +const BASE_URL = APPS.API_BACKEND; + +export default class Step1Component extends Component { + @tracked isChaincodeGenerated = false; + @tracked isGeneratingChaincode = false; + @tracked chaincode = 'asxjdDZVNTfuDMQJiunJ'; + @tracked isChaincodeVisible = false; + @service toast; + + @action handleNext() { + if ( + confirm( + 'Make sure you copied the chaincode as you are not able to see it again. If not, click `Cancel` and copy it.', + ) + ) { + this.args.setState('step2'); + } + } + + @action handleEyeClick() { + this.isChaincodeVisible = !this.isChaincodeVisible; + } + + @action handleCopy() { + navigator.clipboard.writeText(this.chaincode); + this.toast.info('Chaincode Copied!!', '', toastNotificationTimeoutOptions); + } + + @action async handleGenerateChaincode(e) { + e.preventDefault(); + if (this.isGeneratingChaincode === false) { + this.isGeneratingChaincode = true; + try { + const response = await fetch(`${BASE_URL}/users/chaincode`, { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + }); + + const { chaincode } = await response.json(); + + if (response.ok) { + this.chaincode = chaincode; + this.isChaincodeGenerated = true; + this.toast.info( + 'Generated New Chaincode!!', + '', + toastNotificationTimeoutOptions, + ); + } else { + console.log(response); + this.toast.error( + 'Something went wrong. Please check console errors.', + '', + toastNotificationTimeoutOptions, + ); + } + } catch (error) { + console.log('error', error); + this.toast.error( + 'Something went wrong. Please check console errors.', + '', + toastNotificationTimeoutOptions, + ); + } finally { + this.isGeneratingChaincode = false; + } + } + } +} diff --git a/app/styles/identity.module.css b/app/styles/identity.module.css index 403ae1db..4ba9b3e6 100644 --- a/app/styles/identity.module.css +++ b/app/styles/identity.module.css @@ -171,6 +171,18 @@ } } +.identity-copy-box { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + margin-top: 12px; + margin-left: 12px; + cursor: pointer; + border: none; + background: none; +} + @media (height <= 870px) and (width >= 460px) { .identity-rds-logo { width: 174px; @@ -200,3 +212,90 @@ margin-top: 18px; } } + +.identity-next-button { + border-radius: 15px; + background: #1d1283; + box-shadow: 0 4px 8px 0 rgb(0 0 0 / 25%); + padding: 12px 24px; + color: #fff; + text-align: center; + font-family: Inter, sans-serif; + font-size: 18px; + font-style: normal; + font-weight: 700; + line-height: normal; + position: absolute; + right: 4%; + bottom: 8%; +} + +@media (width <= 460px) { + .identity-box-input { + width: 90%; + } + + .identity-chaincode-box { + font-size: 12px; + } + + .identity-chaincode-copy-box { + width: 90%; + } + + .identity-box-button { + font-size: 12px; + padding: 8px; + border-radius: 8px; + } + + .identity-next-button { + font-size: 12px; + padding: 8px 16px; + border-radius: 8px; + bottom: 4%; + } + + .identity-hero { + width: 50%; + } + + .identity-box { + border-radius: 25px; + } + + .identity-rds-logo { + margin-top: 5%; + margin-bottom: 0; + height: 100px; + width: 100px; + } + + .identity-header-hero { + position: absolute; + width: 20%; + right: 12px; + top: 8px; + } + + .identity-box-heading { + font-size: 16px; + } + + .identity-box-desc { + font-size: 12px; + } + + .identity-heading { + font-size: 16px; + margin-top: 8px; + } + + .identity-box-desc-bold { + font-size: 12px; + } + + .identity-box-desc-a { + font-size: 12px; + } +} diff --git a/app/templates/identity.hbs b/app/templates/identity.hbs index d5b0f001..e451e1c9 100644 --- a/app/templates/identity.hbs +++ b/app/templates/identity.hbs @@ -14,6 +14,8 @@
{{#if (eq this.state "getStarted")}} + {{else if (eq this.state 'step1')}} + {{/if}}
diff --git a/app/utils/redirect-auth.js b/app/utils/redirect-auth.js new file mode 100644 index 00000000..5daae60f --- /dev/null +++ b/app/utils/redirect-auth.js @@ -0,0 +1,9 @@ +// import { AUTH_URL } from '../constants/urls'; + +// export default function () { +// let authUrl = AUTH_URL; +// if (typeof window !== 'undefined') { +// authUrl = `${authUrl}&state=${window.location.href}`; +// } +// window.open(authUrl, '_self'); +// } From 9044a365cf3b358a4e691a6fd34489893b0b10d6 Mon Sep 17 00:00:00 2001 From: tejaskh3 Date: Sun, 5 Jan 2025 01:21:20 +0530 Subject: [PATCH 7/7] remove: unused redirect-auth util --- app/utils/redirect-auth.js | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 app/utils/redirect-auth.js diff --git a/app/utils/redirect-auth.js b/app/utils/redirect-auth.js deleted file mode 100644 index 5daae60f..00000000 --- a/app/utils/redirect-auth.js +++ /dev/null @@ -1,9 +0,0 @@ -// import { AUTH_URL } from '../constants/urls'; - -// export default function () { -// let authUrl = AUTH_URL; -// if (typeof window !== 'undefined') { -// authUrl = `${authUrl}&state=${window.location.href}`; -// } -// window.open(authUrl, '_self'); -// }