|
1 | | -import { Failure, Initialized, Pending, Success } from '@abraham/remotedata'; |
2 | | -import { computed, customElement, observe, property } from '@polymer/decorators'; |
| 1 | +import { customElement } from '@polymer/decorators'; |
3 | 2 | import '@polymer/iron-icon'; |
4 | 3 | import '@polymer/paper-button'; |
5 | 4 | import { html, PolymerElement } from '@polymer/polymer'; |
6 | 5 | import '@power-elements/lazy-image'; |
7 | | -import { RootState, store } from '../store'; |
8 | | -import { closeDialog, openSubscribeDialog } from '../store/dialogs/actions'; |
| 6 | +import { partners } from '../../public/data/firestore-data.json'; |
9 | 7 | import { ReduxMixin } from '../store/mixin'; |
10 | | -import { PartnerGroupsState, selectPartnerGroups } from '../store/partners'; |
11 | | -import { addPotentialPartner } from '../store/potential-partners/actions'; |
12 | | -import { |
13 | | - initialPotentialPartnersState, |
14 | | - PotentialPartnersState, |
15 | | -} from '../store/potential-partners/state'; |
16 | | -import { queueSnackbar } from '../store/snackbars'; |
17 | 8 | import { loading, partnersBlock } from '../utils/data'; |
18 | 9 | import '../utils/icons'; |
19 | 10 | import './shared-styles'; |
@@ -70,14 +61,7 @@ export class PartnersBlock extends ReduxMixin(PolymerElement) { |
70 | 61 | <div class="container"> |
71 | 62 | <h1 class="container-title">[[partnersBlock.title]]</h1> |
72 | 63 |
|
73 | | - <template is="dom-if" if="[[pending]]"> |
74 | | - <p>[[loading]]</p> |
75 | | - </template> |
76 | | - <template is="dom-if" if="[[failure]]"> |
77 | | - <p>Error loading partners.</p> |
78 | | - </template> |
79 | | -
|
80 | | - <template is="dom-repeat" items="[[partners.data]]" as="block"> |
| 64 | + <template is="dom-repeat" items="[[partners]]" as="block"> |
81 | 65 | <h4 class="block-title">[[block.title]]</h4> |
82 | 66 | <div class="logos-wrapper"> |
83 | 67 | <template is="dom-repeat" items="[[block.items]]" as="logo"> |
@@ -106,42 +90,5 @@ export class PartnersBlock extends ReduxMixin(PolymerElement) { |
106 | 90 |
|
107 | 91 | private loading = loading; |
108 | 92 | private partnersBlock = partnersBlock; |
109 | | - |
110 | | - @property({ type: Object }) |
111 | | - potentialPartners = initialPotentialPartnersState; |
112 | | - @property({ type: Object }) |
113 | | - partners: PartnerGroupsState = new Initialized(); |
114 | | - |
115 | | - @computed('partners') |
116 | | - get pending() { |
117 | | - return this.partners instanceof Pending; |
118 | | - } |
119 | | - |
120 | | - @computed('partners') |
121 | | - get failure() { |
122 | | - return this.partners instanceof Failure; |
123 | | - } |
124 | | - |
125 | | - override stateChanged(state: RootState) { |
126 | | - this.partners = selectPartnerGroups(state); |
127 | | - this.potentialPartners = state.potentialPartners; |
128 | | - } |
129 | | - |
130 | | - private addPotentialPartner() { |
131 | | - openSubscribeDialog({ |
132 | | - title: this.partnersBlock.form.title, |
133 | | - submitLabel: this.partnersBlock.form.submitLabel, |
134 | | - firstFieldLabel: this.partnersBlock.form.fullName, |
135 | | - secondFieldLabel: this.partnersBlock.form.companyName, |
136 | | - submit: (data) => store.dispatch(addPotentialPartner(data)), |
137 | | - }); |
138 | | - } |
139 | | - |
140 | | - @observe('potentialPartners') |
141 | | - private onPotentialPartners(potentialPartners: PotentialPartnersState) { |
142 | | - if (potentialPartners instanceof Success) { |
143 | | - closeDialog(); |
144 | | - store.dispatch(queueSnackbar(this.partnersBlock.toast)); |
145 | | - } |
146 | | - } |
| 93 | + private partners = partners; |
147 | 94 | } |
0 commit comments