From f4ff771c12a10c500cce3b0bbdc87e75fc461bc2 Mon Sep 17 00:00:00 2001 From: wehub-resource-sync Date: Mon, 13 Jul 2026 12:31:37 +0800 Subject: [PATCH] chore: import upstream snapshot with attribution --- .dockerignore | 22 + .env.development | 5 + .eslintrc.json | 25 + .github/FUNDING.yml | 3 + .github/ISSUE_TEMPLATE/bug_report.md | 27 + .github/ISSUE_TEMPLATE/feature_request.md | 14 + .github/pull_request_template.md | 8 + .github/workflows/build.yaml | 37 + .github/workflows/deploy.yml | 50 + .github/workflows/test.yml | 29 + .gitignore | 23 + .nvmrc | 1 + CODE_OF_CONDUCT.md | 136 + CONTRIBUTING.md | 30 + Dockerfile | 10 + LICENSE | 21 + README.md | 64 + README.wehub.md | 7 + nginx/default.conf | 9 + package-lock.json | 31988 +++++++++++++++++++ package.json | 64 + public/demo.gif | Bin 0 -> 1203933 bytes public/favicon.ico | Bin 0 -> 1766 bytes public/index.html | 44 + public/logo.svg | 1 + public/logo192.png | Bin 0 -> 5013 bytes public/logo512.png | Bin 0 -> 13933 bytes public/manifest.json | 25 + public/robots.txt | 3 + src/App.scss | 17 + src/App.test.tsx | 15 + src/App.tsx | 42 + src/api/api.tsx | 135 + src/app/hooks.ts | 6 + src/app/store.ts | 21 + src/assets/404.png | Bin 0 -> 51477 bytes src/components/404.tsx | 55 + src/components/AppBar.tsx | 115 + src/components/AppDrawer.tsx | 107 + src/components/ConfirmDialog.tsx | 24 + src/components/Editor.tsx | 218 + src/components/Finder.tsx | 80 + src/components/Login.tsx | 59 + src/components/Main.tsx | 105 + src/components/NoteCard.tsx | 40 + src/components/RepoSelectDialog.tsx | 86 + src/components/RepoSetupDialog.tsx | 80 + src/components/Settings.tsx | 33 + src/components/StyledTreeItem.tsx | 44 + src/components/Viewer.tsx | 98 + src/components/lib/CustomReactMarkdown.tsx | 65 + src/components/lib/RequireAuth.tsx | 13 + src/index.scss | 11 + src/index.tsx | 21 + src/logo.svg | 1 + src/react-app-env.d.ts | 1 + src/reducer/common.ts | 7 + src/reducer/noteSlice.tsx | 227 + src/reducer/preferenceSlice.tsx | 99 + src/reducer/userSlice.tsx | 69 + src/serviceWorker.ts | 146 + src/setupProxy.js | 17 + src/setupTests.tsx | 15 + src/util/TreeUtil.ts | 75 + src/util/util.ts | 72 + tsconfig.json | 29 + 66 files changed, 34894 insertions(+) create mode 100644 .dockerignore create mode 100644 .env.development create mode 100644 .eslintrc.json create mode 100644 .github/FUNDING.yml create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/test.yml create mode 100644 .gitignore create mode 100644 .nvmrc create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 README.md create mode 100644 README.wehub.md create mode 100644 nginx/default.conf create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 public/demo.gif create mode 100644 public/favicon.ico create mode 100644 public/index.html create mode 100644 public/logo.svg create mode 100644 public/logo192.png create mode 100644 public/logo512.png create mode 100644 public/manifest.json create mode 100644 public/robots.txt create mode 100644 src/App.scss create mode 100644 src/App.test.tsx create mode 100644 src/App.tsx create mode 100644 src/api/api.tsx create mode 100644 src/app/hooks.ts create mode 100644 src/app/store.ts create mode 100644 src/assets/404.png create mode 100644 src/components/404.tsx create mode 100644 src/components/AppBar.tsx create mode 100644 src/components/AppDrawer.tsx create mode 100644 src/components/ConfirmDialog.tsx create mode 100644 src/components/Editor.tsx create mode 100644 src/components/Finder.tsx create mode 100644 src/components/Login.tsx create mode 100644 src/components/Main.tsx create mode 100644 src/components/NoteCard.tsx create mode 100644 src/components/RepoSelectDialog.tsx create mode 100644 src/components/RepoSetupDialog.tsx create mode 100644 src/components/Settings.tsx create mode 100644 src/components/StyledTreeItem.tsx create mode 100644 src/components/Viewer.tsx create mode 100644 src/components/lib/CustomReactMarkdown.tsx create mode 100644 src/components/lib/RequireAuth.tsx create mode 100644 src/index.scss create mode 100644 src/index.tsx create mode 100644 src/logo.svg create mode 100644 src/react-app-env.d.ts create mode 100644 src/reducer/common.ts create mode 100644 src/reducer/noteSlice.tsx create mode 100644 src/reducer/preferenceSlice.tsx create mode 100644 src/reducer/userSlice.tsx create mode 100644 src/serviceWorker.ts create mode 100644 src/setupProxy.js create mode 100644 src/setupTests.tsx create mode 100644 src/util/TreeUtil.ts create mode 100644 src/util/util.ts create mode 100644 tsconfig.json diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..89ef741 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,22 @@ +# https://github.com/docker/docker.github.io/blob/master/.dockerignore + +.dockerignore +.DS_Store +.git +.github +.gitignore +.gitmodules +.idea +.jekyll-metadata +.sass-cache +tests +_site +CONTRIBUTING.md +Dockerfile +Dockerfile.archive +docker-compose.yml +Gemfile +Gemfile.lock +_website*.json + +node_modules diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..09b52a7 --- /dev/null +++ b/.env.development @@ -0,0 +1,5 @@ +# use heroku api server +REACT_APP_PROXY_API_URL=https://batnoter-staging.herokuapp.com + +# uncomment below line to use localhost api server +# REACT_APP_PROXY_API_URL=http://localhost:8080 diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..09d5e0b --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,25 @@ +{ + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:@typescript-eslint/recommended" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaFeatures": { + "jsx": true + }, + "ecmaVersion": "latest", + "sourceType": "module" + }, + "plugins": [ + "react", + "@typescript-eslint" + ], + "rules": { + } +} diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..ed2ef01 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: vivekweb2013 diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..cdd58dd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,27 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: 'bug' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the bug: +1. Go to '...' +2. Click on '....' +3. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Please provide browser information:** + - Browser [e.g. chrome, safari] + - Version [e.g. 22] diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..4246d2d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,14 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: 'enhancement' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..29e7f91 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,8 @@ +## Describe your changes + +## Issue ticket number and link + +## Checklist before requesting a review +* [ ] My code follows the contribution guidelines of this project. +* [ ] I have performed a self-review of my code. +* [ ] If it is a core feature, I have added thorough tests. diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..dd91b62 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,37 @@ +name: Build + +on: + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + build: + runs-on: ubuntu-latest + env: + GITHUB_REPO_REGISTRY: ghcr.io/${{ github.repository_owner }}/batnoter + IMAGE_NAME: batnoter-ui + steps: + - uses: actions/checkout@v2 + + - name: login to github docker registry + uses: docker/login-action@v1.14.1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: build & publish docker image + env: + COMMIT_SHA: ${{ github.sha }} + run: | + docker build \ + -t $GITHUB_REPO_REGISTRY/$IMAGE_NAME:${GITHUB_REF##*/} \ + -t $GITHUB_REPO_REGISTRY/$IMAGE_NAME:$COMMIT_SHA \ + -t $GITHUB_REPO_REGISTRY/$IMAGE_NAME:latest . + docker push -a $GITHUB_REPO_REGISTRY/$IMAGE_NAME diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..33af731 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,50 @@ +name: Deploy + +on: + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + deploy-production: + runs-on: ubuntu-latest + + environment: + name: Production + url: 'https://batnoter.com' + + steps: + - uses: actions/checkout@v2 + + - name: build react app + env: + # REACT_APP_BASENAME is the dir where app is deployed. It is used to specify the basename for react router. + # it is useful in case you are deploying to github pages & app is served from https://username.github.io/repository + # in this case you can simply specify the repository name as the value of this variable. + # set this empty if the app is being deployed to the root location. + REACT_APP_BASENAME: "" + + # REACT_APP_API_SERVER is the url of batnoter api server + REACT_APP_API_SERVER: https://api.batnoter.com + run: | + npm ci + npm run build + + # patch the build to support routing on github pages + # since we are deploying the application on github pages and github pages only acts as the static file server, + # the page reload action on a custom route will cause 404 failure. reference - https://create-react-app.dev/docs/deployment/#serving-apps-with-client-side-routing + # this patch resolves 404 issue on page reload. read more at - https://github.com/rafgraph/spa-github-pages + echo '' >> ./build/404.html + sed -i 's/<\/head>/