iSoron / uhabits

Loop Habit Tracker, a mobile app for creating and maintaining long-term positive habits
GNU General Public License v3.0
7.8k stars 933 forks source link

New feature: Allow users to create groups of habits #2020

Open dharux opened 2 months ago

dharux commented 2 months ago

Features

  1. Creation of habit groups: There is a third option in the habit type picker, which creates groups
  2. Attributes of habit groups: name, color, question, reminder, notes. These attributes are set in the edit habit screen.
  3. Create new sub-habits into a group: There is a plus button on the right side of the habit group, which adds habits to the group. On tapping it, it opens the habit type picker but without the option of habit groups.
  4. Transfer of existing habits into groups: select the required habits (can also be sub-habits), top on the options button, select "Add to group" and select the desired group
  5. Removal of sub-habits from groups: select the desired sub-habits and select "Remove from group" from the options menu.
  6. Displaying habit groups and sub-habits: All main habits are displayed together at the top, followed by habit groups. The habit group card contains a score ring, name, add button, collapse button. Below the habit group card, are displayed the cards of the habits contained in it. In these cards, the score ring and name are indented a bit to the right to show that they are sub habits.
  7. Collapsing habit groups: On the rightmost of the habit group card is a caret button. Tapping this will collapse the habit group and remove all the sub-habits from display. The caret is rotated 90 deg to indicate this. Tapping again will expand the group.
  8. Displaying a habit group: On tapping on the empty space on a habit group card opens the habit group. If the group is empty, a message is displayed indicating so. If the group does contain any sub-habits, the overview, score and frequency cards are displayed. The score is obtained by simply taking an average of the scores of the individual sub-habits. Frequency of each sub-habit is normalized by their target and then taken an average of. If the group contains only subhabits of only one type, then a history bar card is also displayed. This sums up the entries of all sub-habits. If the sub-habits of the group are all boolean, then a streak card is also displayed. The streaks are calculated as intersections of streaks of all sub-habits. If all sub-habits are instead numerical, then a target card is also displayed. This is calculated by a simple sum of all sub-habits.
  9. Sorting of groups and sub-habits: All standalone habits are displayed at the top and their sorting is unaffected. Sub-habits within groups are sorted with each other and are displayed under their group. The groups themselves can be sorted by all properties, and they reorder accordingly.
  10. Sorting manually: Sub-habits can be dragged and dropped within the group manually. Habit groups can also be dragged and dropped on other habit groups to reorder it.
  11. Habit group score ring: The score ring is updated when a new sub-habit is added, removed, modified or an entry is added to it.
  12. Widgets: The score and frequency widgets are available for habit groups too
  13. Notifications: Reminder notifications are displayed for habit groups as well. Tapping on the notification opens up the habit group. Tapping on the "enter" button opens the main list screen and clears the notification.

Implementation

Will follow soon

To do

hiqua commented 2 months ago

@iSoron given that this is quite big already, I'm sure this could use a quick review from you to say whether you'd be fine with the general principle or if you already dislike some of this and the overall direction.

hiqua commented 2 months ago

@dharux thanks a lot for your contribution! I see you're implementing quite a lot of features already; I'd suggest to keep it as simple as possible, to the extent that it makes sense. Just as an example, handling habit groups in widget could definitely come later, as another PR. This would make the review more manageable, and this PR more likely to be accepted IMHO.