Skip to content
This repository was archived by the owner on Feb 5, 2022. It is now read-only.

Commit f34a167

Browse files
committed
fix: remove toast, auto reload
1 parent 922ca70 commit f34a167

File tree

4 files changed

+4
-88
lines changed

4 files changed

+4
-88
lines changed

src/assets/i18n/en.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
export const translations = {
22
translation: {
33
home: {
4-
newversion: 'New version available...',
5-
reload: 'Reload',
64
hero: {
75
title: 'Mobile Solutions',
86
subTitle: 'For A Digital World',

src/components/app-nav-header/app-nav-header.scss

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -137,66 +137,3 @@ ul.navbar-nav {
137137
margin: 0;
138138
}
139139
}
140-
141-
#toast {
142-
visibility: hidden;
143-
min-width: 250px;
144-
margin-left: -125px;
145-
background-color: #333;
146-
color: #fff;
147-
text-align: center;
148-
border-radius: 2px;
149-
padding: 16px;
150-
position: fixed;
151-
z-index: 1;
152-
left: 50%;
153-
bottom: 30px;
154-
border-radius: 16px;
155-
}
156-
157-
#toast.show {
158-
visibility: visible;
159-
-webkit-animation: fadein 0.5s;
160-
animation: fadein 0.5s;
161-
}
162-
163-
@-webkit-keyframes fadein {
164-
from {
165-
bottom: 0;
166-
opacity: 0;
167-
}
168-
to {
169-
bottom: 30px;
170-
opacity: 1;
171-
}
172-
}
173-
174-
@keyframes fadein {
175-
from {
176-
bottom: 0;
177-
opacity: 0;
178-
}
179-
to {
180-
bottom: 30px;
181-
opacity: 1;
182-
}
183-
}
184-
185-
#toast-button {
186-
text-transform: uppercase;
187-
background: transparent;
188-
text-align: center;
189-
max-width: 200px;
190-
text-decoration: none;
191-
border: 0.75px solid #ffffff;
192-
border-radius: 16px;
193-
box-shadow: 0 2px 4px 0 rgba(128, 128, 128, 0.5);
194-
margin-left: 10px;
195-
color: #ffffff;
196-
197-
&:hover {
198-
text-decoration: none;
199-
background: white;
200-
color: black;
201-
}
202-
}

src/components/app-nav-header/app-nav-header.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,6 @@ export class AppNavHeader {
153153
</div>
154154
</nav>
155155
<app-search-results onClose={ev => this.toogleSearch('hidden', ev.detail.pageChanged)} />
156-
<div id="toast">
157-
<app-translate keyword="home.newversion" />
158-
<button id="toast-button">
159-
<app-translate keyword="home.reload" />
160-
</button>
161-
</div>
162156
</div>
163157
);
164158
}

src/pages/open-forge-app/open-forge-app.tsx

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,13 @@ polyfill();
1111
export class OpenForgeApp {
1212
mainEl: HTMLElement;
1313
newServiceWorker: boolean = false;
14-
registration: ServiceWorkerRegistration;
1514

1615
@Listen('swUpdate', { target: 'window' })
1716
async onSWUpdate() {
18-
this.registration = await navigator.serviceWorker.getRegistration();
19-
if (this.registration && this.registration.waiting) {
20-
this.showToast();
21-
}
22-
}
23-
24-
showToast() {
25-
const toastDiv = document.getElementById('toast');
26-
toastDiv.className = 'show';
27-
const toastButton = document.getElementById('toast-button');
28-
toastButton.addEventListener('click', () => this.closeAndReload());
29-
}
30-
31-
closeAndReload() {
32-
if (this.registration && this.registration.waiting) {
33-
this.registration.waiting.postMessage('skipWaiting');
17+
const registration = await navigator.serviceWorker.getRegistration();
18+
console.log(registration);
19+
if (registration && registration.waiting) {
20+
registration.waiting.postMessage('skipWaiting');
3421
}
3522
window.location.reload();
3623
}

0 commit comments

Comments
 (0)