diff --git a/client/js/settings/index/branding/index.js b/client/js/settings/index/branding/index.js index e4f62cc12..59f4f4d7e 100644 --- a/client/js/settings/index/branding/index.js +++ b/client/js/settings/index/branding/index.js @@ -1,7 +1,6 @@ // License: LGPL-3.0-or-later // npm const flyd = require('flyd') -const R = require('ramda') flyd.flatMap = require('flyd/module/flatmap') flyd.filter = require('flyd/module/filter') flyd.mergeAll = require('flyd/module/mergeall') @@ -13,7 +12,7 @@ const colorPicker = require('../../../components/color-picker.es6') const view = require('./view') function init() { - const np = R.merge(app.nonprofit, {}) + const np = { ...app.nonprofit } const state = { nonprofit: np , font$: flyd.stream({ @@ -27,7 +26,7 @@ function init() { } const resp$ = flyd.flatMap( - state => flyd.map(R.prop('body'), request({ + state => flyd.map(r => r.body, request({ method: 'put' , path: `/nonprofits/${np.id}` , send: {nonprofit: { brand_color: state.colorPicker.color$(), brand_font: state.font$().key }} diff --git a/client/js/settings/index/branding/view.js b/client/js/settings/index/branding/view.js index 68d7f5aa5..e0ebb3f15 100644 --- a/client/js/settings/index/branding/view.js +++ b/client/js/settings/index/branding/view.js @@ -1,7 +1,6 @@ // License: LGPL-3.0-or-later // npm const h = require('snabbdom/h') -const R = require('ramda') const notification = require('ff-core/notification') const button = require('ff-core/button') // local @@ -41,14 +40,15 @@ const fontPicker = state => ]) const fontListing = state => - h('ul.inner', R.map(R.apply(fontRow(state)), R.toPairs(fonts))) + h('ul.inner', Object.entries(fonts).map( + ([key, value]) => fontRow(state, key, value) + )) -const fontRow = R.curry((state, key, font) => +const fontRow = (state, key, font) => h('li', { style: { fontFamily: font.family } - , on: {click: [state.font$, R.merge(font, {key: key})]} + , on: {click: [state.font$, {...font, key}]} }, font.name) -) const form = state => { var btn = button({ buttonText: 'Save Branding' , loading$: state.loading$ }) diff --git a/client/js/settings/index/email-settings/index.js b/client/js/settings/index/email-settings/index.js index 6dcb4ca28..033e21905 100644 --- a/client/js/settings/index/email-settings/index.js +++ b/client/js/settings/index/email-settings/index.js @@ -2,7 +2,6 @@ // npm const snabbdom = require('snabbdom') const flyd = require('flyd') -const R = require('ramda') const render = require('ff-core/render') const notification = require('ff-core/notification') const serializeForm = require('form-serialize') @@ -16,11 +15,8 @@ const view = require('./view') function init() { var state = { submit$: flyd.stream() } - // formSerialize will set checked boxes to "on" and unchecked boxes to "". We want it to be true/false instead - const formObj$ = R.compose( - flyd.map(obj => R.map(val => val === 'on' ? true : false, obj)) - , flyd.map(ev => serializeForm(ev.currentTarget, {hash: true, empty: true})) - )(state.submit$) + const intermediate = flyd.map(ev => serializeForm(ev.currentTarget, {hash: true, empty: true}, state.submit$)); + const formObj$ = flyd.map(obj => obj.map(val => val === 'on' ? true : false), intermediate); const path = `/nonprofits/${app.nonprofit_id}/users/${app.current_user_id}/email_settings` @@ -28,11 +24,11 @@ function init() { obj => request({ path, method: 'post' , send: {email_settings: obj} }).load , formObj$ ) - state.email_settings$ = flyd.map(R.prop('body'), request({method: 'get', path}).load) + state.email_settings$ = flyd.map((r) => r.body, request({ method: 'get', path }).load); state.loading$ = flyd.mergeAll([ - flyd.map(R.always(true), state.submit$) - , flyd.map(R.always(false), updateResp$) + flyd.map(() => true, state.submit$) + , flyd.map(() => false, updateResp$) ]) const notify$ = flyd.map(()=> 'Email notification settings updated.', updateResp$) diff --git a/client/js/settings/index/integrations/index.js b/client/js/settings/index/integrations/index.js index a39e36417..6dd55bbb0 100644 --- a/client/js/settings/index/integrations/index.js +++ b/client/js/settings/index/integrations/index.js @@ -1,6 +1,5 @@ // License: LGPL-3.0-or-later const h = require('snabbdom/h') -const R = require('ramda') const flyd = require('flyd') const request = require('../../../common/request') const colors = require('../../../common/colors') @@ -10,7 +9,7 @@ function init() { clickSync$: flyd.stream() , mailchimpKeyResp$: request({method: 'get', path: `/nonprofits/${app.nonprofit_id}/nonprofit_keys`, query: {select: 'mailchimp_token'}}).load } - state.mailchimpKey$ = flyd.map(R.prop('response'), flyd.filter(resp => resp.status === 200, state.mailchimpKeyResp$)) + state.mailchimpKey$ = flyd.map(r => r.response, flyd.filter(resp => resp.status === 200, state.mailchimpKeyResp$)) return state } diff --git a/client/js/settings/index/page.js b/client/js/settings/index/page.js index 80d642970..ece86fbcd 100644 --- a/client/js/settings/index/page.js +++ b/client/js/settings/index/page.js @@ -6,7 +6,6 @@ require('../../common/restful_resource') const render = require('ff-core/render') const h = require('snabbdom/h') -const R = require('ramda') const flyd = require('flyd') const snabbdom = require('snabbdom') const branding = require('./branding/index')