-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(mileage-builder): break down large component file
- Loading branch information
Showing
4 changed files
with
62 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
export const DAY_ITEMS: { label: string; value: Day }[] = [ | ||
{ | ||
label: "Monday", | ||
value: "Monday", | ||
}, | ||
{ | ||
label: "Tuesday", | ||
value: "Tuesday", | ||
}, | ||
{ | ||
label: "Wednesday", | ||
value: "Wednesday", | ||
}, | ||
{ | ||
label: "Thursday", | ||
value: "Thursday", | ||
}, | ||
{ | ||
label: "Friday", | ||
value: "Friday", | ||
}, | ||
{ | ||
label: "Saturday", | ||
value: "Saturday", | ||
}, | ||
{ | ||
label: "Sunday", | ||
value: "Sunday", | ||
}, | ||
]; | ||
|
||
export const DEFAULT_INCREASE_PERCENTAGE = "10"; | ||
export const DEFAULT_RECOVERY_WEEK_PERCENTAGE = "80"; | ||
export const DEFAULT_RECOVERY_WEEK_FREQUENCY = "3"; | ||
export const DEFAULT_LONG_RUN_PERCENTAGE = "30"; |
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
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,8 @@ | ||
export type Day = | ||
| "Monday" | ||
| "Tuesday" | ||
| "Wednesday" | ||
| "Thursday" | ||
| "Friday" | ||
| "Saturday" | ||
| "Sunday"; |
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,9 @@ | ||
export const formatMileage = (mileage: number, roundDecimals: boolean) => { | ||
if (mileage === 0) { | ||
return "Rest"; | ||
} | ||
if (roundDecimals) { | ||
return Math.round(mileage); | ||
} | ||
return mileage.toFixed(2); | ||
}; |