mirror of
https://github.com/urosran/cally.git
synced 2025-07-10 15:17:17 +00:00
- Sorted the user progress chart by day
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import React, {useEffect, useState} from "react";
|
||||
import { BarChart } from "react-native-gifted-charts";
|
||||
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
|
||||
import {chartDayMap, weekOrder} from "@/constants/common";
|
||||
|
||||
const UserChart = ({ profileData }: {
|
||||
profileData: UserProfile | undefined;
|
||||
@ -19,13 +20,18 @@ const UserChart = ({ profileData }: {
|
||||
Sunday: 0,
|
||||
};
|
||||
|
||||
const data = Object.keys(weeklyDayPoints).map((day) => {
|
||||
// Sort by day
|
||||
const sortedWeeklyPoints = Object.fromEntries(
|
||||
weekOrder.map(day => [day, weeklyDayPoints[day]])
|
||||
);
|
||||
|
||||
const data = Object.keys(sortedWeeklyPoints).map((day) => {
|
||||
const value = weeklyDayPoints[day];
|
||||
|
||||
return {
|
||||
value: value,
|
||||
frontColor: barColor,
|
||||
label: day,
|
||||
label: chartDayMap[day],
|
||||
}
|
||||
});
|
||||
setDataList(data);
|
||||
|
Reference in New Issue
Block a user