Closed michalstruck closed 7 months ago
What is even more problematic here, is how to handle the product
's index. Consider this:
product
s' indexes, after we reorder the categories, so that b has an index of 1 and a has an index of 2?product
s, or moved it to a different one?The index should refer to a place within the category, so there would be doubles, I don't see an issue with that. The categories themselves should have an ordering mechanism of it's own.
Nothing should happen to product indexes when the categories are reordered.
When the category of a product is changed, if the drag and drop UI allows for moving to a specific place within a category, just insert it at that index, move the other products, etc. if not, just insert it at the bottom of the category. Same goes for uncategorizing, just treat the null category as a category that is displayed at the bottom, and products can still have a specified order within it.
@felix-lipski alright then, ready to develop then
https://svelte.dev/repl/b225504c9fea44b189ed5bfb566df6e6?version=4.2.12 This may be taken as an inspiration/code example. Consider using a dnd library, but may not be necessary
EDIT: https://github.com/PuruVJ/neodrag this looks promising, with some nice QOL features available out of the box
closed by #137
Here comes the lovely UI part, we need to figure out how to nicely display this. My idea was to create a drag'n'drop creator similar to a kanban board, with the products being displayed at the top, outside the board. The downside of this is that we'd have limited space, and I'm not sure how to handle overflow - push it to next row, creating something like a grid? We could also flip the board 90deg, so that categories can be added at the bottom infinitely - to be discussed.