Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Words Review Redesign #392

Merged
merged 43 commits into from
Jun 10, 2024
Merged

Words Review Redesign #392

merged 43 commits into from
Jun 10, 2024

Conversation

tfnribeiro
Copy link
Contributor

@tfnribeiro tfnribeiro commented May 30, 2024

This has become quite a large change, but I will try to summarize the changes included.

This requires API changes: zeeguu/api#156

Main features:

  • Users can now edit the words directly when they are in the review page when 10 or more words have been translated. This is done by toggling an edit mode where users can add or review words.
  • Paired with the previous feature, Zeeguu now prioritizes the top 10 most common words that the user translated to study in exercises. This is to limit the effect of a very long/difficult text where a user might reach the limit of 50 words.
  • Zeeguu no longer allows words composed of 3 words or more to be used in exercises. These long words become very difficult in certain exercises, or too obvious in others (Match or Multiple Choice).
  • The Star and Trash can have been removed throughout the app, to improve visual clarity.
  • The Star feature has now been replaced by a user_preference field which overrides, either positively or negatively the fit_for_study status.
  • The trash (deletion of the bookmark) is now part of the edit screen, consolidating all the edit options within a single screen.
  • The user can also use the edit screen to add a word to their exercises. This is done via a checkmark, and they can toggle it to either add/remove.
  • Added API endpoints that allow to override the backends fit_for_study when we want to limit the schedule to simply 10 words per article.
  • Added API endpoints to control the user_preference
  • Introduced a new InfoBox with an Icon to make it visually attractive and rounded the edges of all the info boxes to match the edges used in icons.
  • General refactorings

Screencaps:

Review Word Screen

Desktop Mobile
image image

Review Word Screen (Editing)

Desktop Mobile
image image

Review Word Screen - InfoBox after user Edits

image

Review Word Screen - InfoBox if no words for exercises

image

New Edit Word Screen

Desktop Mobile
image image

+ Select words for the user to study based on their frequency counts in the learning language. This will help avoid situations where the user translates a lot of words in a single article and these would take up the entire pipeline.
+ Allow more user control by allowing them to edit words.
+ As words get deleted they need to notify their parent that the element shouldn't be rendered, otherwise there is a small space leftover.
+ Added a modal with an explanation to how words are selected.
+ Include Word in Exercises is now an editable field
+ Slight change to the delete button.
Considerations to prioritize words:
1. The user is reading an article and leaves without clicking on the review words -> We need to prioritize them when the component is unmounted.
2. The user goes to the review screen -> Do not perform it when the component is unmounted and only do it in the review screen. (Avoid the delay between API calls).
- Added explanation that the App remembers user altered words to prioritize studying.
+ Less emphasis on the delete button
+ Added constant for Max exercises per article.
Whenever a user selects a word to study, use the star functionality to remember that the user wants to study that word.

This is done both in the Add/Minus and the Edit Form operations
Styling changes for Checkbox
Since the user may added bookmarks, update the number based on the wordsForExercises.
Added a title to word history
Remove console logging.
- Added a userPreference endpoint which will update the status with the user preferences.
- Moved the prioritize bookmarks to the API, as it is updating the status of the bookmarks in the backend
- Added enum to read the inputs from user preferences
- Fixing the toggle switching if the InfoBox changes during edits.
Copy link

netlify bot commented May 30, 2024

Deploy Preview for voluble-nougat-015dd1 ready!

Name Link
🔨 Latest commit ec3dd5a
🔍 Latest deploy log https://app.netlify.com/sites/voluble-nougat-015dd1/deploys/66632c141de9db000847ed37
😎 Deploy Preview https://deploy-preview-392--voluble-nougat-015dd1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@tfnribeiro
Copy link
Contributor Author

tfnribeiro commented May 31, 2024

One thing I thought about, which is worth considering: If the user edits words during review, should we reschedule words when they come back?

Example (This is from the DEV environment, so no translations):

Initial Screen:

image image

I remove 5 words:

image image

I reload the page:

image

We can see that the words that weren't selected and not altered by the user are re-added for the user to study. Is this a behaviour we want? Or if the user has edited any of the words, we "freeze" that state and don't change it unless the user edits them?

@mircealungu
Copy link
Member

One thing I thought about, which is worth considering: If the user edits words during review, should we reschedule words when they come back?

Example (This is from the DEV environment, so no translations):

Initial Screen:

image image

I remove 5 words:

image image

I reload the page:

image

