lakesare / memcode

Spaced-repetition: with real formatting.
http://memcode.com
MIT License
330 stars 71 forks source link

Enable card reordering on newest-first sort-order #106

Closed daniel-eder closed 3 years ago

daniel-eder commented 3 years ago

Enable reordering cards via drag and drop when sorting by newest-first, as mentioned in https://github.com/lakesare/memcode/issues/60#issuecomment-699874466

Tested in GitPos with a fairly simple scenario (10 cards) and an imported course from the productive site (250 cards). Performance seems good (no worse than that amount of quill editors causes on their own), but we might have to revisit how the cards are reversed in renderOldProblemsToEdit if larger courses show any trouble.

lakesare commented 3 years ago

When the order is reversed indexing should come reversed too, e.g. this should be 120, 119, 118 etc.

image

lakesare commented 3 years ago

I think index={this.props.flashcardOrder ? this.props.problems.length - this.props.index : this.props.index} should help for <Checkbox/>, gonna add it & enable reversed ordering by default while I'm at it 👍

lakesare commented 3 years ago

Done - https://github.com/lakesare/memcode/commit/42a417a8fdc996b530a06c3609e4cff784290912. About problems.slice(0).reverse() - I think that's the best solution here (just because .map is easier to read that any potential for in in react), and it carries little to no performance hit. We could also reverse this.state.speCourses.payload.problems potentially as a solution, but I think we're good.

daniel-eder commented 3 years ago

I think index={this.props.flashcardOrder ? this.props.problems.length - this.props.index : this.props.index} should help for <Checkbox/>, gonna add it & enable reversed ordering by default while I'm at it 👍

That's the < 100% focus I was talking about in effect :) Thanks for fixing it!