Import a 3D Model and automatically assign and export animations
TypeScript
a bit of cleanup for the offline toggle
Scott Petrovic9106393822d4
diff --git a/src/lib/NetworkStatusManager.ts b/src/lib/NetworkStatusManager.tsindex 5cfa4af..fe3bf62 100644--- a/src/lib/NetworkStatusManager.ts+++ b/src/lib/NetworkStatusManager.ts@@ -1,6 +1,6 @@// test going offline and online through the console like this// window.dispatchEvent(new Event('offline')) // shows "You are offline"-// window.dispatchEvent(new Event('online')) // shows "Back online"+// window.dispatchEvent(new Event('online')) // shows "You are back online"// The developer tools also have an offline mode (by the "throttling option" in network tab)// for testing@@ -11,7 +11,7 @@*/export class NetworkStatusManager {- private toast_timeout: ReturnType<typeof setTimeout> | null = null+ private toast_timeout: number | null = nullconstructor() {this.update(navigator.onLine, false)@@ -19,23 +19,24 @@ export class NetworkStatusManager {window.addEventListener('offline', () => this.update(false, true))}- public is_online(): boolean {- return navigator.onLine- }-private update(online: boolean, show_toast: boolean): void {++ // update the data attribute we use to apply offline styles in CSSif (online) {delete document.documentElement.dataset.networkStatus} else {document.documentElement.dataset.networkStatus = 'offline'}+ // Show a toast notification if requestedif (show_toast) {this.show_toast(online ? 'You are back online' : 'You are offline')}}private show_toast(message: string): void {++ // Clear any existing toast timeout to prevent multiple toasts from stackingif (this.toast_timeout !== null) {clearTimeout(this.toast_timeout)this.toast_timeout = null@@ -43,16 +44,19 @@ export class NetworkStatusManager {let toast = document.getElementById('network-status-toast')+ // If the toast element doesn't exist, create it and append to the bodyif (toast === null) {toast = document.createElement('div')toast.id = 'network-status-toast'document.body.appendChild(toast)}+ // Update the toast message and show ittoast.textContent = messagetoast.classList.remove('network-toast-hide')toast.classList.add('network-toast-show')+ // Automatically hide the toast after 5 secondsthis.toast_timeout = setTimeout(() => {toast!.classList.remove('network-toast-show')toast!.classList.add('network-toast-hide')diff --git a/src/offline.css b/src/offline.cssindex 63f4668..6bc25e6 100644--- a/src/offline.css+++ b/src/offline.css@@ -1,9 +1,7 @@-/* Styles applied when the browser has no network connection.- Target elements using: [data-network-status="offline"] .your-selector { ... } */--[data-network-status="offline"] #logo-branding {- display: none;-}+/* Styles applied when the browser has no network connection.+ There is a toast message that will also communicate when we are online/offline+ This is mostly turning off links that go out to the web .+*//* --- Network status toast --- */@@ -31,3 +29,36 @@#network-status-toast.network-toast-hide {opacity: 0;}++/*+ Target elements using: [data-network-status="offline"] .your-selector { ... }+*/++[data-network-status="offline"] #logo-branding {+ display: none;+}++/* hide any links in the modal dialog when offline since they go to internet */+[data-network-status="offline"] .modal-dialog-body a {+ display: none;+}++[data-network-status="offline"] #nav-support-mesh2motion,+[data-network-status="offline"] #nav-github,+[data-network-status="offline"] #learn-link,+[data-network-status="offline"] #m2m-model-github-link {+ display: none;+}++[data-network-status="offline"] a#logo-branding {+ pointer-events: none;+ text-decoration: none;+}++[data-network-status="offline"] .download-success-section {+ display: none !important;+}++[data-network-status="offline"] .download-success-desktop {+ display: block !important;+}diff --git a/src/settings-dropdown.css b/src/settings-dropdown.cssindex a634404..36e7b2f 100644--- a/src/settings-dropdown.css+++ b/src/settings-dropdown.css@@ -14,7 +14,7 @@box-shadow: none;border-radius: 0;padding: 0;- align-items: anchor-center;+ padding-top: 0.25rem;}#settings-toggle span {align-content: center; /* vertical align icon */diff --git a/static/desktop.css b/static/desktop.cssindex 8f8b256..640f890 100644--- a/static/desktop.css+++ b/static/desktop.css@@ -1,22 +1,7 @@-/* desktop code to go here */-#nav-support-mesh2motion,-#nav-github,-#learn-link,-#m2m-model-github-link-{- display: none;-}+/**+ desktop code to go here. This will only be used/seen on the Mesh2Motion offline desktop app+ There was originally more in here, but it moved to the offline.css file so the Desktop app+ would have all links and functionality when online.-/* this makes links not clickable */-a#logo-branding {- pointer-events: none;- text-decoration: none;-}--.download-success-section {- display: none !important;-}--.download-success-desktop {- display: block !important;-}\ No newline at end of file+ TODO: maybe have some different brand logo or some branding with a desktop build+ */