 
 # the json from the server, where the entries for the documents are
 # double-nested objects (two hiearchies of categories) mapping to title/code/description documents
-data = null
+DATA = null
 
 # react wizard
 {React, ReactDOM, redux, Redux, Actions, Store, rtypes, rclass} = require('./smc-react')

        "#{name}" :
            show        : rtypes.bool
            lang        : rtypes.string
            data        : rtypes.object
            search      : rtypes.string
            nav_entries : rtypes.array

    propTypes :
        cb      : rtypes.func
        actions : rtypes.object.isRequired
        cat0    : rtypes.number
        cat1    : rtypes.number

    getInitialState : ->
        search  : ''

               <WizardHeader actions={@props.actions} lang={@props.lang} nav_entries={@props.nav_entries} />
            </Modal.Header>

            <WizardBody actions    = {@props.actions}
                        lang       = {@props.lang}
                        code       = {@props.code}
                        descr      = {@props.descr}
                        cat0       = {@props.cat0}
                        cat1       = {@props.cat1}
                        cat2       = {@props.cat2}
                        catlist0   = {@props.catlist0}
                        catlist1   = {@props.catlist1}
                        catlist2   = {@props.catlist2}
                        data       = {@props.data} />

            <Modal.Footer>
                <Button onClick={@props.actions.hide}>Cancel</Button>
                <Button onClick={=> @props.actions.insert(@props.cb)} bsStyle='success'>Insert Code</Button>
            </Modal.Footer>
        </Modal>

exports.render_wizard = (target, project_id, path, lang = 'sage', cb = null) ->
    name = redux_name(project_id, path)
    actions = redux.getActions(name)
    if not actions?
        actions = redux.createActions(name, WizardActions)
        store   = redux.createStore(name)
    actions.init(lang=lang)
    W = RWizard(name)
    ReactDOM.render(<Redux redux={redux}><W cb={cb} actions={actions}/></Redux>, target)
    return actions

# old wizard code
