-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from tahmid-saj/dev-ts-calories-burned-context
migrating calories burned context to ts
- Loading branch information
Showing
3 changed files
with
119 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
src/contexts/signed-out/calories-burned/calories-burned.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
|
||
// calories burned types | ||
|
||
import { ReactNode } from "react"; | ||
|
||
export interface CaloriesBurnedContextType { | ||
trackedCaloriesBurned: TrackedCaloriesBurned[]; | ||
trackedCaloriesBurnedLength: number; | ||
selectedTrackedCaloriesBurned: TrackedCaloriesBurned | undefined; | ||
filterConditions: FilterConditions | undefined; | ||
trackedCaloriesBurnedView: TrackedCaloriesBurned[]; | ||
scheduledTrackedCaloriesBurnedView: TrackedCaloriesBurned[] | undefined; | ||
|
||
searchActivity: (trackedDayInfo: SearchActivityInput) => void; | ||
addTrackedActivityDate: (trackedDayInfo: AddTrackedActivityInput) => void; | ||
filterActivityDates: (filterConditions: FilterConditions) => void; | ||
removeActivityDate: (activityId: number) => void; | ||
clearActivityDatesFilter: () => void; | ||
|
||
selectScheduledTrackedCaloriesBurned: (dayTracked: string | Date) => void; | ||
|
||
searchActivityResults: SearchActivityResult[] | ||
|
||
trackedCaloriesBurnedSummary: TrackedCaloriesBurnedSummary | undefined; | ||
} | ||
|
||
export interface CaloriesBurnedProviderProps { | ||
children: ReactNode; | ||
} | ||
|
||
export type TrackedCaloriesBurned = { | ||
dateTracked: string | Date; | ||
activity: string; | ||
durationMinutes: number; | ||
caloriesBurnedPerHour: number; | ||
totalCaloriesBurned: number; | ||
activityId: number; | ||
} | ||
|
||
export type FilterConditions = { | ||
dateTracked: string | Date; | ||
activity: string; | ||
durationMinutes: string; | ||
} | ||
|
||
export type SearchActivityResult = { | ||
activity: string; | ||
searchedActivity: string; | ||
dateTracked: string | Date; | ||
caloriesBurnedPerHour: number; | ||
durationMinutes: number; | ||
totalCaloriesBurned: number; | ||
} | ||
|
||
export type TrackedCaloriesBurnedSummary = { | ||
dailyAverageCaloriesBurned?: number; | ||
mostCaloriesBurned?: { | ||
date: string | Date; | ||
caloriesBurned: number; | ||
activity: string; | ||
}, | ||
totalTrackedDays?: Set<string | Date>; | ||
totalTrackedActivities?: Set<string>; | ||
} | ||
|
||
export type SearchActivityInput = { | ||
activity: string; | ||
dateTracked: string | Date; | ||
weightPounds: string; | ||
durationMinutes: string; | ||
} | ||
|
||
export type AddTrackedActivityInput = { | ||
activity: string; | ||
searchActivity: string; | ||
dateTracked: string | Date; | ||
caloriesBurnedPerHour: string; | ||
durationMinutes: string; | ||
totalCaloriesBurned: string; | ||
} |
8 changes: 4 additions & 4 deletions
8
...culations/calories-burned.calculations.js → ...culations/calories-burned.calculations.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters