Add demo seed data and improve insights (Weekly Summary + HeatMap)#19
Add demo seed data and improve insights (Weekly Summary + HeatMap)#19Teerthesh-Meda wants to merge 4 commits into
Conversation
|
Hi @iNikAnn 👋 Thanks for building DoHabit — really liked the clean UI and idea behind it. I noticed that on first launch the dashboard feels empty, so I added:
These changes aim to improve first-time user experience and make the app feel more engaging immediately. Please let me know if you’d like any changes, refinements, or a different data structure. |
|
Thanks for the PR — I’ll need a bit to check everything and will ping you if I have questions 👍 |
|
Hey — thanks for the PR. A few quick points:
Please keep formatting/indentation consistent and add brief explanations for large or unclear changes. Maybe consider splitting this into several smaller PRs and landing them one by one, making sure functionality isn’t broken? Thanks. |
|
Thanks a lot for the detailed review and the helpful feedback 🙏 I currently have exams, so I’ll need a little time before I can properly address all the points you mentioned (tabs vs spaces, reducer fix, UI adjustments, etc.). I’ll come back to this as soon as my exams are done and will update the PR accordingly. |
|
Hi @iNikAnn, Thanks again for the detailed feedback. I’ve addressed the issues you mentioned: • Restored the original habit data structure to prevent runtime errors The app now runs without crashes and the new components render properly. Please let me know if you’d like me to split the changes into smaller PRs or make further adjustments. Thanks again for your time and review! |
iNikAnn
left a comment
There was a problem hiding this comment.
This PR is too big. Next time, please make small PRs: one for fixes, one for each new feature. It's much easier to check.
Also, please test your code. There are many simple bugs with the UI and math.
I left many comments in the files. Take a look.
There was a problem hiding this comment.
What is the purpose of this refactor? It looks like purely cosmetic renaming with no functional changes.
There was a problem hiding this comment.
There are no functional changes in this file. Please avoid changing the formatting if you are not fixing the logic.
There was a problem hiding this comment.
What was the goal of this change? You completely removed the essential logic for filtering incomplete days. Why?
There was a problem hiding this comment.
WeeklySummary and HeatMap belong in MainPage, not here in App routes. Please move them there. Also, if you start the app from scratch with no habits, your components appear on top of the "create first habit" banner. Please fix this bug.
ps: Please don't change formatting (tabs and empty lines) because it adds unnecessary noise to the PR.
| @@ -0,0 +1,84 @@ | |||
| // src/utils/dateUtils.js | |||
There was a problem hiding this comment.
We already have this utility. Please don't duplicate code and use getFormattedDate.js instead.
ps: Yes, it has a small bug where padStart uses a number instead of a string, but let's just use one file.
There was a problem hiding this comment.
The HeatMap is a cool idea, but the logic and UI need a lot of work.
Logic: Your current calculation is wrong. If I have 3 habits with frequency 2, and I do each one once, I finished 0 habits. But your map shows "3" and marks me as a hero. We should count only fully completed habits (where progress >= frequency).
Calculation: Using a percentage (ratio) is also problematic because archiving or adding new habits will break the old history. Let's just count the absolute number of completed habits per day and use that for the levels (e.g., 1, 2, 3+).
If you disagree, explain your point of view.
UI/UX: Did you test this in the browser?
- It doesn't support dark mode.
- The borders don't match our design.
- The cells are vertical and take up the whole screen, so I can't even see the habits.
ps: I left other comments in the file.
| import { useHabitsStore } from "../stores/habitsStore"; | ||
| import { getPastDays } from "../utils/dateUtils"; | ||
| import "./HeatMap.css"; | ||
|
|
There was a problem hiding this comment.
Stop summing raw progress. We only count a habit as "done" if progress >= frequency.
const DAYS_COUNT = 30;
const days = getPastDays(DAYS_COUNT);
export default function HeatMap() {
const habits = useHabitsStore((s) => s.habits ?? []);
const activity = {}
habits.forEach((habit) => {
habit.completedDays?.forEach((d, i) => {
// Only check the latest 30 entries
if (i >= DAYS_COUNT) return;
const isCompleted = d.progress >= habit.frequency;
if (isCompleted) {
activity[d.date] = (activity[d.date] || 0) + 1;
}
});
});
...
}| <div className="hm-grid"> | ||
| <div className="hm-row"> | ||
| {days.map((d) => { | ||
| const value = activity[d] || 0; |
There was a problem hiding this comment.
UI: Fixed the cell classes to use level-X format. Please fix the CSS: the grid should be horizontal, support dark mode, and remove the unnecessary borders.
const completedCount = activity[d] ?? 0;
let level = 0;
if (completedCount === 1) level = 1;
else if (completedCount === 2) level = 2;
else if (completedCount >= 3) level = 3;
return <div key={d} className={`hm-cell level-${level}`} />;There was a problem hiding this comment.
Please redo the styles to match our Habit component and ensure proper Dark Mode support. Update the selectors to use the new .level-x classes and fix the layout to be a horizontal grid instead of a vertical list. Avoid unnecessary borders and use tabs for indentation.
There was a problem hiding this comment.
Isn't this just a 7-day version of the HeatMap? The math is incorrect and the UI is broken (overflowing the screen...), so it doesn't really add any value right now.
If you have a specific idea for this, let’s discuss it, but currently, it feels redundant. I think it’s better to remove it.
What’s included
This PR adds demo seed data and introduces visual insights to improve the initial user experience.
✨ Key changes
dateUtils) and styles for the new components🧠 Why this change
🧪 Testing
📸 Screenshots
(Attach screenshots if needed)
Looking forward to your feedback 🙂