From 326b6556bf9c27c0acb644cb41ea9307d175316e Mon Sep 17 00:00:00 2001 From: TEJAS <98630752+tejaskh3@users.noreply.github.com> Date: Tue, 21 Jan 2025 01:53:27 +0530 Subject: [PATCH] (feat) : hbs file for discord page and test cases (#986) * add: template file for discord * feat: integration test * feat: add css * feat: add test cases --- app/styles/app.css | 1 + app/styles/discord.module.css | 189 +++++++++++++++++++++ app/styles/variables.css | 5 + app/templates/discord.hbs | 138 +++++++++++++++ app/templates/disocrd.hbs | 4 - public/assets/images/discord-connector.svg | 12 ++ public/assets/images/discord-logo.png | Bin 0 -> 12207 bytes tests/acceptance/discord-test.js | 154 +++++++++++++++++ 8 files changed, 499 insertions(+), 4 deletions(-) create mode 100644 app/styles/discord.module.css create mode 100644 app/templates/discord.hbs delete mode 100644 app/templates/disocrd.hbs create mode 100644 public/assets/images/discord-connector.svg create mode 100644 public/assets/images/discord-logo.png create mode 100644 tests/acceptance/discord-test.js diff --git a/app/styles/app.css b/app/styles/app.css index 9c7d3d6c..b6b43b3c 100644 --- a/app/styles/app.css +++ b/app/styles/app.css @@ -45,6 +45,7 @@ @import url("phone-input.module.css"); @import url("login.module.css"); @import url("identity.module.css"); +@import url("discord.module.css"); * { margin: 0; diff --git a/app/styles/discord.module.css b/app/styles/discord.module.css new file mode 100644 index 00000000..28f57070 --- /dev/null +++ b/app/styles/discord.module.css @@ -0,0 +1,189 @@ +* { + --base-unit: 4px; +} + +.w-100 { + width: 100%; +} + +.dark { + opacity: 1; +} + +.mx-auto { + margin: 0 auto; +} + +.my-same { + margin: calc(var(--base-unit) * 5) 0; +} + +.discord { + width: 50%; + margin: 0 auto; + display: flex; + justify-content: flex-start; + align-items: center; + min-height: 100vh; + padding: calc(var(--base-unit) * 4); + padding-top: calc(var(--base-unit) * 20); +} + +.line { + border-bottom: dashed calc(var(--base-unit)) black; +} + +.horizontal-flex { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; +} + +.vertical-flex { + display: flex; + flex-direction: column; + align-items: center; +} + +.logo { + width: 100px; + height: 100px; + border-radius: 50%; +} + +.header { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + padding: calc(var(--base-unit) * 2); + border-radius: calc(var(--base-unit) * 2); + background-color: var(--color-light-gray); + box-shadow: var(--color-black-shadow-3); + margin-bottom: calc(var(--base-unit) * 3); + transition: all 0.3s ease; +} + +.heading { + margin: calc(var(--base-unit) * 5) auto; + font-weight: 700; +} + +.discord-card { + border-radius: calc(var(--base-unit) * 3); + box-shadow: calc(var(--base-unit)) calc(var(--base-unit)) + calc(var(--base-unit) * 2) var(--color-black-59); + max-width: 620px; + width: 100%; + padding: calc(var(--base-unit) * 4); +} + +.profile-card { + background-color: var(--color-gray-37); + border-radius: calc(var(--base-unit) * 2); + padding: var(--base-unit); + width: 30%; +} + +.username { + font-weight: 700; + font-size: larger; +} + +.discord__success, +.discord__error { + text-align: center; + margin-top: calc(var(--base-unit) * 10); +} + +.success__text, +.error__text { + font-size: 1.5rem; + font-weight: 700; + margin: 1rem; + padding: 0; +} + +.discord__title { + font-size: 2rem; + font-weight: 700; + margin: 1rem; + padding: 0; +} + +.discord__card { + display: flex; + align-items: center; +} + +.discord__card-data { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + margin: 1rem; + padding: 1rem; + border: 2px solid var(--color-black-40); + border-radius: 8px; +} + +.card-data__img { + border-radius: 50%; +} + +.card-data__username { + font-size: 1.5rem; + font-weight: 700; + margin: 0.5rem; +} + +.card-data__account { + font-size: 1.1rem; + font-weight: 400; + margin: 0; +} + +.discord__arrow { + font-size: 5rem; + font-weight: 700; +} + +.button { + color: var(--color-white); + background-color: var(--color-blue-primary); + border: none; + padding: 1rem 2rem; + margin: 1rem; + font-size: 1.25rem; + font-weight: 700; + border-radius: 8px; +} + +.btn-enabled { + color: var(--color-white); + background-color: var(--color-blue-primary); +} + +.btn-disabled { + color: var(--color-white); + background-color: var(--color-gray-medium); +} + +.TnC { + text-align: left; + margin-left: 3.5rem; + padding: calc(var(--base-unit) * 2); +} + +@media screen and (width >= 1280px) { + .discord { + width: 30%; + } +} + +@media screen and (width <= 640px) { + .discord { + width: 90%; + } +} diff --git a/app/styles/variables.css b/app/styles/variables.css index efe2d6fc..0d3d388c 100644 --- a/app/styles/variables.css +++ b/app/styles/variables.css @@ -41,4 +41,9 @@ --color-black-shadow-3: 3px 3px 3px 0 rgb(0 0 0 / 25%); --color-black-shadow-8: 0 4px 8px 0 rgb(0 0 0 / 25%); --color-navy-link: #0000af; + --color-blue-primary: #0034a5; + --color-gray-medium: #808080; + --color-black-40: #00000040; + --color-black-59: rgb(0 0 0 / 58.9%); + --color-gray-37: rgb(158 158 158 / 36.8%); } diff --git a/app/templates/discord.hbs b/app/templates/discord.hbs new file mode 100644 index 00000000..13d4b060 --- /dev/null +++ b/app/templates/discord.hbs @@ -0,0 +1,138 @@ +{{page-title 'Discord'}} + +
+ {{#if @model.isTokenExpired }} +

Token Expired. Please generate a new token using + slash commands

+ {{else}} + {{#if (or this.isLinkingInProgress)}} +
+ +
+ {{else}} + {{#if + (or + (eq @model.userData.roles.archived false) + (eq this.linkStatus 'linked') + ) + }} +
+

Your Discord account has been successfully + linked.

+

You can close this tab now.

+
+ {{else if (eq this.linkStatus 'failure')}} +
+

Something went wrong. Please try again.

+
+ {{else if (eq this.linkStatus 'not-linked')}} +
+ +
+ +
+ +

Authorize Bot

+ +
+ +

Real Dev Squad + wants to access your + Discord.

+ +
+ +
+
+ +

+ {{@model.externalAccountData.attributes.userName}}#{{@model.externalAccountData.attributes.discriminator}}

+ +
+ + + +
+ +

{{@model.userData.username}}

+ +
+
+ +
+ +
+

By authorizing us you allow us to:

+
    +
  • Change your name within our server.
  • +
  • Read/process your messages.
  • +
+
+ +
+ +
+ + +
+ +
+ {{/if}} + {{/if}} + {{/if}} +
diff --git a/app/templates/disocrd.hbs b/app/templates/disocrd.hbs deleted file mode 100644 index 74e435ef..00000000 --- a/app/templates/disocrd.hbs +++ /dev/null @@ -1,4 +0,0 @@ -
- {{!-- TODO: add discord hbs file in next PRs--}} -

Discord Page

-
diff --git a/public/assets/images/discord-connector.svg b/public/assets/images/discord-connector.svg new file mode 100644 index 00000000..d2a7987d --- /dev/null +++ b/public/assets/images/discord-connector.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/public/assets/images/discord-logo.png b/public/assets/images/discord-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..f59da1a5ae2cb60c16c2273af62a51e9b505a4b6 GIT binary patch literal 12207 zcmV;gFHq2lP)3gIeHFj?b3>NEMv165!G~JoYIj@j?&hC2rADJRtJ(GW>oCOcaBG zNvC))CqJUPoDUHNHc|p<6yq=+pH9G^Q2dF&CKfa(V z9SsLpiQkw4;sbZi+ZGjKsp>CDmaB1?o&b!GW}IbUD~e!57;~fioa7R0K@Ik~ z1j0UBjq~u5CDY5m#4AhzX@?mP=0}9t#Xf?|Jq<_dOfInDobx0G%mM)j2ku6btrUfO zn*e+xFlj@r!&0#7Ra48fg()DHaQ(d1Aqk>w6ma1#Y@BJ>Lh1OlF*QWz@n9D?fF{}o z#-$I6B*#~uF22D5CKoXU1ex)~`e?g@U%|QM2DIgGLDQrkK5d1rg$sWQuuH5$srk%a z7y0$;uaB;SE>4#gkUJjvyq}dxKSekCXOhGRWBAA%Fl0DI!uFwS^-p}fJaAN zJ`cm7!~D_~^a&1K6%P(5dohpm);V|m8(qa$33>sU`S9A_g4HsQap5+M;`9U)B`5}o zzwVUW@2q@z>i5`HL{VU{N`c{USA{W#D8>NUYV0x=8^^S4kLKaGA$ z1q2~McmM95w>m+xggpYB&&59z!9;a%AgIDH@$;fbdh@N9r=EczB4`BU-UVOAxh2Ql zAn=Frj-`W%_Aoey!t%crR@?HA|9nj~1OWjrAelM&mb6OukAaJS#6SB&m%+FZ13a_+ z7##fF@!itL8#iXTA%F>J0hzrZZwN^63O{z#RX#*XEi7_`u4BvNx=gD^$O*sYu zNQ|g|Hs@D)Q-HH)@Xss3 z#K5%FTKLx<&iLcGFJ!N0EO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&U=lE(_Wy=^;J>I;t&yTs9TAYhnarGgOIjtL$ALY`I5)M4rub-%aVST5 zcp55%H{@dH0Y*SaFYkC@eIJWWdzC)6df&SoyKy>67t98&rQ&5ow$|+ z`9R0nUGww%3nJW!cJVKC2hT&5pn0O7X@WXKJw;su}IF|QbzIbsz2Xq0tT*PO=f-l1=!8Os%Jx|bVVN6ydIj}egTI_3g?V6|&sU%Zbd%Y{xUiE6u*K=&+vB>TJc6(bN}LClFP~NmCVpcIh{DjCm0$d7Z7i2;2`&pu5Ij;(Od#~YPMnOA zl7J=}X855SzAui+LIgJaR4CpGE9#37);Ljx`~U|&a^ekg;QMRwaT(*R6xBjGW1ez6 x&Us1Vg#c242>d(<*5bDpW>yB$T8lv7{{v=v6gW8RR(}8h002ovPDHLkV1jw3czFN- literal 0 HcmV?d00001 diff --git a/tests/acceptance/discord-test.js b/tests/acceptance/discord-test.js new file mode 100644 index 00000000..e5a79e34 --- /dev/null +++ b/tests/acceptance/discord-test.js @@ -0,0 +1,154 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render, click } from '@ember/test-helpers'; +import { hbs } from 'ember-cli-htmlbars'; + +module('Acceptance | discord', function (hooks) { + setupRenderingTest(hooks); + + test('it shows expired token message', async function (assert) { + this.set('model', { + isTokenExpired: true, + }); + + await render(hbs` +
+ {{#if this.model.isTokenExpired}} +

Token Expired. Please generate a new token using slash commands

+ {{/if}} +
+ `); + + assert + .dom('.error__text') + .hasText( + 'Token Expired. Please generate a new token using slash commands', + ); + }); + + test('it shows linking in progress state', async function (assert) { + this.set('isLinkingInProgress', true); + + await render(hbs` +
+ {{#if this.isLinkingInProgress}} +
+ +
+ {{/if}} +
+ `); + + assert.dom('.loading').exists(); + assert.dom('.fa-spin').exists(); + }); + + test('it shows success message when account is linked', async function (assert) { + this.set('model', { + userData: { + roles: { + archived: false, + }, + }, + }); + this.set('linkStatus', 'linked'); + + await render(hbs` +
+ {{#if (or + (eq this.model.userData.roles.archived false) + (eq this.linkStatus 'linked') + )}} +
+

Your Discord account has been successfully linked.

+

You can close this tab now.

+
+ {{/if}} +
+ `); + + assert.dom('.discord__success').exists(); + assert.dom('.success__text').exists({ count: 2 }); + }); + + test('it shows authorization form when not linked', async function (assert) { + this.set('model', { + userData: { + username: 'testUser', + picture: { + url: 'test-url', + }, + }, + externalAccountData: { + attributes: { + userName: 'discordUser', + discriminator: '1234', + userAvatar: 'discord-avatar', + }, + }, + }); + this.set('linkStatus', 'not-linked'); + this.set('setConsent', () => {}); + this.set('linkDiscordAccount', () => {}); + + await render(hbs` + {{#if (eq this.linkStatus 'not-linked')}} +
+
+
+ +

+ {{this.model.externalAccountData.attributes.userName}}#{{this.model.externalAccountData.attributes.discriminator}} +

+
+
+
+ +
+ +
+ {{/if}} + `); + + assert.dom('[data-test-main-content]').exists(); + assert.dom('[data-test-discord-profile-card]').exists(); + assert.dom('[data-test-discord-username]').hasText('discordUser#1234'); + assert.dom('[data-test-consent-checkbox]').exists(); + assert.dom('[data-test-authorize-button]').exists(); + }); + + test('it handles authorization button click', async function (assert) { + assert.expect(1); + + this.set('linkStatus', 'not-linked'); + this.set('linkDiscordAccount', () => { + assert.ok(true, 'linkDiscordAccount action was triggered'); + }); + + await render(hbs` + + `); + + await click('[data-test-authorize-button]'); + }); +});