Skip to content

Conversation

@TatiannaWS
Copy link

Adds a button to the header of each lane that allows users to “hide” lanes they don't need.

Everything should match surrounding code styles, with the exception of line 39 of apps/reducers/ui.js. I couldn’t figure out how to target specific lanes using existing code, so there might be a better way to do it.

onTaskUpdated: (task, updateAsana) => {
dispatchProps.onTaskUpdated(task, id, currentProjectId, updateAsana);
},
onSwimlaneToggle: (id) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mergeProps function is only required when you need to access the container's state props in themapDispatchToProps as to my knowledge it isn't possible in mapDispatchToProps. As you don't need access the state props due to the swimlane id being passed through from the component the duplication isn't necessary as the function you declared above will be used. If you look at the end of mergeProps you'll see them all being merged together.

@alexdunne
Copy link
Contributor

Hey,

Thanks for the commit good work, just looking through now. Regarding the UI I think maybe a chevron approach my work better. Sadly our designer (@tomstarley) is on holiday at the moment so won't be able to chip in for a while.

Possible option:
screen shot 2016-07-20 at 12 58 56

return Object.assign({}, state, { showTaskDetailsSidebarLoading: false });
}
case 'TOGGLE_SWIMLANE': {
return document.querySelector('section[data-reactid*="'+action.payload.id+'"]').classList.toggle('swimlane--collapsed');
Copy link
Contributor

@alexdunne alexdunne Jul 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reducers aren't intended to update the UI in this way, what would be better is if each swimlane had a visible property, then the TOGGLE_SWIMLANE case would update the value accordingly. Then in Swimlane/index.jsxyou'd check the visible value for the prop and add the class there.

Let me know if you want some help with that 😄 .

For future reference reducers should only be used to update the state tree. http://redux.js.org/docs/basics/Reducers.html

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally had a property called swimlaneCollapsed that did this. The trouble I had was targeting specific lanes - I could expand/collapse all lanes, but not just one. I'll look at the docs you linked and keep trying :-)

@TatiannaWS
Copy link
Author

Added a new commit with the property-based toggle I tried originally and the line updates you mentioned. The problem now is that TOGGLE_SWIMLANE doesn't target a specific swimlane - it acts as a collapse all. Can you help with that?

onTaskUpdated: (task, updateAsana) => {
dispatchProps.onTaskUpdated(task, id, currentProjectId, updateAsana);
},
onSwimlaneToggle: (id, collapsed) => {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still unnecessary? I don't think I fully understand what mergeProps and mapDispatchToProps do.

@alexdunne
Copy link
Contributor

alexdunne commented Jul 21, 2016

Good job, this definitely is more react/reduxy.

At the moment the ui reducer is more of a global ui rather than a specific component ui, so things like showing loading spinners or opening the sidebar when a card is clicked (granted the latter is kinda still component specific).

What you need to do is change the state on that one swimlane (aka section) entity. To do this you'll want to go into sections.js and you'll see a records reducer. Here you'll want to add the TOGGLE_SWIMLANE_COLLAPSED switch case and then use one of the examples to flip a boolean on the swimlane. Then to reflect the change of state you'll need to update the SwimlaneContainer to look for the isCollapsed value for that specific swimlane rather than the global state.ui.

Finally, as this is a toggle you shouldn't have to pass in a boolean to specify which way to toggle, the view should receive the event, which in turn will run an action with the swimlane's id and then the reducer should toggle the current state like so
state[params.id].isCollpased = !state[params.id].isCollpased
If you wanted to could add specific SET_SWIMLANE_COLLPASED and SET_SWIMLANE_OPEN or similar but that isn't required.

Let me know if you need any help 😄

As a side note the project structure may seem confusing which is mainly down to me as I was learning react/redux whilst creating this project. I intend to clean it up when I get a chance.

@TatiannaWS
Copy link
Author

This is the first time I've used React/Redux so I'm learning too. This seemed like a small enough project with a small enough team that I could try to help out (and in doing so work on building my web dev skills 😄) and at the same time, this product is something my team could really use. We're a newly agile team in a department that has been mandated to use Asana for task management and I've been tasked with making it work. Kasban seems like it might be a good solution once it gets a little more fleshed out.

@tomstarley
Copy link
Collaborator

tomstarley commented Jul 27, 2016

Hey both! I'm back. How best can i review what's been done? Thanks for the help Tatianna! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants