diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index eec149a..ba8361d 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -26,6 +26,27 @@ jobs:
- name: Install dependencies
if: steps.cache-restore.outputs.cache-hit != 'true'
run: yarn
+ lint:
+ runs-on: ubuntu-latest
+ name: Lint
+ needs: setup
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-node@v2
+ id: node-setup
+ with:
+ node-version: ${{ env.NODE_VERSION }}
+ - name: Yarn cache
+ uses: actions/cache@v2
+ id: yarn-cache-restore
+ with:
+ path: |
+ .yarn
+ key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
+ - name: Lint
+ run: |
+ yarn
+ yarn lint
build:
runs-on: ubuntu-latest
name: Build
@@ -69,20 +90,26 @@ jobs:
id: node-setup
with:
node-version: ${{ env.NODE_VERSION }}
+ - name: Yarn cache
+ uses: actions/cache@v2
+ id: yarn-cache-restore
+ with:
+ path: |
+ .yarn
+ key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
+ - run: yarn
- name: Build Artifacts
uses: actions/download-artifact@v2
with:
name: build-artifacts
path: dist
- - name: Netlify CLI setup
- run: npm install -g netlify-cli
- name: Deploy
id: preview-deploy
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: |
- netlify deploy --dir=dist > output.log
+ yarn netlify deploy --dir=dist > output.log
echo "::set-output name=draft-url::$(grep 'Website Draft URL' output.log)"
- name: Report
uses: actions/github-script@v2
@@ -108,6 +135,14 @@ jobs:
id: node-setup
with:
node-version: ${{ env.NODE_VERSION }}
+ - name: Yarn cache
+ uses: actions/cache@v2
+ id: yarn-cache-restore
+ with:
+ path: |
+ .yarn
+ key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
+ - run: yarn
- name: Build Artifacts
uses: actions/download-artifact@v2
with:
@@ -121,4 +156,4 @@ jobs:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: |
- netlify deploy --dir=dist --prod
+ yarn netlify deploy --dir=dist --prod
diff --git a/.nvmrc b/.nvmrc
new file mode 100644
index 0000000..3c95b26
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+v16.1.0
diff --git a/netlify.toml b/netlify.toml
new file mode 100644
index 0000000..e27bdca
--- /dev/null
+++ b/netlify.toml
@@ -0,0 +1,9 @@
+[functions]
+ directory = "netlify/functions/"
+
+[dev]
+ command = "yarn start:parcel"
+ publish = "dist"
+ targetPort = 1234
+ port = 8080
+ framework = "parcel"
diff --git a/package.json b/package.json
index 484c3cc..73c1044 100644
--- a/package.json
+++ b/package.json
@@ -4,12 +4,14 @@
"version": "1.0.0",
"license": "GPL-3.0",
"scripts": {
- "start": "parcel src/index.html --https --host localhost.localdomain",
+ "start": "netlify dev",
+ "start:parcel": "parcel serve src/index.html",
"lint": "eslint src",
"lint:fix": "eslint src netlify --fix",
"types": "tsc --noEmit",
"clean": "rm -rf dist/*",
"build": "parcel build src/index.html",
+ "build:watch": "parcel watch src/index.html",
"build:bundlesize": "parcel build src/index.html --reporter @parcel/reporter-bundle-analyzer"
},
"devDependencies": {
@@ -30,6 +32,7 @@
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"jest": "^27.0.6",
+ "netlify-cli": "^5.2.3",
"parcel": "^2.0.0-beta.2",
"prettier": "^2.3.2",
"typescript": "^4.3.5"
diff --git a/src/App.tsx b/src/App.tsx
index 23d0c84..af64c09 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -10,7 +10,7 @@ import useAppState from './utils/useAppState'
export default function App(): ReactNode {
const [state, actions] = useAppState()
- const { setActivePanel, setRssItems, setFeedUrls } = actions
+ const { setActivePanel, setFeeds, setFeedUrls } = actions
useEffect(() => {
if (state.loaded) return
@@ -20,12 +20,14 @@ export default function App(): ReactNode {
useEffect(() => {
const fetch = async () => {
- const feedItems = await fetchFeeds(state.feedUrls)
- setRssItems(feedItems)
+ const feeds = await fetchFeeds(state.feedUrls)
+ setFeeds(feeds)
}
fetch()
- }, [state.feedUrls, setRssItems])
+ }, [state.feedUrls, setFeeds])
+
+ if (!state.feeds) return 'loading'
return (
<>
@@ -34,7 +36,7 @@ export default function App(): ReactNode {
setActivePanel={setActivePanel}
/>
{state.activePanel === panelIdentifiers.FEEDS ? (
-
+
) : null}
{state.activePanel === panelIdentifiers.SETTINGS ? (
{title}
- {formattedDate}
+ {`${feedTitle} - ${formattedDate}`}
)
}
+
export default function FeedsPanel(props: Props): ReactNode {
- const { items } = props
+ const { feeds } = props
+
+ const flattenedItems = sortFeedItemsByDate(feeds)
+
return (
- {items.map((item) => (
+ {flattenedItems.map((item) => (
-
+