Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
chensoul committed Sep 3, 2024
1 parent 2961e59 commit e33a3d9
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 28 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/run_data_sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ env:
# please change to your own config.
RUN_TYPE: strava # support strava/nike/garmin/coros/garmin_cn/garmin_sync_cn_global/keep/only_gpx/only_fit/nike_to_strava/strava_to_garmin/tcx_to_garmin/strava_to_garmin_cn/garmin_to_strava/garmin_to_strava_cn/codoon/oppo, Please change the 'pass' it to your own
ATHLETE: chensoul
TITLE: Running
MIN_GRID_DISTANCE: 10 # change min distance here
TITLE_GRID: Over 10km Runs # also here
TITLE: Exercise
MIN_GRID_DISTANCE: 5 # change min distance here
TITLE_GRID: Over 5km Exercises # also here
GITHUB_NAME: chensoul # change to yours
GITHUB_EMAIL: chensoul.eth@gmail.com # change to yours
GITHUB_EMAIL: ichensoul@gmail.com # change to yours

# IGNORE_BEFORE_SAVING: True # if you want to ignore some data before saving, set this to True
IGNORE_START_END_RANGE: 10 # Unit meter
IGNORE_START_END_RANGE: 5 # Unit meter
# Dont making this huge, just picking points you needing. https://developers.google.com/maps/documentation/utilities/polylineutility using this tool to making your polyline
IGNORE_POLYLINE: 'ktjrFoemeU~IorGq}DeB'
IGNORE_RANGE: 10 # Unit meter
IGNORE_RANGE: 5 # Unit meter
SAVE_DATA_IN_GITHUB_CACHE: false # if you deploy in the vercal, check the README
DATA_CACHE_PREFIX: 'track_data'
BUILD_GH_PAGES: true # If you do not need GitHub Page please set it to `false`
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/images/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Running Page</title>
<title>Exercise Page</title>
</head>
<body>
<div id="root"></div>
Expand Down
4 changes: 2 additions & 2 deletions src/static/site-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ interface ISiteMetadataResult {
}

const data: ISiteMetadataResult = {
siteTitle: 'ChenSoul Run',
siteUrl: 'https://run.chensou.cc',
siteTitle: 'ChenSoul Exercise',
siteUrl: 'https://run.chensoul.cc',
logo: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQTtc69JxHNcmN1ETpMUX4dozAgAN6iPjWalQ&usqp=CAU',
description: 'Personal site and blog',
navLinks: [
Expand Down
14 changes: 13 additions & 1 deletion src/utils/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const IS_CHINESE = true;
const USE_ANIMATION_FOR_GRID = false;
const CHINESE_INFO_MESSAGE = (yearLength: number, year: string): string => {
const yearStr = year === 'Total' ? '所有' : ` ${year} `;
return `我用 App 记录自己跑步 ${yearLength} 年了,下面列表展示的是${yearStr}的数据`;
return `我用 App 记录自己的运动(跑步、骑行)已经 ${yearLength} 年了,下面列表展示的是${yearStr}的数据`;
};
const ENGLISH_INFO_MESSAGE = (yearLength: number, year: string): string =>
`Running Journey with ${yearLength} Years, the table shows year ${year} data`;
Expand All @@ -66,6 +66,12 @@ const MIDDAY_RUN_TITLE = IS_CHINESE ? '午间跑步' : 'Midday Run';
const AFTERNOON_RUN_TITLE = IS_CHINESE ? '午后跑步' : 'Afternoon Run';
const EVENING_RUN_TITLE = IS_CHINESE ? '傍晚跑步' : 'Evening Run';
const NIGHT_RUN_TITLE = IS_CHINESE ? '夜晚跑步' : 'Night Run';
const MORNING_RIDE_TITLE = IS_CHINESE ? '清晨骑行' : 'Morning Ride';
const MIDDAY_RIDE_TITLE = IS_CHINESE ? '午间骑行' : 'Midday Ride';
const AFTERNOON_RIDE_TITLE = IS_CHINESE ? '午后骑行' : 'Afternoon Ride';
const EVENING_RIDE_TITLE = IS_CHINESE ? '傍晚骑行' : 'Evening Ride';
const NIGHT_RIDE_TITLE = IS_CHINESE ? '夜晚骑行' : 'Night Ride';
const DEFAULT_TITLE = IS_CHINESE ? '运动' : 'Exercise';

const RUN_TITLES = {
FULL_MARATHON_RUN_TITLE,
Expand All @@ -75,6 +81,12 @@ const RUN_TITLES = {
AFTERNOON_RUN_TITLE,
EVENING_RUN_TITLE,
NIGHT_RUN_TITLE,
MORNING_RIDE_TITLE,
MIDDAY_RIDE_TITLE,
AFTERNOON_RIDE_TITLE,
EVENING_RIDE_TITLE,
NIGHT_RIDE_TITLE,
DEFAULT_TITLE
};

export {
Expand Down
52 changes: 34 additions & 18 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,25 +190,41 @@ const geoJsonForMap = (): FeatureCollection<RPGeometry> => ({
const titleForRun = (run: Activity): string => {
const runDistance = run.distance / 1000;
const runHour = +run.start_date_local.slice(11, 13);
if (runDistance > 20 && runDistance < 40) {
return RUN_TITLES.HALF_MARATHON_RUN_TITLE;
}
if (runDistance >= 40) {
return RUN_TITLES.FULL_MARATHON_RUN_TITLE;
}
if (runHour >= 0 && runHour <= 10) {
return RUN_TITLES.MORNING_RUN_TITLE;
}
if (runHour > 10 && runHour <= 14) {
return RUN_TITLES.MIDDAY_RUN_TITLE;
}
if (runHour > 14 && runHour <= 18) {
return RUN_TITLES.AFTERNOON_RUN_TITLE;
}
if (runHour > 18 && runHour <= 21) {
return RUN_TITLES.EVENING_RUN_TITLE;

if (run.type == 'Run'){
if (runDistance > 20 && runDistance < 40) {
return RUN_TITLES.HALF_MARATHON_RUN_TITLE;
}
if (runDistance >= 40) {
return RUN_TITLES.FULL_MARATHON_RUN_TITLE;
}
if (runHour >= 0 && runHour <= 10) {
return RUN_TITLES.MORNING_RUN_TITLE;
}
if (runHour > 10 && runHour <= 14) {
return RUN_TITLES.MIDDAY_RUN_TITLE;
}
if (runHour > 14 && runHour <= 18) {
return RUN_TITLES.AFTERNOON_RUN_TITLE;
}
if (runHour > 18 && runHour <= 21) {
return RUN_TITLES.EVENING_RUN_TITLE;
}
} else if (run.type == 'Ride'){
if (runHour >= 0 && runHour <= 10) {
return RUN_TITLES.MORNING_RIDE_TITLE;
}
if (runHour > 10 && runHour <= 14) {
return RUN_TITLES.MIDDAY_RIDE_TITLE;
}
if (runHour > 14 && runHour <= 18) {
return RUN_TITLES.AFTERNOON_RIDE_TITLE;
}
if (runHour > 18 && runHour <= 21) {
return RUN_TITLES.EVENING_RIDE_TITLE;
}
}
return RUN_TITLES.NIGHT_RUN_TITLE;
return RUN_TITLES.DEFAULT_TITLE;
};

export interface IViewState {
Expand Down

0 comments on commit e33a3d9

Please sign in to comment.