generated from Real-Dev-Squad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #523 from Real-Dev-Squad/develop
dev to main sync
- Loading branch information
Showing
15 changed files
with
315 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{#if @isDevEnv}} | ||
{{#if @isMobileDevice}} | ||
{{#if this.isDialogVisible}} | ||
<dialog data-test-mobile-dialog class="mobile-dialog"> | ||
Redirect to RDS App | ||
<br/> | ||
<button id="mobile-dialog__close-button" type="button" {{on 'click' (fn this.closeDialog)}} >Cancel</button> | ||
<button id="mobile-dialog__open-button" type="button" {{on 'click' (fn this.openRDSApp)}}>Okay</button> | ||
</dialog> | ||
{{/if}} | ||
{{/if}} | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import Component from '@glimmer/component'; | ||
import { action } from '@ember/object'; | ||
import ENV from 'website-my/config/environment'; | ||
import { tracked } from '@glimmer/tracking'; | ||
|
||
export default class MobileDialogComponent extends Component { | ||
@tracked isDialogVisible = true; | ||
|
||
@action | ||
closeDialog() { | ||
this.isDialogVisible = false; | ||
} | ||
|
||
@action | ||
openRDSApp() { | ||
this.openApp(); | ||
} | ||
|
||
openApp() { | ||
let isAppInstalled = false; | ||
const appScheme = ENV.RDS_ANDROID_SCHEME; | ||
const fallbackURL = ENV.ANDROID_GITHUB_URL; | ||
const userAgent = navigator.userAgent || navigator.vendor || window.opera; | ||
const MAXTIME = 1000; | ||
|
||
if (/android/i.test(userAgent)) { | ||
const startTime = Date.now(); | ||
const iframe = document.createElement('iframe'); | ||
iframe.style.display = 'none'; | ||
iframe.src = appScheme; | ||
document.body.appendChild(iframe); | ||
this.isDialogVisible = false; | ||
|
||
window.addEventListener('blur', function () { | ||
document.body.removeChild(iframe); | ||
|
||
const timeTaken = Date.now() - startTime; | ||
if (timeTaken <= MAXTIME) { | ||
isAppInstalled = true; | ||
} | ||
}); | ||
|
||
setTimeout(function () { | ||
if (!isAppInstalled) { | ||
document.body.removeChild(iframe); | ||
window.location.href = fallbackURL; | ||
} | ||
this.isDialogVisible = false; | ||
}, 1000); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{#if @dev}} | ||
<section class='cache'> | ||
<div data-test-last-time class='cache__last-request'> | ||
Last Request: {{@time}} | ||
</div> | ||
<button | ||
data-test-btn-clear-cache | ||
class='cache__clear-btn' | ||
type='submit' | ||
disabled={{@isPurgingCache}} | ||
{{on 'click' (fn @onClearCache)}} | ||
>{{#if @isPurgingCache}} | ||
<i class='fa fa-spinner fa-spin' data-test-button-spinner></i> | ||
{{/if}} | ||
Clear Cache</button> | ||
<div data-test-pending-requests class='cache__remaining-requests'> | ||
{{@totalTimes}} | ||
/ 3 requests remaining for today | ||
</div> | ||
</section> | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const MAX_CACHE_PURGE_COUNT = 3; | ||
// this will be removed once we fetch this from the API | ||
export const LAST_UPDATED_REQUEST = '24 November, 1:23 PM IST'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.mobile-dialog { | ||
display: block; | ||
border-radius: 4px; | ||
padding: 0.5rem 1rem; | ||
font-weight: 900; | ||
margin: 0 auto; | ||
font-size:large; | ||
text-align: center; | ||
background-color: var(--form--bg); | ||
border: none; | ||
box-shadow: 4px 8px 8px var(--mobile-dialog-box-shadow); | ||
& button { | ||
padding: 0.5rem 1rem; | ||
margin: 1rem; | ||
font-size:medium; | ||
border: none; | ||
border-radius: 4px; | ||
color: var(--body-bg-color); | ||
font-weight: 600; | ||
} | ||
} | ||
|
||
#mobile-dialog__open-button { | ||
background-color: var(--mobile-dialog--open-button); | ||
} | ||
|
||
#mobile-dialog__close-button { | ||
background-color: var(--body-bg-color); | ||
color: var(--landing-page--main-heading); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.cache { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
margin: auto; | ||
box-shadow: 5px 10px 15px #09113344; | ||
border-radius: 10px; | ||
padding: 30px; | ||
font-weight: 700; | ||
} | ||
|
||
.cache__last-request { | ||
padding: 40px 4px 20px; | ||
color: #1d1283; | ||
font-size: 2rem; | ||
text-align: center; | ||
} | ||
|
||
.cache__clear-btn { | ||
border-radius: 10px; | ||
padding: 16px 60px; | ||
border: 3px solid #e49504; | ||
color: #e49504; | ||
background-color: white; | ||
font-weight: 700; | ||
font-size: 1.25rem; | ||
cursor: pointer; | ||
} | ||
|
||
.cache__remaining-requests { | ||
padding-top: 30px; | ||
color: #1d1283; | ||
font-size: 1.25rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
{{page-title "My | Real Dev Squad"}} | ||
|
||
<MobileDialog | ||
@isDevEnv = {{this.isDevMode}} | ||
@isMobileDevice = {{this.isMobileDevice}} | ||
/> | ||
<Navbar | ||
@firstName={{@model.firstName}} | ||
@profilePictureURL={{@model.profilePictureURL}} | ||
@signOutHandler={{this.signOutHandler}} | ||
/> | ||
|
||
<div class="main-container"> | ||
{{outlet}} | ||
{{outlet}} | ||
</div> | ||
<footer class="footer">Contents of this website are deployed from this | ||
<a href={{this.GITHUB_URL}} target="_blank" rel="noopener noreferrer"> | ||
open sourced repo | ||
</a> | ||
<a href={{this.GITHUB_URL}} target="_blank" rel="noopener noreferrer"> | ||
open sourced repo | ||
</a> | ||
</footer> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { render } from '@ember/test-helpers'; | ||
import { hbs } from 'ember-cli-htmlbars'; | ||
|
||
module('Integration | Component | mobile-dialog', function (hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('Mobile-Dialog does not renders', async function (assert) { | ||
this.setProperties({ | ||
isDevEnv: false, | ||
isMobileDevice: false, | ||
}); | ||
await render(hbs`<MobileDialog @dev={{this.dev}}/>`); | ||
|
||
assert.dom('[data-test-mobile-dialog]').doesNotExist(); | ||
}); | ||
|
||
test('Mobile-Dialog should renders', async function (assert) { | ||
this.setProperties({ | ||
isDevEnv: true, | ||
isMobileDevice: true, | ||
}); | ||
|
||
await render( | ||
hbs`<MobileDialog @isDevEnv={{this.isDevEnv}} @isMobileDevice={{this.isMobileDevice}} />` | ||
); | ||
|
||
assert.dom('[data-test-mobile-dialog]').exists(); | ||
}); | ||
}); |
Oops, something went wrong.