Remove all frontend and backend files from the repository and made frontend working
This commit is contained in:
1 parent
f2392fb133
commit
c2965b4aa8
26 files changed
+174
-1776
No files matched your search
File renamed without changes.
Generated
+70
-43
@@ -5,12 +5,39 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="58b952d2-2253-4e80-8b30-0eef029dc0b0" name="Changes" comment="Implemented basic app with Mantine SegmentedControl">
|
<list default="true" id="58b952d2-2253-4e80-8b30-0eef029dc0b0" name="Changes" comment="Implemented basic app with Mantine SegmentedControl">
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/package-lock.json" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/package.json" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/backend/.gitignore" beforeDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/src/App.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/src/App.tsx" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/backend/package-lock.json" beforeDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/src/index.css" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/src/index.css" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/backend/package.json" beforeDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/vite.config.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/vite.config.ts" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/backend/src/index.ts" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/backend/tsconfig.json" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/.gitignore" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/README.md" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/eslint.config.js" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/index.html" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/package-lock.json" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/package.json" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/postcss.config.cjs" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/public/favicon.svg" beforeDir="false" afterPath="$PROJECT_DIR$/public/favicon.svg" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/public/icons.svg" beforeDir="false" afterPath="$PROJECT_DIR$/public/icons.svg" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/src/App.tsx" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/src/assets/hero.png" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/src/assets/react.svg" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/src/assets/vite.svg" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/src/index.css" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/src/main.tsx" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/tsconfig.app.json" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/tsconfig.json" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/tsconfig.node.json" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/frontend/vite.config.ts" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/../zkpa4fs_qt/.gitignore" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/../zkpa4fs_qt/CMakeLists.txt" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/../zkpa4fs_qt/main.cpp" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/../zkpa4fs_qt/mainwindow.cpp" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/../zkpa4fs_qt/mainwindow.h" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/../zkpa4fs_qt/mainwindow.ui" beforeDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -29,23 +56,23 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="NextEditCompletionFeaturesState">
|
<component name="NextEditCompletionFeaturesState">
|
||||||
<decayedCancelled>
|
<decayedCancelled>
|
||||||
<entry key="MS100" value="1.713481298831372" />
|
<entry key="MS100" value="1.0000000000000009" />
|
||||||
<entry key="MS500" value="4.637405075099502" />
|
<entry key="MS500" value="1.0009539537566359" />
|
||||||
<entry key="S2" value="11.737634652168078" />
|
<entry key="S2" value="1.2110570062864665" />
|
||||||
<entry key="S5" value="16.236182410957866" />
|
<entry key="S5" value="2.6514610749159675" />
|
||||||
<entry key="S10" value="18.38189451669771" />
|
<entry key="S10" value="6.607510158005727" />
|
||||||
<entry key="S30" value="20.06731969554805" />
|
<entry key="S30" value="15.513812640947325" />
|
||||||
<entry key="S60" value="20.525630724306833" />
|
<entry key="S60" value="19.628955963406014" />
|
||||||
<entry key="M2" value="20.7607655104101" />
|
<entry key="M2" value="22.13539263752126" />
|
||||||
<entry key="M5" value="20.903808671217654" />
|
<entry key="M5" value="23.807983810897454" />
|
||||||
<entry key="M10" value="20.95182094432912" />
|
<entry key="M10" value="24.396013473227395" />
|
||||||
<entry key="M15" value="20.9678620632246" />
|
<entry key="M15" value="24.595547743848567" />
|
||||||
<entry key="M30" value="20.983921739697372" />
|
<entry key="M30" value="24.796871127096388" />
|
||||||
<entry key="H1" value="20.99195854522751" />
|
<entry key="H1" value="24.898208847873168" />
|
||||||
<entry key="H2" value="20.99597869125301" />
|
<entry key="H2" value="24.949047615815104" />
|
||||||
<entry key="H4" value="20.997989200260626" />
|
<entry key="H4" value="24.974509589694275" />
|
||||||
<entry key="D1" value="20.99966484651822" />
|
<entry key="D1" value="24.995749622155472" />
|
||||||
<entry key="W1" value="20.99995212043666" />
|
<entry key="W1" value="24.999392754752186" />
|
||||||
</decayedCancelled>
|
</decayedCancelled>
|
||||||
<decayedSelected>
|
<decayedSelected>
|
||||||
<entry key="MS100" value="0.0" />
|
<entry key="MS100" value="0.0" />
|
||||||
@@ -67,23 +94,23 @@
|
|||||||
<entry key="W1" value="0.0" />
|
<entry key="W1" value="0.0" />
|
||||||
</decayedSelected>
|
</decayedSelected>
|
||||||
<decayedShown>
|
<decayedShown>
|
||||||
<entry key="MS100" value="1.659898685865949" />
|
<entry key="MS100" value="0.014179986801830679" />
|
||||||
<entry key="MS500" value="4.606716882759134" />
|
<entry key="MS500" value="0.4274242839963846" />
|
||||||
<entry key="S2" value="11.694566853480081" />
|
<entry key="S2" value="0.9847597606956294" />
|
||||||
<entry key="S5" value="16.197029500525375" />
|
<entry key="S5" value="2.487771145762549" />
|
||||||
<entry key="S10" value="18.355377398540252" />
|
<entry key="S10" value="6.478774079481817" />
|
||||||
<entry key="S30" value="20.056430132506662" />
|
<entry key="S30" value="15.448545540503362" />
|
||||||
<entry key="S60" value="20.519890404400797" />
|
<entry key="S60" value="19.59208216216647" />
|
||||||
<entry key="M2" value="20.757818193595313" />
|
<entry key="M2" value="22.115739196316564" />
|
||||||
<entry key="M5" value="20.902610792920115" />
|
<entry key="M5" value="23.79980762074867" />
|
||||||
<entry key="M10" value="20.951218809778588" />
|
<entry key="M10" value="24.391870873465738" />
|
||||||
<entry key="M15" value="20.967459927351854" />
|
<entry key="M15" value="24.59277374272673" />
|
||||||
<entry key="M30" value="20.983720314651762" />
|
<entry key="M30" value="24.795477953117818" />
|
||||||
<entry key="H1" value="20.99185774329787" />
|
<entry key="H1" value="24.897510710086745" />
|
||||||
<entry key="H2" value="20.99592826792027" />
|
<entry key="H2" value="24.948698158288128" />
|
||||||
<entry key="H4" value="20.997963983000254" />
|
<entry key="H4" value="24.97433476365529" />
|
||||||
<entry key="D1" value="20.99966064286437" />
|
<entry key="D1" value="24.99572047096187" />
|
||||||
<entry key="W1" value="20.999951519895646" />
|
<entry key="W1" value="24.999388589964713" />
|
||||||
</decayedShown>
|
</decayedShown>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectColorInfo">{
|
<component name="ProjectColorInfo">{
|
||||||
@@ -105,7 +132,7 @@
|
|||||||
"codeWithMe.voiceChat.enabledByDefault": "false",
|
"codeWithMe.voiceChat.enabledByDefault": "false",
|
||||||
"git-widget-placeholder": "main",
|
"git-widget-placeholder": "main",
|
||||||
"javascript.preferred.runtime.type.id": "node",
|
"javascript.preferred.runtime.type.id": "node",
|
||||||
"last_opened_file_path": "/home/tobias/Projects/Work-Tracker",
|
"last_opened_file_path": "C:/Users/t.landgraf/GitProjects/work_tracker",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.jshint": "true",
|
"node.js.detected.package.jshint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
@@ -115,18 +142,18 @@
|
|||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"npm.dev.executor": "Run",
|
"npm.dev.executor": "Run",
|
||||||
"settings.editor.selected.configurable": "preferences.keymap",
|
"settings.editor.selected.configurable": "preferences.keymap",
|
||||||
"ts.external.directory.path": "/home/tobias/.local/share/JetBrains/Toolbox/apps/webstorm/plugins/javascript-plugin/jsLanguageServicesImpl/external"
|
"ts.external.directory.path": "C:\\Users\\t.landgraf\\AppData\\Local\\Programs\\WebStorm\\plugins\\javascript-plugin\\jsLanguageServicesImpl\\external"
|
||||||
}
|
}
|
||||||
}]]></component>
|
}]]></component>
|
||||||
<component name="RecentsManager">
|
<component name="RecentsManager">
|
||||||
<key name="MoveFile.RECENT_KEYS">
|
<key name="MoveFile.RECENT_KEYS">
|
||||||
<recent name="C:\Users\t.landgraf\GitProjects\work_tracker\frontend" />
|
|
||||||
<recent name="C:\Users\t.landgraf\GitProjects\work_tracker" />
|
<recent name="C:\Users\t.landgraf\GitProjects\work_tracker" />
|
||||||
|
<recent name="C:\Users\t.landgraf\GitProjects\work_tracker\frontend" />
|
||||||
</key>
|
</key>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager">
|
<component name="RunManager">
|
||||||
<configuration name="dev" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
<configuration name="dev" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
||||||
<package-json value="$PROJECT_DIR$/frontend/package.json" />
|
<package-json value="$PROJECT_DIR$/package.json" />
|
||||||
<command value="run" />
|
<command value="run" />
|
||||||
<scripts>
|
<scripts>
|
||||||
<script value="dev" />
|
<script value="dev" />
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
# 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 [Oxc](https://oxc.rs)
|
||||||
|
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
|
||||||
|
|
||||||
|
## React Compiler
|
||||||
|
|
||||||
|
The React Compiler is enabled on this template. See [this documentation](https://react.dev/learn/react-compiler) for more information.
|
||||||
|
|
||||||
|
Note: This will impact Vite dev & build performances.
|
||||||
|
|
||||||
|
## 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...
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
```
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.js
|
|
||||||
dist
|
|
||||||
.idea/
|
|
||||||
Generated
-1528
File diff suppressed because it is too large.
Load diff
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "work_tracker_backend",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"build": "tsc",
|
|
||||||
"start": "node dist/index.js",
|
|
||||||
"dev": "nodemon --exec ts-node src/index.ts"
|
|
||||||
},
|
|
||||||
"keywords": [],
|
|
||||||
"author": "",
|
|
||||||
"license": "ISC",
|
|
||||||
"type": "module",
|
|
||||||
"dependencies": {
|
|
||||||
"express": "^5.2.1"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/express": "^5.0.6",
|
|
||||||
"@types/node": "^26.1.2",
|
|
||||||
"nodemon": "^3.1.14",
|
|
||||||
"ts-node": "^10.9.2",
|
|
||||||
"typescript": "^5.9.2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import express from 'express';
|
|
||||||
import type { Request, Response } from 'express';
|
|
||||||
|
|
||||||
const app = express();
|
|
||||||
const PORT = process.env.PORT || 3000;
|
|
||||||
|
|
||||||
app.use(express.json());
|
|
||||||
|
|
||||||
app.get('/', (req: Request, res: Response) => {
|
|
||||||
res.json({ message: 'Hello from Express TypeScript!' });
|
|
||||||
});
|
|
||||||
|
|
||||||
app.listen(PORT, () => {
|
|
||||||
console.log(`Server running at http://localhost:${PORT}`);
|
|
||||||
});
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
// Visit https://aka.ms/tsconfig to read more about this file
|
|
||||||
"compilerOptions": {
|
|
||||||
// File Layout
|
|
||||||
// "rootDir": "./src",
|
|
||||||
// "outDir": "./dist",
|
|
||||||
|
|
||||||
// Environment Settings
|
|
||||||
// See also https://aka.ms/tsconfig/module
|
|
||||||
"module": "nodenext",
|
|
||||||
"target": "esnext",
|
|
||||||
"types": [],
|
|
||||||
// For nodejs:
|
|
||||||
// "lib": ["esnext"],
|
|
||||||
// "types": ["node"],
|
|
||||||
// and npm install -D @types/node
|
|
||||||
|
|
||||||
// Other Outputs
|
|
||||||
"sourceMap": true,
|
|
||||||
"declaration": true,
|
|
||||||
"declarationMap": true,
|
|
||||||
|
|
||||||
// Stricter Typechecking Options
|
|
||||||
"noUncheckedIndexedAccess": true,
|
|
||||||
"exactOptionalPropertyTypes": true,
|
|
||||||
|
|
||||||
// Style Options
|
|
||||||
// "noImplicitReturns": true,
|
|
||||||
// "noImplicitOverride": true,
|
|
||||||
// "noUnusedLocals": true,
|
|
||||||
// "noUnusedParameters": true,
|
|
||||||
// "noFallthroughCasesInSwitch": true,
|
|
||||||
// "noPropertyAccessFromIndexSignature": true,
|
|
||||||
|
|
||||||
// Recommended Options
|
|
||||||
"strict": true,
|
|
||||||
"jsx": "react-jsx",
|
|
||||||
"verbatimModuleSyntax": true,
|
|
||||||
"isolatedModules": true,
|
|
||||||
"noUncheckedSideEffectImports": true,
|
|
||||||
"moduleDetection": "force",
|
|
||||||
"skipLibCheck": true,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File renamed without changes.
@@ -1,77 +0,0 @@
|
|||||||
# 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 [Oxc](https://oxc.rs)
|
|
||||||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
|
|
||||||
|
|
||||||
## React Compiler
|
|
||||||
|
|
||||||
The React Compiler is enabled on this template. See [this documentation](https://react.dev/learn/react-compiler) for more information.
|
|
||||||
|
|
||||||
Note: This will impact Vite dev & build performances.
|
|
||||||
|
|
||||||
## 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...
|
|
||||||
},
|
|
||||||
},
|
|
||||||
])
|
|
||||||
|
|
||||||
```
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -4,50 +4,37 @@ import * as React from 'react';
|
|||||||
|
|
||||||
type Workday = 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday';
|
type Workday = 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday';
|
||||||
|
|
||||||
|
const toMinutes = (time: string): number | null => {
|
||||||
|
const match = /^(\d{2}):(\d{2})$/.exec(time);
|
||||||
|
if (!match) return null;
|
||||||
|
return Number(match[1]) * 60 + Number(match[2]);
|
||||||
|
};
|
||||||
|
|
||||||
|
const fromMinutes = (mins: number): string => {
|
||||||
|
const h = Math.floor(mins / 60) % 24;
|
||||||
|
const m = mins % 60;
|
||||||
|
return `${String(h).padStart(2, '0')}:${String(m).padStart(2, '0')}`;
|
||||||
|
};
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const [selectedDay, setSelectedDay] = React.useState<Workday>('Monday');
|
const [selectedDay, setSelectedDay] = React.useState<Workday>('Monday');
|
||||||
const [workStart, setWorkStart] = React.useState<Date | null>(null);
|
const [workStart, setWorkStart] = React.useState<string>('');
|
||||||
const [workEnd, setWorkEnd] = React.useState<Date | null>(null);
|
const [workEnd, setWorkEnd] = React.useState<string>('');
|
||||||
const [breakMins, setBreakMins] = React.useState<number>(0);
|
const [breakMins, setBreakMins] = React.useState<number>(0);
|
||||||
const [workedHrs, setWorkedHrs] = React.useState<number>(0);
|
const [workedHrs, setWorkedHrs] = React.useState<number>(0);
|
||||||
|
|
||||||
const getHourDiff = (): number => {
|
const getHourDiff = () => {
|
||||||
// FIX: Ensure both dates are valid before calculating
|
const start = toMinutes(workStart);
|
||||||
if (!workStart || !workEnd || isNaN(workStart.getTime()) || isNaN(workEnd.getTime())) {
|
const end = toMinutes(workEnd);
|
||||||
return 0;
|
if (start === null || end === null) return 0;
|
||||||
}
|
return (end - start) / 60 - breakMins / 60;
|
||||||
|
}
|
||||||
|
|
||||||
let startMs = workStart.getTime();
|
const getWorkEndTime = () => {
|
||||||
let endMs = workEnd.getTime();
|
const start = toMinutes(workStart);
|
||||||
|
if (start === null) return '—';
|
||||||
let diffMs = endMs - startMs;
|
return fromMinutes(start + 8 * 60 + breakMins);
|
||||||
|
}
|
||||||
if (diffMs < 0) {
|
|
||||||
diffMs += 24 * 60 * 60 * 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
const breakMs = breakMins * 60 * 1000;
|
|
||||||
const netMs = diffMs - breakMs;
|
|
||||||
|
|
||||||
return netMs / (1000 * 60 * 60);
|
|
||||||
};
|
|
||||||
|
|
||||||
const getWorkEndTime = (): string => {
|
|
||||||
// FIX: Ensure workStart is valid
|
|
||||||
if (!workStart || !workEnd) return 0;
|
|
||||||
if (!workStart || isNaN(workStart.getTime())) return '--:--';
|
|
||||||
|
|
||||||
const targetDate = new Date(workStart);
|
|
||||||
const additionalTimeMs = (8 * 60 * 60 * 1000) + (breakMins * 60 * 1000);
|
|
||||||
targetDate.setTime(targetDate.getTime() + additionalTimeMs);
|
|
||||||
|
|
||||||
// FIX: Check if result is valid before formatting
|
|
||||||
if (isNaN(targetDate.getTime())) return '--:--';
|
|
||||||
|
|
||||||
const hours = targetDate.getHours().toString().padStart(2, '0');
|
|
||||||
const minutes = targetDate.getMinutes().toString().padStart(2, '0');
|
|
||||||
return `${hours}:${minutes}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Center>
|
<Center>
|
||||||
@@ -55,8 +42,8 @@ function App() {
|
|||||||
<SegmentedControl
|
<SegmentedControl
|
||||||
data={['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']}
|
data={['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
setWorkStart(null);
|
setWorkStart('');
|
||||||
setWorkEnd(null);
|
setWorkEnd('');
|
||||||
setSelectedDay(value as Workday);
|
setSelectedDay(value as Workday);
|
||||||
}}
|
}}
|
||||||
className={"mt-2"}
|
className={"mt-2"}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user