diff --git a/client/.coderrabbit.yaml b/client/.coderrabbit.yaml deleted file mode 100644 index fa3f25484..000000000 --- a/client/.coderrabbit.yaml +++ /dev/null @@ -1,14 +0,0 @@ -language: "en-CA" -tone_instructions: "His palms are sweaty, knees weak, arms are heavy There’s vomit on his sweater already, mom’s spaghetti" -early_access: false -reviews: - profile: "chill" - request_changes_workflow: false - high_level_summary: false - poem: false - review_status: false - auto_review: - enabled: true - drafts: false -chat: - auto_reply: false diff --git a/client/.dockerignore b/client/.dockerignore deleted file mode 100644 index fdfa00585..000000000 --- a/client/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -Client/node_modules/ -Server/node_modules/ -Server/*.env \ No newline at end of file diff --git a/client/.env.production b/client/.env.production index 25849c7b9..60b35ca71 100644 --- a/client/.env.production +++ b/client/.env.production @@ -1,4 +1,2 @@ -VITE_APP_API_BASE_URL=UPTIME_APP_API_BASE_URL -VITE_APP_API_V2_BASE_URL=UPTIME_APP_API_V2_BASE_URL -VITE_APP_CLIENT_HOST=UPTIME_APP_CLIENT_HOST -VITE_APP_LOG_LEVEL=UPTIME_APP_LOG_LEVEL \ No newline at end of file +VITE_APP_HOST="http://147.182.153.60" +VITE_APP_API_BASE_URL="http://147.182.153.60:52345/api/v1" diff --git a/client/.eslintrc.cjs b/client/.eslintrc.cjs deleted file mode 100644 index 86d523a6f..000000000 --- a/client/.eslintrc.cjs +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - root: true, - env: { browser: true, es2020: true }, - extends: [ - "eslint:recommended", - "plugin:react/recommended", - "plugin:react/jsx-runtime", - "plugin:react-hooks/recommended", - ], - ignorePatterns: ["dist", ".eslintrc.cjs"], - parserOptions: { ecmaVersion: "latest", sourceType: "module" }, - settings: { react: { version: "18.2" } }, - plugins: ["react-refresh"], - rules: { - "react/jsx-no-target-blank": "off", - "react-refresh/only-export-components": ["warn", { allowConstantExport: true }], - "react/no-unescaped-entities": "off", - }, - globals: { - __APP_VERSION__: "readonly", - process: "readonly", - }, -}; diff --git a/client/.gitignore b/client/.gitignore index 83f6fe9ed..e8e4414a2 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -24,7 +24,7 @@ dist-ssr *.sw? .env - +.env.* # Scripts *.sh diff --git a/client/.prettierrc b/client/.prettierrc deleted file mode 100644 index 5c345e37a..000000000 --- a/client/.prettierrc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "printWidth": 90, - "useTabs": true, - "tabWidth": 2, - "singleQuote": false, - "bracketSpacing": true, - "proseWrap": "preserve", - "bracketSameLine": false, - "singleAttributePerLine": true, - "semi": true, - "jsxSingleQuote": false, - "quoteProps": "as-needed", - "arrowParens": "always", - "trailingComma": "es5", - "htmlWhitespaceSensitivity": "css" -} diff --git a/client/Dockerfile b/client/Dockerfile new file mode 100644 index 000000000..0f0312395 --- /dev/null +++ b/client/Dockerfile @@ -0,0 +1,16 @@ +# Build +FROM node:20-slim AS build +ENV NODE_OPTIONS="--max-old-space-size=4096" +WORKDIR /app +COPY package*.json ./ +RUN npm ci +COPY . . +RUN npm run build + +# Serve +FROM nginx:1.27.1-alpine +COPY ./nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/dist /usr/share/nginx/html +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/client/README.md b/client/README.md index 55bc1efe2..d2e77611f 100644 --- a/client/README.md +++ b/client/README.md @@ -1 +1,73 @@ -This directory contains the client side (frontend) of Checkmate. +# React + TypeScript + Vite + +This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. + +Currently, two official plugins are available: + +- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh +- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh + +## React Compiler + +The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation). + +## Expanding the ESLint configuration + +If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: + +```js +export default defineConfig([ + globalIgnores(['dist']), + { + files: ['**/*.{ts,tsx}'], + extends: [ + // Other configs... + + // Remove tseslint.configs.recommended and replace with this + tseslint.configs.recommendedTypeChecked, + // Alternatively, use this for stricter rules + tseslint.configs.strictTypeChecked, + // Optionally, add this for stylistic rules + tseslint.configs.stylisticTypeChecked, + + // Other configs... + ], + languageOptions: { + parserOptions: { + project: ['./tsconfig.node.json', './tsconfig.app.json'], + tsconfigRootDir: import.meta.dirname, + }, + // other options... + }, + }, +]) +``` + +You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: + +```js +// eslint.config.js +import reactX from 'eslint-plugin-react-x' +import reactDom from 'eslint-plugin-react-dom' + +export default defineConfig([ + globalIgnores(['dist']), + { + files: ['**/*.{ts,tsx}'], + extends: [ + // Other configs... + // Enable lint rules for React + reactX.configs['recommended-typescript'], + // Enable lint rules for React DOM + reactDom.configs.recommended, + ], + languageOptions: { + parserOptions: { + project: ['./tsconfig.node.json', './tsconfig.app.json'], + tsconfigRootDir: import.meta.dirname, + }, + // other options... + }, + }, +]) +``` diff --git a/client/env.sh b/client/env.sh deleted file mode 100755 index d95f8ee8f..000000000 --- a/client/env.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -for i in $(env | grep UPTIME_APP_) -do - key=$(echo $i | cut -d '=' -f 1) - value=$(echo $i | cut -d '=' -f 2-) - echo $key=$value - find /usr/share/nginx/html -type f \( -name '*.js' -o -name '*.css' \) -exec sed -i "s|${key}|${value}|g" '{}' + -done \ No newline at end of file diff --git a/client/eslint.config.js b/client/eslint.config.js new file mode 100644 index 000000000..018b3fd9d --- /dev/null +++ b/client/eslint.config.js @@ -0,0 +1,28 @@ +import js from "@eslint/js"; +import globals from "globals"; +import reactHooks from "eslint-plugin-react-hooks"; +import reactRefresh from "eslint-plugin-react-refresh"; +import tseslint from "typescript-eslint"; +import { defineConfig, globalIgnores } from "eslint/config"; + +export default defineConfig([ + globalIgnores(["dist"]), + { + files: ["**/*.{ts,tsx}"], + extends: [ + js.configs.recommended, + tseslint.configs.recommended, + reactHooks.configs["recommended-latest"], + reactRefresh.configs.vite, + ], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + }, + rules: { + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unsafe-function-type": "off", + "@typescript-eslint/no-empty-object-type": "off", + }, + }, +]); diff --git a/client/i18n-unused.config.cjs b/client/i18n-unused.config.cjs new file mode 100644 index 000000000..a2b0e9057 --- /dev/null +++ b/client/i18n-unused.config.cjs @@ -0,0 +1,6 @@ +/** @type {import('i18n-unused').RunOptions} */ +module.exports = { + localesPath: "src/locales", + srcPath: "src", + translationKeyMatcher: /\bt\s*\(\s*['"`](.*?)['"`]/g, +}; diff --git a/client/index.html b/client/index.html index 0b0f675b4..ab7c560cd 100644 --- a/client/index.html +++ b/client/index.html @@ -1,24 +1,17 @@ -
- - - -