Skip to content

Commit

Permalink
fix: ts type error (yihong0618#622)
Browse files Browse the repository at this point in the history
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
  • Loading branch information
yihong0618 authored and Kugin committed Sep 13, 2024
1 parent 9358de9 commit 95638c6
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ RUN npm config set registry https://registry.npm.taobao.org \
&&corepack enable \
&&pnpm install



FROM develop-py AS data
ARG app
ARG nike_refresh_token
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@
"url": "https://github.com/yihong0618/running_page"
},
"devDependencies": {
"@types/geojson": "^7946.0.14",
"@types/mapbox__polyline": "^1.0.2",
"@types/node": "^20.3.3",
"@types/prop-types": "^15.7.11",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@typescript-eslint/parser": "^5.59.2",
Expand Down
20 changes: 13 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/components/RunMap/LightsControl.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import styles from './style.module.scss';

interface ILightsProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/RunMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const RunMap = ({
const keepWhenLightsOff = ['runs2']
function switchLayerVisibility(map: MapInstance, lights: boolean) {
const styleJson = map.getStyle();
styleJson.layers.forEach(it => {
styleJson.layers.forEach((it: { id: string; }) => {
if (!keepWhenLightsOff.includes(it.id)) {
if (lights)
map.setLayoutProperty(it.id, 'visibility', 'visible');
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useHover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const useHover = (): HoverHook => {

const eventHandlers = {
onMouseOver() {
setTimer(setTimeout(() => setHovered(true), 700));
setTimer(setTimeout(() => setHovered(true), 500)); // 500ms delay
},
onMouseOut() {
clearTimeout(timer);
Expand Down
16 changes: 9 additions & 7 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export interface Activity {
name: string;
distance: number;
moving_time: string;
type: 'Run';
type: string;
start_date: string;
start_date_local: string;
location_country: string;
summary_polyline: string;
average_heartrate?: number;
location_country?: string|null;
summary_polyline?: string|null;
average_heartrate?: number|null;
average_speed: number;
streak: number;
}
Expand Down Expand Up @@ -147,6 +147,9 @@ const intComma = (x = '') => {

const pathForRun = (run: Activity): Coordinate[] => {
try {
if (!run.summary_polyline) {
return [];
};
const c = mapboxPolyline.decode(run.summary_polyline);
// reverse lat long for mapbox
c.forEach((arr) => {
Expand Down Expand Up @@ -271,10 +274,9 @@ const filterAndSortRuns = (
};

const sortDateFunc = (a: Activity, b: Activity) => {
// @ts-ignore
return (
new Date(b.start_date_local.replace(' ', 'T')) -
new Date(a.start_date_local.replace(' ', 'T'))
new Date(b.start_date_local.replace(' ', 'T')).getTime() -
new Date(a.start_date_local.replace(' ', 'T')).getTime()
);
};
const sortDateFuncReverse = (a: Activity, b: Activity) => sortDateFunc(b, a);
Expand Down

0 comments on commit 95638c6

Please sign in to comment.