packstack
packstack copied to clipboard
Users can exclude custom categories from base weight
This is the first bit of my work on https://github.com/maplethorpej/packstack/issues/11.
I have worked off https://github.com/maplethorpej/packstack/pull/42 as I like @darinalleman's toggle feature 😄 so this PR will need to wait for that one.
For this feature to be complete, I believe it needs the following:
- [x] When creating a new Category as part of an Inventory Item create, users should be able to toggle to exclude that category from the base weight.
- [ ] When editing an Item (via the
edit itemmodal) and moving it to a new custom category, users should be able to toggle to exclude that category from the base weight. - [ ] In the Inventory display table, users should be able to click the name of their custom category and see something giving them the option (toggle) to change the exclude_weight field of their category. (There should also be a warning about how changing this value will affect all Items in that category.)
- [x] In the Inventory and Pack display tables, there should be an indicator to show that the category is excluded from base weight. (eg
CAT NAME (excluded from base weight)or a cute icon) - [x] In the Pack weight breakdown, items in custom categories which are excluded from weight, should not be counted as part of the "Worn" or "Consumable" weights, but have a separate breakdown row. (If a pack has no custom categories with excluded weights, this row should not appear in the breakdown.)
I have done the easy bits (see demo below), but the others are trickier: I may actually need to learn some React rather than simply going by trial-and-error/guesswork on how things wire together 😅 . Any tips/help (especially with the 3rd task which is killing me) would be awesome 🙏 .
https://user-images.githubusercontent.com/8898786/107118827-3ab2e200-687b-11eb-8fd0-e9a4299ebd75.mov
Wow, this looks really clean!
For the 3rd task, are you looking more for UI suggestions or for more of the code side of things?
Code side mainly, I have a good idea of how I want things to look. I think what I need to do (as in would be the tidiest pattern, I'm sure there are lazier ways) is have a new component which will handle users updating that one option on their category. I have zero web dev/FE/react experience so I thought I would use the EditItem component as a template, which is helpful but also confusing as I can tell there is a lot of non-explicit things happening which I don't have background context for.
Oh I see what you mean. I feel you, I didn't have any react experience before working on Packstack either. I'm still definitely in the trial-and-error/guesswork phase too 😂 I'll try forking off your branch and see if I can figure something out.
Although, I'm kinda wondering if there is any other things that we'd want to allow users to edit with categories, that maybe we would also want to allow users to edit the name of the category too. I don't know if there is anything else we'd want them to edit but if it's just the name and toggling whether or not it's included in the baseweight, I think we could get away with it not being in a popup at all. I'm thinking like, it could be just inline. So maybe you click an "edit" button on the category header row and then the category name becomes a text box and the 'include in baseweight' toggle also appears. The edit button turns in to a 'save' button, and a cancel button appears, kinda like how inline editing items currently works.
A lot of word vomit there. We can probably chat on Slack or whatever else works for you if you wanna hash this out a bit more.
I don't know if there is anything else we'd want them to edit (...) So maybe you click an "edit" button on the category header row and then the category name becomes a text box and the 'include in baseweight' toggle also appears. The edit button turns in to a 'save' button, and a cancel button appears, kinda like how inline editing items currently works.
Yeh you are probably right that there wont be much to edit for categories. Also maybe this is simpler to implement and I was just making things difficult for myself 😂 . I will hopefully have time to get back to this this weekend, I will ping you on slack.