diff --git a/.dockerignore b/.dockerignore index f9a320b..73b053e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,4 +7,22 @@ # Docker files .dockerignore -Dockerfile \ No newline at end of file +Dockerfile + +# Development files +.git +.github +*.md +.env* +.cache +coverage +.turbo +**/*.test.* +**/*.spec.* +.editorconfig +.nvmrc +.prettierrc.js +eslint.config.js +vitest.config.ts +.husky +**/*.map \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b0391d8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 + +[*.{js,jsx,ts,tsx,json,yaml,yml}] +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false + +[Dockerfile] +indent_style = tab \ No newline at end of file diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..bf5dfa6 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,39 @@ +# Contributing to Devolunch + +We appreciate any kind of contributions to Devolunch 🤗 + +## Code / Development + +- TypeScript-first codebase (client/server/functions) +- Conventional Commits enforced via a commit-msg hook +- See development details in [docs/development.md](../docs/development.md) + +## Forking/Cloning + +- Outside contributors: fork the repo and open PRs from your fork +- Org members: branch in-repo and open PRs from branches + +## Local Setup + +1. Install dependencies + ```sh + pnpm install + ``` +2. Run dev + ```sh + pnpm dev + ``` +3. Optional Docker + ```sh + docker-compose up + ``` + +## Functions (Scraper & Slack Notifier) + +See their readmes: +- Scraper: apps/functions/scraper/README.md +- Notify Slack: apps/functions/notify-slack/README.md + +## Adding restaurants + +Add entries to apps/functions/scraper/src/restaurants.ts. See the Scraper README for examples. diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..aed27a0 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,79 @@ +name: 'Dependency Review' + +on: + pull_request: + branches: [main] + paths: + - 'package.json' + - 'pnpm-lock.yaml' + - '**/package.json' + +permissions: + contents: read + pull-requests: write + +jobs: + dependency-review: + runs-on: ubuntu-latest + if: github.event.pull_request.user.login == 'renovate[bot]' + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Dependency Review + uses: actions/dependency-review-action@v4 + with: + fail-on-severity: critical + deny-licenses: GPL-2.0, GPL-3.0 + comment-summary-in-pr: always + + auto-approve-renovate: + runs-on: ubuntu-latest + if: github.event.pull_request.user.login == 'renovate[bot]' + needs: dependency-review + + steps: + - name: Auto-approve Renovate PRs + uses: hmarr/auto-approve-action@v4 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + + security-audit: + runs-on: ubuntu-latest + if: github.event.pull_request.user.login == 'renovate[bot]' + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + version: 10 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v4 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + - name: Security audit + run: pnpm audit + continue-on-error: false \ No newline at end of file diff --git a/.github/workflows/install-and-test.yaml b/.github/workflows/install-and-test.yaml index 93a38b2..7f5dd7d 100644 --- a/.github/workflows/install-and-test.yaml +++ b/.github/workflows/install-and-test.yaml @@ -9,18 +9,18 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 name: Install pnpm id: pnpm-install with: - version: 8 + version: 10 run_install: false - name: Get pnpm store directory @@ -29,7 +29,7 @@ jobs: run: | echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Setup pnpm cache with: path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} @@ -49,5 +49,11 @@ jobs: - name: Run typecheck run: pnpm typecheck - - name: Run tests + - name: Run tests with coverage run: pnpm test + + - name: Run coverage report + run: pnpm --filter @devolunch/client exec vitest run --coverage + + - name: Security audit + run: pnpm audit diff --git a/.gitignore b/.gitignore index 42fc0c7..c6cc6b1 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ lerna-debug.log* # Zip files created to deploy to Cloud Functions **/*.zip + +# Local scrape output (not for version control) +apps/functions/scraper/scrape.json diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100644 index 0000000..0b8c457 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,21 @@ +msgFile="$1" +subject="$(head -n1 "$msgFile" | tr -d '\r')" + +# Allow merge commits and reverts +case "$subject" in + Merge\ *) exit 0 ;; + Revert\ *) exit 0 ;; +esac + +pattern='^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z0-9\-\/]+\))?(!)?: .+' + +if echo "$subject" | grep -Eq "$pattern"; then + exit 0 +fi + +echo "\n⛔ Invalid commit message." +echo "Follow Conventional Commits, e.g.:" +echo " feat(server): add health endpoint" +echo " fix(scraper): handle empty PDF" +echo "Got: $subject\n" +exit 1 diff --git a/.husky/pre-commit b/.husky/pre-commit index 951fab2..fe445cb 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,7 +1,3 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -pnpm --filter shared build +# Fast, reliable checks before commit pnpm lint pnpm typecheck -pnpm test diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 0000000..f88dc51 --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,9 @@ +set -e + +echo "husky pre-push: running tests" +pnpm test + +echo "husky pre-push: running build" +pnpm build + +echo "husky pre-push: OK" diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..e5a8980 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +inject-workspace-packages=true \ No newline at end of file diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..adb5558 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +22.14.0 \ No newline at end of file diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..86ea4c1 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,8 @@ +module.exports = { + semi: true, + trailingComma: 'es5', + singleQuote: true, + printWidth: 80, + tabWidth: 2, + useTabs: false, +}; diff --git a/CHANGELOG.md b/CHANGELOG.md index df9d00c..f2052c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,395 +2,339 @@ ## [1.17.0](https://github.com/devoteam-se/devolunch/compare/v1.16.0...v1.17.0) (2024-02-08) - ### Features -* update sharp ([c9a0533](https://github.com/devoteam-se/devolunch/commit/c9a0533e3b7439d08f2cc6f95580b9f71282d4d8)) +- update sharp ([c9a0533](https://github.com/devoteam-se/devolunch/commit/c9a0533e3b7439d08f2cc6f95580b9f71282d4d8)) ## [1.16.0](https://github.com/devoteam-se/devolunch/compare/v1.15.2...v1.16.0) (2024-02-08) - ### Features -* Add two forks as a restaurant ([fc51743](https://github.com/devoteam-se/devolunch/commit/fc51743b363ed8cb0857e8ad05a4134aebc34b37)) +- Add two forks as a restaurant ([fc51743](https://github.com/devoteam-se/devolunch/commit/fc51743b363ed8cb0857e8ad05a4134aebc34b37)) ## [1.15.2](https://github.com/devoteam-se/devolunch/compare/v1.15.1...v1.15.2) (2023-12-04) - ### Bug Fixes -* remove analytics ([0763de4](https://github.com/devoteam-se/devolunch/commit/0763de49150c04501419714b7a79c7dbac3407f9)) +- remove analytics ([0763de4](https://github.com/devoteam-se/devolunch/commit/0763de49150c04501419714b7a79c7dbac3407f9)) ## [1.15.1](https://github.com/devoteam-se/devolunch/compare/v1.15.0...v1.15.1) (2023-10-19) - ### Bug Fixes -* **scraper:** ignore tests on scrape ([c474936](https://github.com/devoteam-se/devolunch/commit/c474936c0093b5043ec5c7f123ba20334aba9e63)) -* vite version ([e7e5cc1](https://github.com/devoteam-se/devolunch/commit/e7e5cc104f992e9d63d3b5ce90c1292d1194460c)) +- **scraper:** ignore tests on scrape ([c474936](https://github.com/devoteam-se/devolunch/commit/c474936c0093b5043ec5c7f123ba20334aba9e63)) +- vite version ([e7e5cc1](https://github.com/devoteam-se/devolunch/commit/e7e5cc104f992e9d63d3b5ce90c1292d1194460c)) ## [1.15.0](https://github.com/devoteam-se/devolunch/compare/v1.14.0...v1.15.0) (2023-10-16) - ### Features -* **scraper:** add tests ([893f751](https://github.com/devoteam-se/devolunch/commit/893f7511fd0bbc31d292b5856863ac81a6e49b40)) - +- **scraper:** add tests ([893f751](https://github.com/devoteam-se/devolunch/commit/893f7511fd0bbc31d292b5856863ac81a6e49b40)) ### Bug Fixes -* **scraper:** slagthuset ranges for veg and fish ([ab2b467](https://github.com/devoteam-se/devolunch/commit/ab2b467d9ec5785ad9869c050bc9e85326add3bb)) +- **scraper:** slagthuset ranges for veg and fish ([ab2b467](https://github.com/devoteam-se/devolunch/commit/ab2b467d9ec5785ad9869c050bc9e85326add3bb)) ## [1.14.0](https://github.com/devoteam-se/devolunch/compare/v1.13.5...v1.14.0) (2023-09-18) - ### Features -* **scraper:** update scheduler interval ([9ea6814](https://github.com/devoteam-se/devolunch/commit/9ea68141475a1b1acdaca423511c7af496465c00)) - +- **scraper:** update scheduler interval ([9ea6814](https://github.com/devoteam-se/devolunch/commit/9ea68141475a1b1acdaca423511c7af496465c00)) ### Bug Fixes -* **scraper:** slagthuset ([577474a](https://github.com/devoteam-se/devolunch/commit/577474a9367e8e29439d395bf318eef74ae44056)) +- **scraper:** slagthuset ([577474a](https://github.com/devoteam-se/devolunch/commit/577474a9367e8e29439d395bf318eef74ae44056)) ## [1.13.5](https://github.com/devoteam-se/devolunch/compare/v1.13.4...v1.13.5) (2023-09-01) - ### Bug Fixes -* **website:** update no restaurants message ([2f3df25](https://github.com/devoteam-se/devolunch/commit/2f3df2594ba86c14c3ad5cb21f32cf2072245e77)) +- **website:** update no restaurants message ([2f3df25](https://github.com/devoteam-se/devolunch/commit/2f3df2594ba86c14c3ad5cb21f32cf2072245e77)) ## [1.13.4](https://github.com/devoteam-se/devolunch/compare/v1.13.3...v1.13.4) (2023-08-30) - ### Bug Fixes -* **scraper:** sort after updating dish types ([4539601](https://github.com/devoteam-se/devolunch/commit/4539601b9ff22cd1dc0e06d2e09796bf8ea02bbc)) +- **scraper:** sort after updating dish types ([4539601](https://github.com/devoteam-se/devolunch/commit/4539601b9ff22cd1dc0e06d2e09796bf8ea02bbc)) ## [1.13.3](https://github.com/devoteam-se/devolunch/compare/v1.13.2...v1.13.3) (2023-08-30) - ### Bug Fixes -* **scraper:** dishtype lookup ([435c813](https://github.com/devoteam-se/devolunch/commit/435c813618c7dae50f8ffc9766bc6762d3cc7327)) +- **scraper:** dishtype lookup ([435c813](https://github.com/devoteam-se/devolunch/commit/435c813618c7dae50f8ffc9766bc6762d3cc7327)) ## [1.13.2](https://github.com/devoteam-se/devolunch/compare/v1.13.1...v1.13.2) (2023-08-30) - ### Bug Fixes -* **scraper:** rename bellepastabar to bennepastabar ([ee35717](https://github.com/devoteam-se/devolunch/commit/ee3571709260eef0fcdb5dd4d35fed1eae1df0f0)) -* **scraper:** slagthuset description to title ([59e504a](https://github.com/devoteam-se/devolunch/commit/59e504af1700c451b1533ace8f533d4d968da842)) +- **scraper:** rename bellepastabar to bennepastabar ([ee35717](https://github.com/devoteam-se/devolunch/commit/ee3571709260eef0fcdb5dd4d35fed1eae1df0f0)) +- **scraper:** slagthuset description to title ([59e504a](https://github.com/devoteam-se/devolunch/commit/59e504af1700c451b1533ace8f533d4d968da842)) ## [1.13.1](https://github.com/devoteam-se/devolunch/compare/v1.13.0...v1.13.1) (2023-08-30) - ### Bug Fixes -* **scraper:** slagthuset ([f796329](https://github.com/devoteam-se/devolunch/commit/f79632913f75d8023a48a9bb9a2b7bcff9bdc8ca)) +- **scraper:** slagthuset ([f796329](https://github.com/devoteam-se/devolunch/commit/f79632913f75d8023a48a9bb9a2b7bcff9bdc8ca)) ## [1.13.0](https://github.com/devoteam-se/devolunch/compare/v1.12.1...v1.13.0) (2023-07-23) - ### Features -* **website:** add progressive images ([1ef3a6b](https://github.com/devoteam-se/devolunch/commit/1ef3a6bf93a401164a069020c61f930b11a4d140)) +- **website:** add progressive images ([1ef3a6b](https://github.com/devoteam-se/devolunch/commit/1ef3a6bf93a401164a069020c61f930b11a4d140)) ## [1.12.1](https://github.com/devoteam-se/devolunch/compare/v1.12.0...v1.12.1) (2023-07-21) - ### Bug Fixes -* **notify-slack:** skip posting closed restaurants to slack ([8259591](https://github.com/devoteam-se/devolunch/commit/8259591631fbfcb41900d859df9612e0f8290959)) -* **scraper:** default dish type not being set correctly ([36896fc](https://github.com/devoteam-se/devolunch/commit/36896fc48d7783153ff2ffbae59705cee360348c)) +- **notify-slack:** skip posting closed restaurants to slack ([8259591](https://github.com/devoteam-se/devolunch/commit/8259591631fbfcb41900d859df9612e0f8290959)) +- **scraper:** default dish type not being set correctly ([36896fc](https://github.com/devoteam-se/devolunch/commit/36896fc48d7783153ff2ffbae59705cee360348c)) ## [1.12.0](https://github.com/devoteam-se/devolunch/compare/v1.11.20...v1.12.0) (2023-07-20) - ### Features -* **website:** add tracking on outbound links ([1e2fd1b](https://github.com/devoteam-se/devolunch/commit/1e2fd1b1c3119bda3ccea12c501a2aa1691ac7ff)) +- **website:** add tracking on outbound links ([1e2fd1b](https://github.com/devoteam-se/devolunch/commit/1e2fd1b1c3119bda3ccea12c501a2aa1691ac7ff)) ## [1.11.20](https://github.com/devoteam-se/devolunch/compare/v1.11.19...v1.11.20) (2023-07-20) - ### Bug Fixes -* **scraper:** update all restaurants with correct coordinates ([dd4362f](https://github.com/devoteam-se/devolunch/commit/dd4362f645e26395fa132604657e1b93d3ecf4ee)) +- **scraper:** update all restaurants with correct coordinates ([dd4362f](https://github.com/devoteam-se/devolunch/commit/dd4362f645e26395fa132604657e1b93d3ecf4ee)) ## [1.11.19](https://github.com/devoteam-se/devolunch/compare/v1.11.18...v1.11.19) (2023-07-20) - ### Bug Fixes -* slack message when restaurant is closed ([a7e7bdf](https://github.com/devoteam-se/devolunch/commit/a7e7bdffeabf5b6923b48c3579a708467594c01a)) +- slack message when restaurant is closed ([a7e7bdf](https://github.com/devoteam-se/devolunch/commit/a7e7bdffeabf5b6923b48c3579a708467594c01a)) ## [1.11.18](https://github.com/devoteam-se/devolunch/compare/v1.11.17...v1.11.18) (2023-07-20) - ### Bug Fixes -* add null check ([e15145b](https://github.com/devoteam-se/devolunch/commit/e15145b972d9eec313457ca46ee2ead1a9ca8dcc)) -* simplify distance calculation ([6d3d56c](https://github.com/devoteam-se/devolunch/commit/6d3d56c1be198807ddbba05e75bd257f5c089d3f)) -* split up terraform configurations into multiple files for readability ([1af3b51](https://github.com/devoteam-se/devolunch/commit/1af3b51036b3926e01e12d4c0cca37ad64822946)) +- add null check ([e15145b](https://github.com/devoteam-se/devolunch/commit/e15145b972d9eec313457ca46ee2ead1a9ca8dcc)) +- simplify distance calculation ([6d3d56c](https://github.com/devoteam-se/devolunch/commit/6d3d56c1be198807ddbba05e75bd257f5c089d3f)) +- split up terraform configurations into multiple files for readability ([1af3b51](https://github.com/devoteam-se/devolunch/commit/1af3b51036b3926e01e12d4c0cca37ad64822946)) ## [1.11.17](https://github.com/devoteam-se/devolunch/compare/v1.11.16...v1.11.17) (2023-07-19) - ### Bug Fixes -* add closed label to slack notifier ([343be10](https://github.com/devoteam-se/devolunch/commit/343be1068e3b25469b072cd8b07ea6d5db4cfbae)) +- add closed label to slack notifier ([343be10](https://github.com/devoteam-se/devolunch/commit/343be1068e3b25469b072cd8b07ea6d5db4cfbae)) ## [1.11.16](https://github.com/devoteam-se/devolunch/compare/v1.11.15...v1.11.16) (2023-07-19) - ### Bug Fixes -* use title instead of description ([8bec4cc](https://github.com/devoteam-se/devolunch/commit/8bec4cc33a2ed60c7b358e058a85f9eebbf64afa)) +- use title instead of description ([8bec4cc](https://github.com/devoteam-se/devolunch/commit/8bec4cc33a2ed60c7b358e058a85f9eebbf64afa)) ## [1.11.15](https://github.com/devoteam-se/devolunch/compare/v1.11.14...v1.11.15) (2023-07-19) - ### Bug Fixes -* general cleanup ([d49105b](https://github.com/devoteam-se/devolunch/commit/d49105b7aa623de244bf0d3f51f88cb2f8daa7c1)) -* remove unused build step for eslint shared package ([d426299](https://github.com/devoteam-se/devolunch/commit/d426299d7cdffd8532b99038a0bc545e57bed39a)) -* update slack notifier to use shared types ([cd9b17b](https://github.com/devoteam-se/devolunch/commit/cd9b17b218391ad1b42aa450ec386681acfb7692)) +- general cleanup ([d49105b](https://github.com/devoteam-se/devolunch/commit/d49105b7aa623de244bf0d3f51f88cb2f8daa7c1)) +- remove unused build step for eslint shared package ([d426299](https://github.com/devoteam-se/devolunch/commit/d426299d7cdffd8532b99038a0bc545e57bed39a)) +- update slack notifier to use shared types ([cd9b17b](https://github.com/devoteam-se/devolunch/commit/cd9b17b218391ad1b42aa450ec386681acfb7692)) ## [1.11.14](https://github.com/devoteam-se/devolunch/compare/v1.11.13...v1.11.14) (2023-07-18) - ### Bug Fixes -* add some cheeky checks to type lookup ([0b6b346](https://github.com/devoteam-se/devolunch/commit/0b6b3467d799b7fe66ae6c9f602aecad2634458e)) +- add some cheeky checks to type lookup ([0b6b346](https://github.com/devoteam-se/devolunch/commit/0b6b3467d799b7fe66ae6c9f602aecad2634458e)) ## [1.11.13](https://github.com/devoteam-se/devolunch/compare/v1.11.12...v1.11.13) (2023-07-18) - ### Bug Fixes -* add pnpm to notify-slack workflow ([b106fe1](https://github.com/devoteam-se/devolunch/commit/b106fe13bf8c77c70b106cdcd30682a9bd9da0e6)) +- add pnpm to notify-slack workflow ([b106fe1](https://github.com/devoteam-se/devolunch/commit/b106fe13bf8c77c70b106cdcd30682a9bd9da0e6)) ## [1.11.12](https://github.com/devoteam-se/devolunch/compare/v1.11.11...v1.11.12) (2023-07-18) - ### Bug Fixes -* add cfsource.zip to git for checksum diff ([1fb9336](https://github.com/devoteam-se/devolunch/commit/1fb933633a3332a716c985ceb792a62cee6c1d21)) +- add cfsource.zip to git for checksum diff ([1fb9336](https://github.com/devoteam-se/devolunch/commit/1fb933633a3332a716c985ceb792a62cee6c1d21)) ## [1.11.11](https://github.com/devoteam-se/devolunch/compare/v1.11.10...v1.11.11) (2023-07-18) - ### Bug Fixes -* add source code triggers ([4e1600b](https://github.com/devoteam-se/devolunch/commit/4e1600b343aeecc164ada9a9d4db9f903c8d33d3)) +- add source code triggers ([4e1600b](https://github.com/devoteam-se/devolunch/commit/4e1600b343aeecc164ada9a9d4db9f903c8d33d3)) ## [1.11.10](https://github.com/devoteam-se/devolunch/compare/v1.11.9...v1.11.10) (2023-07-18) - ### Bug Fixes -* scrape restaurants sequentially to reduce memory usage ([f77e3b9](https://github.com/devoteam-se/devolunch/commit/f77e3b9f1766b34d64bde8cb29b732e381291c77)) +- scrape restaurants sequentially to reduce memory usage ([f77e3b9](https://github.com/devoteam-se/devolunch/commit/f77e3b9f1766b34d64bde8cb29b732e381291c77)) ## [1.11.9](https://github.com/devoteam-se/devolunch/compare/v1.11.8...v1.11.9) (2023-07-18) - ### Bug Fixes -* add build step before packing ([8509624](https://github.com/devoteam-se/devolunch/commit/8509624c16804ef4d2e0b2d1cc5eab321c5011ec)) +- add build step before packing ([8509624](https://github.com/devoteam-se/devolunch/commit/8509624c16804ef4d2e0b2d1cc5eab321c5011ec)) ## [1.11.8](https://github.com/devoteam-se/devolunch/compare/v1.11.7...v1.11.8) (2023-07-18) - ### Bug Fixes -* add --no-frozen-lockfile to install step ([e444243](https://github.com/devoteam-se/devolunch/commit/e444243a6b97f031bfc29ccd08ca8010905d080e)) +- add --no-frozen-lockfile to install step ([e444243](https://github.com/devoteam-se/devolunch/commit/e444243a6b97f031bfc29ccd08ca8010905d080e)) ## [1.11.7](https://github.com/devoteam-se/devolunch/compare/v1.11.6...v1.11.7) (2023-07-18) - ### Bug Fixes -* install pnpm in deploy step ([2bbc7c2](https://github.com/devoteam-se/devolunch/commit/2bbc7c2e4b9e31f1ef9cdb9f65fb1d75657e3774)) +- install pnpm in deploy step ([2bbc7c2](https://github.com/devoteam-se/devolunch/commit/2bbc7c2e4b9e31f1ef9cdb9f65fb1d75657e3774)) ## [1.11.6](https://github.com/devoteam-se/devolunch/compare/v1.11.5...v1.11.6) (2023-07-18) - ### Bug Fixes -* add state to gcs bucket ([fbe5bc7](https://github.com/devoteam-se/devolunch/commit/fbe5bc7ed70f107aa6cbf76b099c0032adb4ff80)) +- add state to gcs bucket ([fbe5bc7](https://github.com/devoteam-se/devolunch/commit/fbe5bc7ed70f107aa6cbf76b099c0032adb4ff80)) ## [1.11.5](https://github.com/devoteam-se/devolunch/compare/v1.11.4...v1.11.5) (2023-07-17) - ### Bug Fixes -* add environment to scraper and notify-slack ([c76b060](https://github.com/devoteam-se/devolunch/commit/c76b060aa8055bafa0eecf1e4b8db3526e1747ba)) +- add environment to scraper and notify-slack ([c76b060](https://github.com/devoteam-se/devolunch/commit/c76b060aa8055bafa0eecf1e4b8db3526e1747ba)) ## [1.11.4](https://github.com/devoteam-se/devolunch/compare/v1.11.3...v1.11.4) (2023-07-17) - ### Bug Fixes -* add gcloud auth ([5d879f2](https://github.com/devoteam-se/devolunch/commit/5d879f2fa033956e96000b89517e5309c4ffd1ce)) +- add gcloud auth ([5d879f2](https://github.com/devoteam-se/devolunch/commit/5d879f2fa033956e96000b89517e5309c4ffd1ce)) ## [1.11.3](https://github.com/devoteam-se/devolunch/compare/v1.11.2...v1.11.3) (2023-07-17) - ### Bug Fixes -* remove source code triggers ([28e2900](https://github.com/devoteam-se/devolunch/commit/28e2900c45c93ea2b95d67000d207b02c848e802)) +- remove source code triggers ([28e2900](https://github.com/devoteam-se/devolunch/commit/28e2900c45c93ea2b95d67000d207b02c848e802)) ## [1.11.2](https://github.com/devoteam-se/devolunch/compare/v1.11.1...v1.11.2) (2023-07-17) - ### Bug Fixes -* remove terraform fmt -check because of https://github.com/hashicorp/terraform/issues/31543 ([911851e](https://github.com/devoteam-se/devolunch/commit/911851eeca3255b633187359d38d61fef683fa32)) -* remove unused deploy step ([4c83a00](https://github.com/devoteam-se/devolunch/commit/4c83a007e24b70d47078bcc1d627598267d336a7)) +- remove terraform fmt -check because of https://github.com/hashicorp/terraform/issues/31543 ([911851e](https://github.com/devoteam-se/devolunch/commit/911851eeca3255b633187359d38d61fef683fa32)) +- remove unused deploy step ([4c83a00](https://github.com/devoteam-se/devolunch/commit/4c83a007e24b70d47078bcc1d627598267d336a7)) ## [1.11.1](https://github.com/devoteam-se/devolunch/compare/v1.11.0...v1.11.1) (2023-07-17) - ### Bug Fixes -* update github action terraform version ([6c467b2](https://github.com/devoteam-se/devolunch/commit/6c467b2644e57c8529a6ab2dfbe82fa713f32ae1)) +- update github action terraform version ([6c467b2](https://github.com/devoteam-se/devolunch/commit/6c467b2644e57c8529a6ab2dfbe82fa713f32ae1)) ## [1.11.0](https://github.com/devoteam-se/devolunch/compare/v1.10.1...v1.11.0) (2023-07-17) - ### Features -* add github actions steps for deploying scraper and slack notifier ([20665ee](https://github.com/devoteam-se/devolunch/commit/20665ee672712671b4606a64db28da2845024d90)) +- add github actions steps for deploying scraper and slack notifier ([20665ee](https://github.com/devoteam-se/devolunch/commit/20665ee672712671b4606a64db28da2845024d90)) ## [1.10.1](https://github.com/devoteam-se/devolunch/compare/v1.10.0...v1.10.1) (2023-07-17) - ### Bug Fixes -* remove type and set automatically for smak and kontrast ([2e9607f](https://github.com/devoteam-se/devolunch/commit/2e9607f997d6fba23806abf86ae6c6d5fa1a726e)) -* update github url in footer ([d78ddfd](https://github.com/devoteam-se/devolunch/commit/d78ddfd66ed1de085a5c373c3ac356e61a40051a)) +- remove type and set automatically for smak and kontrast ([2e9607f](https://github.com/devoteam-se/devolunch/commit/2e9607f997d6fba23806abf86ae6c6d5fa1a726e)) +- update github url in footer ([d78ddfd](https://github.com/devoteam-se/devolunch/commit/d78ddfd66ed1de085a5c373c3ac356e61a40051a)) ## [1.10.0](https://github.com/devoteam-se/devolunch/compare/v1.9.0...v1.10.0) (2023-07-17) - ### Features -* add belle pastabar ([0c4d7a5](https://github.com/devoteam-se/devolunch/commit/0c4d7a51301863fb2c86a5eaca20214147275a9a)) -* set type automatically depending on keywords in title and ([e2dd4ba](https://github.com/devoteam-se/devolunch/commit/e2dd4bac343249de93c02242db712eee9d837c0a)) - +- add belle pastabar ([0c4d7a5](https://github.com/devoteam-se/devolunch/commit/0c4d7a51301863fb2c86a5eaca20214147275a9a)) +- set type automatically depending on keywords in title and ([e2dd4ba](https://github.com/devoteam-se/devolunch/commit/e2dd4bac343249de93c02242db712eee9d837c0a)) ### Bug Fixes -* sort restaurant in slack notifier ([b562902](https://github.com/devoteam-se/devolunch/commit/b5629023487e2cfa3c9a88466675a1deb7f33dfd)) +- sort restaurant in slack notifier ([b562902](https://github.com/devoteam-se/devolunch/commit/b5629023487e2cfa3c9a88466675a1deb7f33dfd)) ## [1.9.0](https://github.com/jayway/devolunch/compare/v1.8.6...v1.9.0) (2023-07-11) - ### Features -* Add kontrast västra hamnen ([88d1989](https://github.com/jayway/devolunch/commit/88d198959ea5df1cacf402948b74244cc35bad07)) -* fetch images via backend ([d9698fd](https://github.com/jayway/devolunch/commit/d9698fdce64ee3fa4d3817c9f0ff3d845abbb67f)) - +- Add kontrast västra hamnen ([88d1989](https://github.com/jayway/devolunch/commit/88d198959ea5df1cacf402948b74244cc35bad07)) +- fetch images via backend ([d9698fd](https://github.com/jayway/devolunch/commit/d9698fdce64ee3fa4d3817c9f0ff3d845abbb67f)) ### Bug Fixes -* assume that dishes containing 'stängt' means restaurant is closed ([39b6a47](https://github.com/jayway/devolunch/commit/39b6a47852ee334061aa41426b294346f91e8baa)) -* namu image ([0a80c9f](https://github.com/jayway/devolunch/commit/0a80c9f4dd1ccceda48dcb6ecad849609869005b)) -* resolve on end and close ([3eb0b66](https://github.com/jayway/devolunch/commit/3eb0b66978f0db47e2cc2943b674c1382321dd0a)) - +- assume that dishes containing 'stängt' means restaurant is closed ([39b6a47](https://github.com/jayway/devolunch/commit/39b6a47852ee334061aa41426b294346f91e8baa)) +- namu image ([0a80c9f](https://github.com/jayway/devolunch/commit/0a80c9f4dd1ccceda48dcb6ecad849609869005b)) +- resolve on end and close ([3eb0b66](https://github.com/jayway/devolunch/commit/3eb0b66978f0db47e2cc2943b674c1382321dd0a)) ### Reverts -* "fix: resolve on end and close" ([270e9fd](https://github.com/jayway/devolunch/commit/270e9fdb5c512fd516561228305dcb288528975f)) +- "fix: resolve on end and close" ([270e9fd](https://github.com/jayway/devolunch/commit/270e9fdb5c512fd516561228305dcb288528975f)) ## [1.8.6](https://github.com/jayway/devolunch/compare/v1.8.5...v1.8.6) (2023-07-10) - ### Bug Fixes -* add token to release-please ([7ab3ec2](https://github.com/jayway/devolunch/commit/7ab3ec22a5041cda6328291a2ddc5af3ad25f2f2)) +- add token to release-please ([7ab3ec2](https://github.com/jayway/devolunch/commit/7ab3ec22a5041cda6328291a2ddc5af3ad25f2f2)) ## [1.8.5](https://github.com/jayway/devolunch/compare/v1.8.4...v1.8.5) (2023-07-09) - ### Bug Fixes -* trigger release-please on push to main ([3d6d483](https://github.com/jayway/devolunch/commit/3d6d483aa7615ea438d7b6545699f5077ffa0680)) +- trigger release-please on push to main ([3d6d483](https://github.com/jayway/devolunch/commit/3d6d483aa7615ea438d7b6545699f5077ffa0680)) ## [1.8.4](https://github.com/jayway/devolunch/compare/v1.8.3...v1.8.4) (2023-07-09) - ### Bug Fixes -* update scopes and gh workflow name ([7367bf5](https://github.com/jayway/devolunch/commit/7367bf551a7c07f34e3b39f210c15bfcd8343935)) +- update scopes and gh workflow name ([7367bf5](https://github.com/jayway/devolunch/commit/7367bf551a7c07f34e3b39f210c15bfcd8343935)) ## [1.8.3](https://github.com/jayway/devolunch/compare/v1.8.2...v1.8.3) (2023-07-08) - ### Bug Fixes -* Create release on tag creation ([9c455bc](https://github.com/jayway/devolunch/commit/9c455bce896fe626a24ae8a53f9edbae2faa1998)) +- Create release on tag creation ([9c455bc](https://github.com/jayway/devolunch/commit/9c455bce896fe626a24ae8a53f9edbae2faa1998)) ## [1.8.2](https://github.com/jayway/devolunch/compare/v1.8.1...v1.8.2) (2023-07-08) - ### Bug Fixes -* Catch errors and (a)wait for sharp to finish ([5a71728](https://github.com/jayway/devolunch/commit/5a71728c63b4cdf04adebfc9fca9596249178dfa)) -* Shared npm packages for scraper function ([f9b6c33](https://github.com/jayway/devolunch/commit/f9b6c33b106cad183be80568693229a928e060b3)) +- Catch errors and (a)wait for sharp to finish ([5a71728](https://github.com/jayway/devolunch/commit/5a71728c63b4cdf04adebfc9fca9596249178dfa)) +- Shared npm packages for scraper function ([f9b6c33](https://github.com/jayway/devolunch/commit/f9b6c33b106cad183be80568693229a928e060b3)) ## [1.8.1](https://github.com/jayway/devolunch/compare/v1.8.0...v1.8.1) (2023-07-07) - ### Bug Fixes -* add additional arm to shrug emoji ([2e46f6c](https://github.com/jayway/devolunch/commit/2e46f6cb5d6379ce1804c1d1419b937937a927dd)) +- add additional arm to shrug emoji ([2e46f6c](https://github.com/jayway/devolunch/commit/2e46f6cb5d6379ce1804c1d1419b937937a927dd)) ## [1.8.0](https://github.com/jayway/devolunch/compare/v1.7.0...v1.8.0) (2023-07-06) - ### Features -* Add open graph meta tags ([74b13b7](https://github.com/jayway/devolunch/commit/74b13b74ed3cfe91f42b23514eabb66dcbed93d6)) - +- Add open graph meta tags ([74b13b7](https://github.com/jayway/devolunch/commit/74b13b74ed3cfe91f42b23514eabb66dcbed93d6)) ### Bug Fixes -* Smak scraper ([06b2de8](https://github.com/jayway/devolunch/commit/06b2de81a6f1f5795b727689940273e1ea83e6f5)) +- Smak scraper ([06b2de8](https://github.com/jayway/devolunch/commit/06b2de81a6f1f5795b727689940273e1ea83e6f5)) ## [1.7.0](https://github.com/jayway/devolunch/compare/v1.6.1...v1.7.0) (2023-07-05) - ### Features -* Replace GITHUB_TOKEN with self made PAT ([12ee9b3](https://github.com/jayway/devolunch/commit/12ee9b39eebe46d07ca3d9b38bf9ab9de2342d76)) +- Replace GITHUB_TOKEN with self made PAT ([12ee9b3](https://github.com/jayway/devolunch/commit/12ee9b39eebe46d07ca3d9b38bf9ab9de2342d76)) ## [1.6.1](https://github.com/jayway/devolunch/compare/v1.6.0...v1.6.1) (2023-06-30) - ### Bug Fixes -* Analytics path ([d29c7d9](https://github.com/jayway/devolunch/commit/d29c7d933eda1edc2f0a248b0be39c273354334e)) +- Analytics path ([d29c7d9](https://github.com/jayway/devolunch/commit/d29c7d933eda1edc2f0a248b0be39c273354334e)) ## [1.6.0](https://github.com/jayway/devolunch/compare/v1.5.0...v1.6.0) (2023-06-30) - ### Features -* Add plausible analytics ([9043040](https://github.com/jayway/devolunch/commit/90430402b95b861dc63c4ca42e01ad4ebbf584b4)) -* Improve loading spinner ([daf0ad0](https://github.com/jayway/devolunch/commit/daf0ad0f5904e0bceba2ac58c501f0a97c716670)) +- Add plausible analytics ([9043040](https://github.com/jayway/devolunch/commit/90430402b95b861dc63c4ca42e01ad4ebbf584b4)) +- Improve loading spinner ([daf0ad0](https://github.com/jayway/devolunch/commit/daf0ad0f5904e0bceba2ac58c501f0a97c716670)) ## [1.5.0](https://github.com/jayway/devolunch/compare/v1.4.2...v1.5.0) (2023-06-29) - ### Features -* Add namu ([0547fd5](https://github.com/jayway/devolunch/commit/0547fd5ca958b15d4dd74d17af3a742134049c36)) -* Add quanbyquan ([3f3e4f0](https://github.com/jayway/devolunch/commit/3f3e4f0ec885fd9ca65206e669443ad9eb135c94)) -* Remove saving to localStorage ([03c4b98](https://github.com/jayway/devolunch/commit/03c4b9864e9723fe62788da61d3544da595c66f4)) - +- Add namu ([0547fd5](https://github.com/jayway/devolunch/commit/0547fd5ca958b15d4dd74d17af3a742134049c36)) +- Add quanbyquan ([3f3e4f0](https://github.com/jayway/devolunch/commit/3f3e4f0ec885fd9ca65206e669443ad9eb135c94)) +- Remove saving to localStorage ([03c4b98](https://github.com/jayway/devolunch/commit/03c4b9864e9723fe62788da61d3544da595c66f4)) ### Bug Fixes -* namu spaces ([256e347](https://github.com/jayway/devolunch/commit/256e3474a331a96cef7cbfc2974f282a1e092e97)) +- namu spaces ([256e347](https://github.com/jayway/devolunch/commit/256e3474a331a96cef7cbfc2974f282a1e092e97)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index b556454..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,54 +0,0 @@ -# Contributing to Devolunch - -We appreciate any kind of contributions to Devolunch 🤗 - -# Code / Development - -All code is Javascript with a touch of Typescript magic. -We follow the [Conventional Commits](https://www.conventionalcommits.org) guidelines. - -## Forking/Cloning - -If you are not part of our organisation, we recommend you fork the repository to push changes to your personal fork. When you want to share what you have done, open a pull request from your user-owned fork. - -If you are part of the Jayway/Devoteam organisation, you can clone the repository and create a branch to work on, and when you want to share what you have done, open a pull request from your branch. - -## Setup Development Environment - -### Website - -1. Install dependencies - ```sh - pnpm install - ``` -2. Run the server and the client - ```sh - pnpm dev - ``` -3. If you want to run the program in Docker (not necessary): - ```sh - docker-compose up - ``` - -That's it! - -### Scraper and Slack notifier - -Go to their respective directories ([./apps/functions/scraper/](./apps/functions/scraper/) and [./apps/functions/notify-slack/](./apps/functions/notify-slack/)) - -1. Install dependencies - ```sh - pnpm install - ``` -2. Build Typescript to Javascript (named compile since Cloud Functions runs `build` automatically when deploying it) - ```sh - pnpm compile - ``` -3. Run it - ```sh - pnpm dev - ``` - -## Adding more restaurants in Malmö - -If you want to add more restaurants to our lovely city of Malmö, head over to [the scraper](./apps/functions/scraper/) for instructions. diff --git a/Dockerfile b/Dockerfile index e3177fb..022e0a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -FROM node:18-alpine as base +FROM node:22-alpine as base WORKDIR '/docker-app' COPY pnpm-lock.yaml ./ ENV CI=true -RUN npm install -g pnpm@8 +RUN npm install -g pnpm@10 RUN pnpm fetch ADD . ./ RUN pnpm install -r --offline --ignore-scripts @@ -37,7 +37,7 @@ RUN pnpm build # | / |_| | .` | # |_|_\\___/|_|\_| -FROM --platform=linux/amd64 node:18-alpine +FROM --platform=linux/amd64 node:22-alpine ENV NODE_ENV=production diff --git a/README.md b/README.md index a5a0ca0..b21b9e8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Devolunch License +Docs Devolunch is an app that presents today's lunch menu on scraped restaurants. It's hosted on [Google Cloud Platform](https://cloud.google.com/). @@ -65,25 +66,23 @@ The Slack notifier is a simple service that retrieves the data scraped by the [S PRs Welcome -Excited to work alongside you! Follow the instructions in [CONTRIBUTING](./CONTRIBUTING.md) and code away. +Excited to work alongside you! See [docs](./docs/README.md) for development details, and follow the instructions in [CONTRIBUTING](.github/CONTRIBUTING.md). + +# Maintenance + +## Automated Dependency Updates + +This project uses [Renovate](https://renovatebot.com/) for automated dependency management: + +- 📅 **Weekly Updates**: Dependencies are updated every Monday morning +- 🔒 **Security First**: Vulnerability alerts trigger immediate updates +- 🚀 **Auto-merge**: Safe updates (patch/minor dev dependencies) merge automatically +- 📊 **Grouped Updates**: Related packages updated together (React, TypeScript, etc.) + +See [docs/DEPENDENCY_MANAGEMENT.md](./docs/DEPENDENCY_MANAGEMENT.md) for detailed setup and configuration information. # TODO -- [x] Make open source - - [x] Implement Terraform support - - [x] Add instructions on how to make a scraper - - [x] Move scrape call to Cloud Function - - [x] Add deploy on Github release - - [x] Block main branch from anyone outside of the org (unless default) -- [x] Add husky/lint-staged and make sure pre-commit is triggered to run lint/tests -- [x] Add API definition -- [x] Add API versioning -- [x] Change filesOverride to be read from environment instead of code -- [x] Change scraper to run PDF parse from within `browserScrapeFunction` -- [x] Fix shared npm packages for functions -- [x] Host images in a bucket -- [x] Add a separate service account for Cloud Run instead of using the default Compute Engine service account -- [x] Add Cloud Function deploy step -- [x] Serve images via the backend -- [x] Split up terraform configurations into multiple files for readability -- [ ] Figure out a good way of handling restaurant chains +- [ ] Fix the scraper (i.e. hook it up to a AI service for dish extraction) +- [ ] Fix Slack integration + diff --git a/apps/client/.eslintrc.json b/apps/client/.eslintrc.json deleted file mode 100644 index 4f8090f..0000000 --- a/apps/client/.eslintrc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/eslintrc.json", - "root": true, - "env": { - "browser": true, - "es2020": true - }, - "extends": ["custom", "plugin:react-hooks/recommended"], - "plugins": ["react-refresh"] -} diff --git a/apps/client/eslint.config.js b/apps/client/eslint.config.js new file mode 100644 index 0000000..ee8f820 --- /dev/null +++ b/apps/client/eslint.config.js @@ -0,0 +1,54 @@ +import js from '@eslint/js'; +import tseslint from '@typescript-eslint/eslint-plugin'; +import tsparser from '@typescript-eslint/parser'; +import reactHooks from 'eslint-plugin-react-hooks'; +import reactRefresh from 'eslint-plugin-react-refresh'; + +export default [ + js.configs.recommended, + { + files: ['**/*.{js,jsx,ts,tsx}'], + languageOptions: { + parser: tsparser, + globals: { + window: 'readonly', + document: 'readonly', + navigator: 'readonly', + localStorage: 'readonly', + sessionStorage: 'readonly', + console: 'readonly', + fetch: 'readonly', + URL: 'readonly', + URLSearchParams: 'readonly', + setInterval: 'readonly', + clearInterval: 'readonly', + setTimeout: 'readonly', + clearTimeout: 'readonly', + Image: 'readonly', + HTMLElement: 'readonly', + HTMLButtonElement: 'readonly', + HTMLDivElement: 'readonly', + HTMLInputElement: 'readonly', + }, + }, + plugins: { + '@typescript-eslint': tseslint, + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + }, + rules: { + ...tseslint.configs.recommended.rules, + ...reactHooks.configs.recommended.rules, + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', + }, + ], + 'react-refresh/only-export-components': 'warn', + }, + }, +]; diff --git a/apps/client/package.json b/apps/client/package.json index d5748cb..397320e 100644 --- a/apps/client/package.json +++ b/apps/client/package.json @@ -6,20 +6,21 @@ "scripts": { "dev": "vite", "build": "tsc && vite build", + "build:analyze": "tsc && vite build && open dist/bundle-analysis.html", "typecheck": "tsc --noEmit", - "lint": "prettier --check --ignore-path=../../.prettierignore . && eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0", - "format": "prettier --write --ignore-path=../../.prettierignore .", + "lint": "eslint src --ext ts,tsx --max-warnings 0", + "format": "prettier --write .", "test": "vitest run", - "test:run": "vitest" + "test:watch": "vitest" }, "dependencies": { - "@emotion/react": "^11.10.8", - "@vitejs/plugin-react": "^4.0.0", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "typescript": "^5.0.4", - "vite-plugin-pwa": "^0.14.7", - "vite-plugin-svgr": "^3.2.0" + "@modelcontextprotocol/sdk": "^0.7.0", + "@emotion/react": "^11.14.0", + "@vitejs/plugin-react": "^4.4.2", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "vite-plugin-pwa": "^1.0.3", + "vite-plugin-svgr": "^4.2.0" }, "browserslist": { "production": [ @@ -35,16 +36,14 @@ }, "devDependencies": { "@devolunch/shared": "workspace:*", - "@types/node": "^18.16.1", - "@types/react": "^18.2.0", - "@types/react-dom": "^18.2.1", - "@vitest/coverage-c8": "0.31.1", - "eslint-config-custom": "workspace:*", - "eslint-plugin-react-hooks": "^4.6.0", - "eslint-plugin-react-refresh": "^0.3.4", - "prettier": "^2.8.8", - "vite": "^4.3.5", - "vite-plugin-compression": "0.5.1", - "vitest": "0.31.1" + "vite": "^7.1.6", + "@types/react": "^19.1.13", + "@types/react-dom": "^19.1.9", + "vite-plugin-compression": "^0.5.1", + "@testing-library/jest-dom": "^6.6.3", + "@testing-library/react": "^16.1.0", + "@testing-library/user-event": "^14.5.2", + "jsdom": "^26.0.0", + "rollup-plugin-visualizer": "^5.12.0" } } diff --git a/apps/client/src/App.tsx b/apps/client/src/App.tsx index dfd90fe..7381472 100644 --- a/apps/client/src/App.tsx +++ b/apps/client/src/App.tsx @@ -3,11 +3,16 @@ import { css, Global } from '@emotion/react'; import Header from '@/components/Header'; import Main from '@/components/Main'; import Footer from '@/components/Footer'; -import { useRestaurants } from '@/contexts/restaurants'; +import ComponentErrorBoundary from '@/components/ComponentErrorBoundary'; +import { useRestaurants } from '@/hooks/useRestaurants'; import { color } from './utils/theme'; -import LoadingSkeleton from './components/LoadingSkeleton'; +import PromptPanel from './components/PromptPanel'; +import ScrollToSection from './components/ScrollToSection'; const globalStyles = css` + html { + scroll-behavior: smooth; + } body { background-color: ${color.ivory}; height: 100vh; @@ -27,22 +32,29 @@ const noRestaurantsStyles = css` `; function App() { - const { restaurants, scrapeDate, loading } = useRestaurants(); + const { restaurants, scrapeDate, loading, language } = useRestaurants(); return ( <> - {loading && !restaurants?.length ? ( - - ) : !loading && restaurants?.length ? ( - <> -
-
-