From a0ebbc6794ed7e0e720f454bfd8e8ae613733396 Mon Sep 17 00:00:00 2001 From: Michael Foiani Date: Wed, 25 Jul 2018 19:51:28 -0400 Subject: Changed to appropriate names for MAO app --- src/components/mao-app.js | 268 ++++++++++++++++++++++++++++++++++++++++++++++ src/components/my-app.js | 268 ---------------------------------------------- 2 files changed, 268 insertions(+), 268 deletions(-) create mode 100644 src/components/mao-app.js delete mode 100644 src/components/my-app.js (limited to 'src/components') diff --git a/src/components/mao-app.js b/src/components/mao-app.js new file mode 100644 index 0000000..48c5f61 --- /dev/null +++ b/src/components/mao-app.js @@ -0,0 +1,268 @@ +/** +@license +Copyright (c) 2018 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ + +import { LitElement, html } from '@polymer/lit-element'; +import { setPassiveTouchGestures } from '@polymer/polymer/lib/utils/settings.js'; +import { connect } from 'pwa-helpers/connect-mixin.js'; +import { installMediaQueryWatcher } from 'pwa-helpers/media-query.js'; +import { installOfflineWatcher } from 'pwa-helpers/network.js'; +import { installRouter } from 'pwa-helpers/router.js'; +import { updateMetadata } from 'pwa-helpers/metadata.js'; + +// This element is connected to the Redux store. +import { store } from '../store.js'; + +// These are the actions needed by this element. +import { + navigate, + updateOffline, + updateDrawerState, + updateLayout +} from '../actions/app.js'; + +// These are the elements needed by this element. +import '@polymer/app-layout/app-drawer/app-drawer.js'; +import '@polymer/app-layout/app-header/app-header.js'; +import '@polymer/app-layout/app-scroll-effects/effects/waterfall.js'; +import '@polymer/app-layout/app-toolbar/app-toolbar.js'; +import { menuIcon } from './my-icons.js'; +import './snack-bar.js'; + +class MaoApp extends connect(store)(LitElement) { + _render({appTitle, _page, _drawerOpened, _snackbarOpened, _offline}) { + // Anything that's related to rendering should be done in here. + return html` + + + + + + +
${appTitle}
+
+ + + +
+ + + + + + + +
+ + + + +
+ + + + + You are now ${_offline ? 'offline' : 'online'}. + `; + } + + static get properties() { + return { + appTitle: String, + _page: String, + _drawerOpened: Boolean, + _snackbarOpened: Boolean, + _offline: Boolean + } + } + + constructor() { + super(); + // To force all event listeners for gestures to be passive. + // See https://www.polymer-project.org/3.0/docs/devguide/settings#setting-passive-touch-gestures + setPassiveTouchGestures(true); + } + + _firstRendered() { + installRouter((location) => store.dispatch(navigate(window.decodeURIComponent(location.pathname)))); + installOfflineWatcher((offline) => store.dispatch(updateOffline(offline))); + installMediaQueryWatcher(`(min-width: 460px)`, + (matches) => store.dispatch(updateLayout(matches))); + } + + _didRender(properties, changeList) { + if ('_page' in changeList) { + const pageTitle = properties.appTitle + ' - ' + changeList._page; + updateMetadata({ + title: pageTitle, + description: pageTitle + // This object also takes an image property, that points to an img src. + }); + } + } + + _stateChanged(state) { + this._page = state.app.page; + this._offline = state.app.offline; + this._snackbarOpened = state.app.snackbarOpened; + this._drawerOpened = state.app.drawerOpened; + } +} + +window.customElements.define('mao-app', MaoApp); diff --git a/src/components/my-app.js b/src/components/my-app.js deleted file mode 100644 index cb5cf19..0000000 --- a/src/components/my-app.js +++ /dev/null @@ -1,268 +0,0 @@ -/** -@license -Copyright (c) 2018 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt -The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt -The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt -Code distributed by Google as part of the polymer project is also -subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt -*/ - -import { LitElement, html } from '@polymer/lit-element'; -import { setPassiveTouchGestures } from '@polymer/polymer/lib/utils/settings.js'; -import { connect } from 'pwa-helpers/connect-mixin.js'; -import { installMediaQueryWatcher } from 'pwa-helpers/media-query.js'; -import { installOfflineWatcher } from 'pwa-helpers/network.js'; -import { installRouter } from 'pwa-helpers/router.js'; -import { updateMetadata } from 'pwa-helpers/metadata.js'; - -// This element is connected to the Redux store. -import { store } from '../store.js'; - -// These are the actions needed by this element. -import { - navigate, - updateOffline, - updateDrawerState, - updateLayout -} from '../actions/app.js'; - -// These are the elements needed by this element. -import '@polymer/app-layout/app-drawer/app-drawer.js'; -import '@polymer/app-layout/app-header/app-header.js'; -import '@polymer/app-layout/app-scroll-effects/effects/waterfall.js'; -import '@polymer/app-layout/app-toolbar/app-toolbar.js'; -import { menuIcon } from './my-icons.js'; -import './snack-bar.js'; - -class MyApp extends connect(store)(LitElement) { - _render({appTitle, _page, _drawerOpened, _snackbarOpened, _offline}) { - // Anything that's related to rendering should be done in here. - return html` - - - - - - -
${appTitle}
-
- - - -
- - - - - - - -
- - - - -
- - - - - You are now ${_offline ? 'offline' : 'online'}. - `; - } - - static get properties() { - return { - appTitle: String, - _page: String, - _drawerOpened: Boolean, - _snackbarOpened: Boolean, - _offline: Boolean - } - } - - constructor() { - super(); - // To force all event listeners for gestures to be passive. - // See https://www.polymer-project.org/3.0/docs/devguide/settings#setting-passive-touch-gestures - setPassiveTouchGestures(true); - } - - _firstRendered() { - installRouter((location) => store.dispatch(navigate(window.decodeURIComponent(location.pathname)))); - installOfflineWatcher((offline) => store.dispatch(updateOffline(offline))); - installMediaQueryWatcher(`(min-width: 460px)`, - (matches) => store.dispatch(updateLayout(matches))); - } - - _didRender(properties, changeList) { - if ('_page' in changeList) { - const pageTitle = properties.appTitle + ' - ' + changeList._page; - updateMetadata({ - title: pageTitle, - description: pageTitle - // This object also takes an image property, that points to an img src. - }); - } - } - - _stateChanged(state) { - this._page = state.app.page; - this._offline = state.app.offline; - this._snackbarOpened = state.app.snackbarOpened; - this._drawerOpened = state.app.drawerOpened; - } -} - -window.customElements.define('my-app', MyApp); -- cgit v1.2.3-70-g09d2