We can see that the words that weren't selected and not altered by the user are re-added for the user to study. Is this a behaviour we want? Or if the user has edited any of the words, we "freeze" that state and don't change it unless the user edits them?

This is much more complicated than I've ever imagined :)

solutions

  1. we expect them to not reload the page; if they reload it's their problem
  2. we track their preference at the end of editing phase with some state representing "user-approved pre-pipeline bookmarks for article"?!
  3. we track their indiference wrt. some words, i.e. add another state to each bookmark that says: "ignored in the past"...

I am tempted to let 1 happen. Let's see how people use this feature first before investing more in it.

@tfnribeiro
Copy link
Contributor Author

@mircealungu But it's not that hard to implement the behavior of nothing changing. Here's how I did it:

image

This ensures if there is any bookmarks with user preference, then it's safe to assume the user has altered the original list - and that should cover most cases. This seeks to avoid the fact that I reduced the list to... say 2 words, and then I come back and have 10 again?

@tfnribeiro tfnribeiro linked an issue Jun 3, 2024 that may be closed by this pull request
@mircealungu mircealungu self-requested a review June 7, 2024 07:26
Copy link
Member

@mircealungu mircealungu left a comment

Choose a reason for hiding this comment

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

some discussion starters for you Tiago!

@@ -1,4 +1,6 @@
import { Zeeguu_API } from "./classDef";
import { MAX_BOOKMARKS_PER_ARTICLE } from "../exercises/ExerciseConstants";
Copy link
Member

Choose a reason for hiding this comment

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

max_bookmarks_to_study_from_article ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed!

const ContentOnRowModal = styled.div`
display: flex;
flex-direction: row;
align-items: center;
Copy link
Member

Choose a reason for hiding this comment

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

the only difference here is a narrower margin. Could we take that as a parameter? I've never done that for styled components, but see no reason why this would not be possible.

Alternatively, if we want a narrower margin, this needs not be only in the modal, so maybe rename to something like CoRNarrowMargin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, this is not needed anymore as it was part of styling for the Modal solution.

We can pass a parameter, but I think it would have to be overriden over style, not sure you can pass a value into a constant. Maybe you can make a function that return a styled.div?

@@ -1,2 +1,4 @@
export const MAX_EXERCISE_TO_DO_NOTIFICATION = 99;
export const MAX_EXERCISE_IN_LEARNING_BOOKMARKS = 50;
export const MAX_BOOKMARKS_PER_ARTICLE = 10;
Copy link
Member

Choose a reason for hiding this comment

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

MAX_BOOKMARKS_TO_STUDY_PER_ARTICLE ?

src/words/EditButton.js Outdated Show resolved Hide resolved
src/words/EditButton.js Show resolved Hide resolved
let newWordsExcludedExercises = [];
let newWordExpressions = [];
// Keep track how many words Zeeguu selected
let newTotalWordsSelectedByZeeguu = 0;
Copy link
Member

Choose a reason for hiding this comment

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

newTotalWordsSelectedByZeeguu... Can the Zeeguu selected word list change?

Copy link
Contributor Author

@tfnribeiro tfnribeiro Jun 7, 2024

Choose a reason for hiding this comment

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

This was the discussion we had, after we make different preferences the number can decrease or increase.

@@ -0,0 +1,195 @@
import Word from "./Word";
Copy link
Member

Choose a reason for hiding this comment

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

maybe take this one out.

useState(false);

useEffect(() => {
let newWordsForExercises = [];
Copy link
Member

Choose a reason for hiding this comment

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

I still think I would prefer if the local temporary variables would be named with _ in front of them instead of new. I'd be happy to join the search party (search-and-replace party) for all of them around the codebase :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think if you believe it will make more sense in the long run we can do that, we should do it - but maybe let's take this as it is and then do a replace that's just renaming?

);

const isNoWordsSelected = wordsForExercises.length === 0;
const isZeeguuSelectWords =
Copy link
Member

Choose a reason for hiding this comment

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

i know it's a predicate, but sounds bad in English. can we rename to hasZeeguuSelectedWords maybe?

totalWordsTranslated > MAX_BOOKMARKS_PER_ARTICLE &&
totalWordsEditedByUser === 0 &&
wordsForExercises.length > 0;
const isUserEditedWords =
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@mircealungu mircealungu merged commit aa8d9b9 into master Jun 10, 2024
4 checks passed
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.

More aggressively filter out words that get scheduled for practice
2 participants