Skip to content

Commit

Permalink
feat(view-sales): separates ui from state fix #97
Browse files Browse the repository at this point in the history
  • Loading branch information
dzintars committed Aug 1, 2020
1 parent 3b0f6ce commit ba9268c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/ui/containers/system-router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import '../../views/view-dispatch'
import '../../containers/view-dispatch-connected'
import '../../views/view-dispatch-consignments'
import '../../views/view-sales'
import '../../containers/view-sales-connected'
import '../../views/view-signin'
import '../../views/view-signup'
import '../../views/view-error'
Expand Down
21 changes: 21 additions & 0 deletions src/ui/containers/view-sales-connected/component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ViewSalesElement } from '../../views/view-sales'
import { connect } from '../../../utils/connect'
import { store, RootState, startApplication } from '../../../store'

export class ViewSalesConnectedElement extends connect(store, ViewSalesElement) {
connectedCallback() {
super.connectedCallback()
store.dispatch(startApplication(this.appid))
// store.dispatch(getApplications())
// store.dispatch(getModules())
}

// Map state to props (Connect lib)
// mapState(state: RootState) {
// return {

// }
// }
}

customElements.define(ViewSalesElement.is, ViewSalesConnectedElement)
1 change: 1 addition & 0 deletions src/ui/containers/view-sales-connected/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './component'
22 changes: 7 additions & 15 deletions src/ui/views/view-sales/component.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
import { LitElement, customElement, property, TemplateResult, CSSResultArray } from 'lit-element'
import { ViewBaseElement } from '../view-base'
import { connect } from '../../../utils/connect'
import { store, RootState, ModuleSelectors, getApplications, getModules, startApplication } from '../../../store'
import { LitElement, property, TemplateResult, CSSResultArray } from 'lit-element'
import template from './template'
import style from './style'

@customElement('view-sales')
export class ViewSalesElement extends connect(store, ViewBaseElement) {
@property({ type: String }) appid: string = 'c178025e-a209-4c50-8c34-36d35f36494c'

connectedCallback(): void {
super.connectedCallback()
store.dispatch(startApplication(this.appid))
// store.dispatch(getApplications())
// store.dispatch(getModules())
export class ViewSalesElement extends LitElement {
static get is() {
return 'view-sales'
}
@property({ type: String }) appid: string = 'c178025e-a209-4c50-8c34-36d35f36494c'

protected render(): TemplateResult {
return template.call(this)
}

static get styles(): CSSResultArray {
public static get styles(): CSSResultArray {
return [style]
}

createRenderRoot(): Element | ShadowRoot {
protected createRenderRoot(): Element | ShadowRoot {
return this.hasAttribute('noshadow') ? this : super.createRenderRoot()
}
}
Expand Down

0 comments on commit ba9268c

Please sign in to comment.