Skip to content

Commit

Permalink
feat: typescript migration (#148)
Browse files Browse the repository at this point in the history
* wip

* feat: finished rewriting api in typescript

* fix: update meteostat

* wip

* feat: list runs

* fix: added pagination

* fix: use static maps api

* feat: add header

* chore: update README.md

* fix: update deps

* feat: add streak selector

* fix: add title to period

BREAKING CHANGE: TYPES
  • Loading branch information
rfoel committed Jan 30, 2021
1 parent 2e2be92 commit 178fd4c
Show file tree
Hide file tree
Showing 130 changed files with 12,315 additions and 6,726 deletions.
28 changes: 0 additions & 28 deletions .eslintrc.json

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Bump version
name: Release

on:
push:
branches:
- master
- main

jobs:
bump-version:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
Expand All @@ -28,3 +29,6 @@ yarn-error.log*
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel
3 changes: 3 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
Expand Down
37 changes: 13 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
# rafael.run

## Getting Started
Personal page where I log my runs and display them in a nice way.

First, run the development server:
This application consists in creating a new MongoDB entry for every new activity in my Strava account. This is powered by [Strava Webhooks](https://developers.strava.com/docs/webhooks/).

```bash
npm run dev
# or
yarn dev
```
## Built with

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
- [Next.js](https://nextjs.org/)
- [React](https://reactjs.org/)
- [styled-components](https://styled-components.com/)
- [styled-system](https://styled-system.com/)
- [Mapbox](https://www.mapbox.com/)
- [Splitbee](https://splitbee.io/)
- [Meteostat](https://meteostat.net/)

You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
## Design ~~ripoff~~ inspiration

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/import?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
- [Nike Run Club](https://www.nike.com/nrc-app)
38 changes: 38 additions & 0 deletions components/AllSelector.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import dayjs from 'dayjs'
import { ReactElement, useEffect } from 'react'

import useGlobalState from '../hooks/useGlobalState'
import { DATE_FORMAT } from '../utils/constants'

import SelectorLabel from './SelectorLabel'

const AllSelector = (): ReactElement | null => {
const [state, setState] = useGlobalState()

if (!state.years) {
return null
}

const maxYear = Math.max(...state.years)
const minYear = Math.min(...state.years)

useEffect((): void => {
setState({
range: {
label: `${minYear} - ${maxYear}`,
value: {
start: dayjs().year(minYear).startOf('year').format(DATE_FORMAT),
end: dayjs().year(maxYear).endOf('year').format(DATE_FORMAT),
},
},
})
}, [])

return (
<SelectorLabel withIcon={false}>
{minYear} - {maxYear}
</SelectorLabel>
)
}

export default AllSelector
30 changes: 30 additions & 0 deletions components/Box.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import styled from 'styled-components'
import {
border,
color,
flexbox,
layout,
space,
BorderProps,
ColorProps,
FlexboxProps,
LayoutProps,
SpaceProps,
} from 'styled-system'

const Box = styled.div<
BorderProps & ColorProps & FlexboxProps & LayoutProps & SpaceProps
>(
{
boxSizing: 'border-box',
minWidth: 0,
width: '100%',
},
border,
color,
flexbox,
layout,
space,
)

export default Box
16 changes: 16 additions & 0 deletions components/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import styled, { css } from 'styled-components'

const Button = styled.button(
({ theme: { colors } }) => css`
background-color: ${colors.black};
border: none;
border-radius: 9999px;
color: ${colors.white};
font-size: 1rem;
padding: 16px 24px;
outline: none;
width: 100%;
`,
)

export default Button
11 changes: 11 additions & 0 deletions components/Container.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { FunctionComponent } from 'react'

import Box from './Box'

const Container: FunctionComponent = ({ children }) => (
<Box margin="0 auto" maxWidth="360px">
{children}
</Box>
)

export default Container
25 changes: 0 additions & 25 deletions components/Error.js

This file was deleted.

40 changes: 0 additions & 40 deletions components/Footer.js

This file was deleted.

24 changes: 24 additions & 0 deletions components/GlobalStyles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { createGlobalStyle } from 'styled-components'

const GlobalStyles = createGlobalStyle`
html,
body,
#__next {
display: flex;
flex-grow: 1;
flex-direction: column;
font-size: 16px;
margin: 0;
min-height: 100%;
padding: 0;
width: 100%;
}
body {
font-family: BlinkMacSystemFont, -apple-system, 'Segoe UI', Roboto, Oxygen,
Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Helvetica,
Arial, sans-serif;
}
`

export default GlobalStyles
Loading

1 comment on commit 178fd4c

@vercel
Copy link

@vercel vercel bot commented on 178fd4c Jan 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.