### CoCalc: Collaborative Calculation in the Cloud Copyright (C) 2016, Sagemath Inc. --- Site Customize -- dynamically customize the look of SMC for the client. ### {redux, Redux, rclass, rtypes, React} = require('./smc-react') {Loading} = require('./r_misc') schema = require('smc-util/schema') misc = require('smc-util/misc') theme = require('smc-util/theme') actions = redux.createActions('customize') defaults = misc.dict( ([k, v.default] for k, v of schema.site_settings_conf) ) store = redux.createStore('customize', defaults) # If we are running in the browser, then we customize the schema. This also gets run on the backend # to generate static content, which can't be customized. $?.get (window.app_base_url + "/customize"), (obj, status) -> if status == 'success' exports.commercial = obj.commercial = (obj.commercial?[0]?.toLowerCase() == 'y') # make it true if starts with y actions.setState(obj) HelpEmailLink = rclass displayName : 'HelpEmailLink' reduxProps : customize : help_email : rtypes.string propTypes : text : rtypes.string render: -> if @props.help_email {@props.text ? @props.help_email} else exports.HelpEmailLink = rclass displayName : 'HelpEmailLink-redux' propTypes : text : rtypes.string render: -> SiteName = rclass displayName : 'SiteName' reduxProps : customize : site_name : rtypes.string render: -> if @props.site_name {@props.site_name} else exports.SiteName = rclass displayName : 'SiteName-redux' render: -> SiteDescription = rclass displayName : 'SiteDescription' propTypes: style: rtypes.object reduxProps : customize : site_description : rtypes.string render: -> style = @props.style ? {color:'#666', fontSize:'16px'} if @props.site_description? {@props.site_description} else exports.SiteDescription = rclass displayName : 'SiteDescription-redux' propTypes : style : rtypes.object render: -> # TODO also make this configurable? Needed in the