 
 ProjectsFilterButtons = rclass
     propTypes:
-        hidden : rtypes.bool.isRequired
-        deleted : rtypes.bool.isRequired
-        hidden_project_list : rtypes.array
+        hidden        : rtypes.bool.isRequired
+        deleted       : rtypes.bool.isRequired
 
     getDefaultProps: ->
         hidden : false
         deleted : false
 
-    hiddenClicked: ->
-        if @props.hidden
-            flux.getActions('projects').setTo
-                hidden : false
-                hashtags : update_hashtags(store.state.project_list)
-        else
-            flux.getActions('projects').setTo
-                hidden : true
-                hashtags : (if store.state.hidden_project_list? then update_hashtags(store.state.hidden_project_list) else {})
-        #TODO: improve to not render twice
-        if not @props.hidden_project_list?
-            update_project_list()
-
-    deletedClicked: ->
-        flux.getActions('projects').setTo
-            deleted : not @props.deleted
-            hashtags : update_hashtags(store.state.project_list, not @props.deleted)
-
     render: ->
         <Col sm=5>
             <ButtonGroup style={marginTop: "1ex"} className="pull-right">
                 <Button bsStyle={if @props.deleted then 'warning' else 'info'}
-                        onClick={@deletedClicked}>
+                        onClick={=>flux.getActions('projects').setTo(deleted: not @props.deleted)}>
                     <Icon name="trash" /> Deleted
                 </Button>
                 <Button bsStyle={if @props.hidden then 'warning' else 'info'}
-                        onClick={@hiddenClicked}>
+                        onClick={=>flux.getActions('projects').setTo(hidden: not @props.hidden)}>
                     <Icon name="eye-slash" /> Hidden
                 </Button>
             </ButtonGroup>

        </Col>

parse_project_tags = (project) ->
    misc.parse_hashtags((project.title + ' ' + project.description).toLowerCase())

parse_project_search_string = (project) ->
    search = (project.title + ' ' + project.description).toLowerCase()


    render: ->
        <Button onClick={@show_all_projects} bsStyle="info" bsSize="large">Show all matching projects...</Button>

ProjectList = rclass
    propTypes:
        projects : rtypes.array.isRequired

    getDefaultProps: ->
        projects : []

    render_row: (project, key) ->
        <ProjectRow project={project} key={key}/>

    render_list: ->
        MAX_DEFAULT_PROJECTS = 50
        listing = []
        i = 0
        for project in @props.projects
            #TODO
            if i >= MAX_DEFAULT_PROJECTS
                listing.push <ShowAllMatchingProjectsButton show_all={@props.show_all}/>
                break
            i += 1
            listing.push @render_row(project, i)
        return listing

    render: ->
        <Col sm=12>
