Skip to content

Commit 398ecb0

Browse files
committed
Fix frontend issues
1 parent bde1ed0 commit 398ecb0

26 files changed

+1047
-249
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ $ cd backend
6464
$ pnpm install
6565

6666
# run mysql db server
67-
$ docker-compose up
67+
$ docker-compose up --build
6868

6969
# run prisma migration
7070
$ npx prisma migrate dev

backend/docker-compose.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,21 @@ services:
55
image: mysql:8.0
66
restart: always
77
ports:
8-
- '3306:3306'
8+
- 3306:3306
99
environment:
1010
- MYSQL_ROOT_PASSWORD=password
1111
- MYSQL_DATABASE=cedb
12+
13+
backend:
14+
build: .
15+
depends_on:
16+
- db
17+
ports:
18+
- 8888:8888
19+
volumes:
20+
- .:/app
21+
environment:
22+
- DATABASE_URL=mysql://root:password@db:3306/cedb
23+
- NODE_DOCKER_PORT=8888
24+
volumes:
25+
- ./dbdata:/var/lib/mysql

frontend/.eslintcache

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

frontend/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ This template provides a minimal setup to get React working in Vite with HMR and
1212
- ✅ Strict Mode for TypeScript and React 18
1313
- 📏 Linter with [ESLint](https://eslint.org) (default NextJS, NextJS Core Web Vitals, Tailwind CSS and Airbnb configuration)
1414
- 💖 Code Formatter with [Prettier](https://prettier.io)
15-
- 🦊 Husky for Git Hooks
1615
- 🚫 Lint-staged for running linters on Git staged files
17-
- 🗂 VSCode configuration: Debug, Settings, Tasks and extension for PostCSS, ESLint, Prettier, TypeScript, Jest
1816

1917
### Requirements
2018

frontend/eslint.config.mjs

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
2+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
3+
import _import from "eslint-plugin-import";
4+
import simpleImportSort from "eslint-plugin-simple-import-sort";
5+
import globals from "globals";
6+
import tsParser from "@typescript-eslint/parser";
7+
import path from "node:path";
8+
import { fileURLToPath } from "node:url";
9+
import js from "@eslint/js";
10+
import { FlatCompat } from "@eslint/eslintrc";
11+
12+
const __filename = fileURLToPath(import.meta.url);
13+
const __dirname = path.dirname(__filename);
14+
const compat = new FlatCompat({
15+
baseDirectory: __dirname,
16+
recommendedConfig: js.configs.recommended,
17+
allConfig: js.configs.all
18+
});
19+
20+
export default [{
21+
ignores: [
22+
"./tsconfig.json",
23+
"**/build",
24+
"**/dist",
25+
"**/node_modules",
26+
"**/*.test.js",
27+
"**/vite.config.ts",
28+
"**/postcss.config.js",
29+
"**/tailwind.config.js",
30+
"**/i18n.ts",
31+
"public/firebase-messaging-sw.js",
32+
"src/components/ui/*",
33+
],
34+
}, ...fixupConfigRules(compat.extends(
35+
"eslint:recommended",
36+
"plugin:@typescript-eslint/recommended",
37+
"plugin:jsx-a11y/recommended",
38+
"plugin:react/recommended",
39+
"plugin:prettier/recommended",
40+
"plugin:testing-library/react",
41+
"plugin:react-hooks/recommended",
42+
"plugin:prettier/recommended",
43+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
44+
)), {
45+
plugins: {
46+
"@typescript-eslint": fixupPluginRules(typescriptEslint),
47+
import: fixupPluginRules(_import),
48+
"simple-import-sort": simpleImportSort,
49+
},
50+
51+
languageOptions: {
52+
globals: {
53+
...globals.node,
54+
...globals.browser,
55+
},
56+
57+
parser: tsParser,
58+
ecmaVersion: "latest",
59+
sourceType: "module",
60+
61+
parserOptions: {
62+
project: ["./tsconfig.json", "./.eslintrc.cjs"],
63+
tsconfigRootDir: "/Users/frx/Development/fullstack/docker-react-node-mysql-app/frontend",
64+
},
65+
},
66+
67+
settings: {
68+
react: {
69+
version: "detect",
70+
},
71+
},
72+
73+
rules: {
74+
"no-console": 2,
75+
"react-hooks/rules-of-hooks": 2,
76+
"react-hooks/exhaustive-deps": 2,
77+
"react/no-array-index-key": 2,
78+
"react/react-in-jsx-scope": "off",
79+
"react/prop-types": "off",
80+
"@typescript-eslint/no-non-null-assertion": 0,
81+
"no-unused-vars": "off",
82+
"@typescript-eslint/no-misused-promises": "off",
83+
84+
"@typescript-eslint/no-unused-vars": [2, {
85+
argsIgnorePattern: "^_",
86+
varsIgnorePattern: "^_",
87+
ignoreRestSiblings: true,
88+
}],
89+
90+
"prettier/prettier": ["off", {
91+
singleQuote: true,
92+
}],
93+
94+
"no-restricted-imports": [2, {
95+
patterns: ["@/features/*/*", "@/components/*", "@/hooks/*", "@/utils/*", "@/ts/*/*"],
96+
}],
97+
98+
"import/order": ["error", {
99+
groups: ["builtin", "external", "internal"],
100+
101+
pathGroups: [{
102+
pattern: "react",
103+
group: "external",
104+
position: "before",
105+
}],
106+
107+
pathGroupsExcludedImportTypes: ["react"],
108+
"newlines-between": "always",
109+
110+
alphabetize: {
111+
order: "asc",
112+
caseInsensitive: true,
113+
},
114+
}],
115+
116+
"no-implied-eval": "off",
117+
"require-await": "off",
118+
},
119+
}, {
120+
files: ["**/.eslintrc.{js,cjs}"],
121+
122+
languageOptions: {
123+
globals: {
124+
...globals.node,
125+
},
126+
127+
ecmaVersion: 5,
128+
sourceType: "commonjs",
129+
},
130+
}];

frontend/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"dev": "vite",
99
"preinstall": "npx only-allow pnpm",
1010
"build": "tsc && vite build",
11-
"lint": "eslint . --ext js,ts,tsx",
11+
"lint": "eslint . --cache --ignore-pattern ./.eslintignore",
12+
"lint:fix": "eslint ./src --ext .jsx,.js,.ts,.tsx --quiet --fix --ignore-path ./.gitignore",
13+
"lint:format": "prettier --loglevel warn --write \"./**/*.{js,jsx,ts,tsx,css,md,json}\" ",
1214
"format": "prettier --write **/*.{js,ts,tsx} && eslint . --ext js,ts,tsx --fix",
1315
"preview": "vite preview"
1416
},
@@ -21,11 +23,13 @@
2123
"@mui/icons-material": "^5.14.18",
2224
"@mui/material": "^5.14.17",
2325
"@tanstack/react-query": "^4.35.3",
26+
"@tanstack/react-query-devtools": "^5.56.2",
2427
"@tanstack/react-router": "^1.58.3",
2528
"@types/styled-components": "^5.1.27",
2629
"axios": "1.6.0",
2730
"class-variance-authority": "^0.7.0",
2831
"clsx": "^2.0.0",
32+
"framer-motion": "^11.5.6",
2933
"lodash": "^4.17.21",
3034
"lucide-react": "^0.279.0",
3135
"moment": "^2.30.1",
@@ -42,6 +46,9 @@
4246
"zustand": "^4.4.1"
4347
},
4448
"devDependencies": {
49+
"@eslint/compat": "^1.1.1",
50+
"@eslint/eslintrc": "^3.1.0",
51+
"@eslint/js": "^9.11.0",
4552
"@optimize-lodash/rollup-plugin": "^4.0.4",
4653
"@types/lodash": "^4.14.198",
4754
"@types/node": "^20.6.2",

frontend/pnpm-lock.yaml

Lines changed: 66 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/App.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import { RouterProvider } from '@tanstack/react-router';
22
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
33
import { router } from './routes';
4+
import './index.css';
5+
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
6+
import { ThemeProvider } from './contexts/ThemeContext';
47

58
const queryClient = new QueryClient();
69

710
function App() {
811
return (
912
<QueryClientProvider client={queryClient}>
10-
<RouterProvider router={router} />
13+
<ThemeProvider>
14+
<RouterProvider router={router} />
15+
{window.location.href.includes('localhost') && <ReactQueryDevtools initialIsOpen={false} />}
16+
</ThemeProvider>
1117
</QueryClientProvider>
1218
);
1319
}

frontend/src/api/services/employees/types/types.api.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { CafeDataType } from '@/api/services';
22

33
export type EmployeeDataType = {
4-
// _id?: string;
5-
id?: string;
4+
id: string;
65
createdAt: string;
76
updatedAt: string;
87
name: string;

0 commit comments

Comments
 (0)