For-0 / vocabustudy

Study Vocabulary, For Free.
https://vocabustudy.org
GNU General Public License v3.0
7 stars 4 forks source link

Account Based Preferences #191

Open ShreyanKhanna opened 2 years ago

ShreyanKhanna commented 2 years ago

Discussed in https://github.com/orgs/For-0/discussions/190

Originally posted by **ShreyanKhanna** October 25, 2022 I think it would be a good idea to make it so that the user can change how the Vocabustudy page looks for them such as colors, backgrounds, and patterns(of course we can keep things like the homepage the same) as well as control how many drag & drops, questions, etc. they want. I think that we can have this whole thing in the setting as well as move the light/dark mode there as well. I know it may be too early but just putting it out there for the future.
grimsteel commented 2 years ago

Right now, all of these are stored in localstorage, but the question is: What do you do if someone changes their preferences, and then signs into an account that already has preferences? Which ones do we keep?

ShreyanKhanna commented 2 years ago

you would put it as the one in the account also don't let them change it without an account

ShreyanKhanna commented 2 years ago

as it would be in the account setting which you can't access without an account so they wouldn't be able to change it

grimsteel commented 2 years ago

Ok So I will save their preferences when not logged in, but those will always be overridden by account level settings

grimsteel commented 1 year ago

I might as well make a schema

users collection:

ID preferences: map
uid1 see below

Preferences schema:

{
  "hue": 0-360, // or also theme in the future?
  "study_modes": {
    "flashcards": {
      "answer_with": 0-1,
      "starred": true/false
    },
    "learn": {
      "answer_with": 0-1,
      "starred": true/false
    },
    "test": {
      "answer_with": 0-1,
      "starred": true/false,
      "types": 1001 // bitmask
    },
    "match": {
      "answer_with": 0-1,
      "starred": true/false
    }
  },
  "starred": {
    "set_id": [1, 3, 5] // TODO: Rn this is a list of numbers. It would be better to use a bitmask
  }
}
grimsteel commented 1 year ago

All CRUD operations can only be done if document ID matches user ID

ShreyanKhanna commented 1 year ago

Right makes sense