diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bf72cdbb2e..ac20ea8143 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -42,6 +42,7 @@ jobs: run: npm run test:e2e:ci build: runs-on: ubuntu-latest + needs: ['test'] steps: - name: Checkout source code @@ -82,6 +83,7 @@ jobs: NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} lighthouse: runs-on: macos-latest + needs: ['build'] steps: - uses: actions/checkout@v2 diff --git a/.node-version b/.node-version new file mode 100644 index 0000000000..c6244cda04 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +14.17.3 diff --git a/src/api/index.js b/src/api/index.js index b3a9afa8ff..35119a39b7 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -17,12 +17,8 @@ const getCurrentPage = () => { return 0; }; -// const getPath = () => (isBrowser() ? window.location.pathname : ''); - const getMaxPages = (amount) => Math.ceil(amount / 10); -// const getPages = (amount) => new Array(amount).fill().map((_, index) => `/page/${index + 1}`); - const overflow = () => getCurrentPage() === getMaxPages(); const parseDate = (date) => dayjs(date).format('YYYY/MM/DD'); @@ -31,9 +27,7 @@ export { isBrowser, getCurrentPage, getMaxPages, - // getPages, overflow, parseDate, - // getPath, getPageNumber, }; diff --git a/src/api/url.js b/src/api/url.js deleted file mode 100644 index 3f0ed3234e..0000000000 --- a/src/api/url.js +++ /dev/null @@ -1,57 +0,0 @@ -import dayjs from 'dayjs'; - -const getUrl = ({ createdDate, url }) => `/${dayjs(createdDate).format('YYYY/MM/DD')}/${url}`; - -const parseMarkdownUrl = (date, rawUrl) => `/${date}/${rawUrl.match(/_posts[/](.*).md/)[1]}/`; - -const parseUrl = (date, rawUrl) => { - if (rawUrl === 'about') { - return '/about/'; - } - return `/${date}/${rawUrl}/`; -}; - -const minusOnePage = (currentPage) => { - if (currentPage - 1 >= 1) { - return currentPage - 1; - } - - return -1; -}; - -const addOnePage = (currentPage = 0, maxPages = 1) => { - if (currentPage + 1 < maxPages) { - return currentPage + 1; - } - return -1; -}; - -const parsePageUrl = (index) => { - if (index > 0) { - return `/page/${index}`; - } - if (index === 0) { - return '/'; - } - return -1; -}; - -const handlePreviousPage = (pageNumber) => { - const index = minusOnePage(+pageNumber); - - return parsePageUrl(index); -}; - -const handleNextPage = (pageNumber, maxPages) => { - const index = addOnePage(+pageNumber, maxPages); - - return parsePageUrl(index); -}; - -export { - getUrl, - parseMarkdownUrl, - parseUrl, - handlePreviousPage, - handleNextPage, -}; diff --git a/src/components/Navbar/index.js b/src/components/Navbar/index.js index aabe86e752..2ac26cdc5a 100644 --- a/src/components/Navbar/index.js +++ b/src/components/Navbar/index.js @@ -24,7 +24,6 @@ const Navbar = () => ( category: 'User', action: 'Click navbar logo', }); - // gotoPage('/'); navigate(withPrefix('/')); }} > diff --git a/src/components/RelatedCard/index.js b/src/components/RelatedCard/index.js index d4df8c5505..4323b2ad83 100644 --- a/src/components/RelatedCard/index.js +++ b/src/components/RelatedCard/index.js @@ -5,10 +5,6 @@ import { parseImgur } from '../../api/images'; import './index.scss'; import Tag from '../Tag'; -// const imageStyle = (headerImage, color) => ({ -// backgroundColor: `#${color}`, -// backgroundImage: ` url(${parseImgur(headerImage, 'large')})`, -// }); const imageStyle = (headerImage) => ( `${parseImgur(headerImage, 'large')}`