From b0ef975c2bfde170c998bb8b4ed8b94bbfcc1a4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Wed, 25 Jan 2023 11:44:04 +0100 Subject: [PATCH 01/38] Add vite react --- frontend/.gitignore | 24 ++++++++++++ frontend/index.html | 13 +++++++ frontend/package.json | 21 +++++++++++ frontend/public/vite.svg | 1 + frontend/src/App.css | 41 ++++++++++++++++++++ frontend/src/App.jsx | 34 +++++++++++++++++ frontend/src/assets/react.svg | 1 + frontend/src/index.css | 70 +++++++++++++++++++++++++++++++++++ frontend/src/main.jsx | 10 +++++ frontend/vite.config.js | 7 ++++ 10 files changed, 222 insertions(+) create mode 100644 frontend/.gitignore create mode 100644 frontend/index.html create mode 100644 frontend/package.json create mode 100644 frontend/public/vite.svg create mode 100644 frontend/src/App.css create mode 100644 frontend/src/App.jsx create mode 100644 frontend/src/assets/react.svg create mode 100644 frontend/src/index.css create mode 100644 frontend/src/main.jsx create mode 100644 frontend/vite.config.js diff --git a/frontend/.gitignore b/frontend/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/frontend/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..79c4701 --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + React + + +
+ + + diff --git a/frontend/package.json b/frontend/package.json new file mode 100644 index 0000000..2371d17 --- /dev/null +++ b/frontend/package.json @@ -0,0 +1,21 @@ +{ + "name": "frontend", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@types/react": "^18.0.26", + "@types/react-dom": "^18.0.9", + "@vitejs/plugin-react": "^3.0.0", + "vite": "^4.0.0" + } +} \ No newline at end of file diff --git a/frontend/public/vite.svg b/frontend/public/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/frontend/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/src/App.css b/frontend/src/App.css new file mode 100644 index 0000000..2c5e2ef --- /dev/null +++ b/frontend/src/App.css @@ -0,0 +1,41 @@ +#root { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} + +.logo { + height: 6em; + padding: 1.5em; + will-change: filter; +} +.logo:hover { + filter: drop-shadow(0 0 2em #646cffaa); +} +.logo.react:hover { + filter: drop-shadow(0 0 2em #61dafbaa); +} + +@keyframes logo-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} + +@media (prefers-reduced-motion: no-preference) { + a:nth-of-type(2) .logo { + animation: logo-spin infinite 20s linear; + } +} + +.card { + padding: 2em; +} + +.read-the-docs { + color: #888; +} diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx new file mode 100644 index 0000000..ef0adc0 --- /dev/null +++ b/frontend/src/App.jsx @@ -0,0 +1,34 @@ +import { useState } from 'react' +import reactLogo from './assets/react.svg' +import './App.css' + +function App() { + const [count, setCount] = useState(0) + + return ( +
+
+ + Vite logo + + + React logo + +
+

Vite + React

+
+ +

+ Edit src/App.jsx and save to test HMR +

+
+

+ Click on the Vite and React logos to learn more +

+
+ ) +} + +export default App diff --git a/frontend/src/assets/react.svg b/frontend/src/assets/react.svg new file mode 100644 index 0000000..6c87de9 --- /dev/null +++ b/frontend/src/assets/react.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/src/index.css b/frontend/src/index.css new file mode 100644 index 0000000..917888c --- /dev/null +++ b/frontend/src/index.css @@ -0,0 +1,70 @@ +:root { + font-family: Inter, Avenir, Helvetica, Arial, sans-serif; + font-size: 16px; + line-height: 24px; + font-weight: 400; + + color-scheme: light dark; + color: rgba(255, 255, 255, 0.87); + background-color: #242424; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-text-size-adjust: 100%; +} + +a { + font-weight: 500; + color: #646cff; + text-decoration: inherit; +} +a:hover { + color: #535bf2; +} + +body { + margin: 0; + display: flex; + place-items: center; + min-width: 320px; + min-height: 100vh; +} + +h1 { + font-size: 3.2em; + line-height: 1.1; +} + +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + background-color: #1a1a1a; + cursor: pointer; + transition: border-color 0.25s; +} +button:hover { + border-color: #646cff; +} +button:focus, +button:focus-visible { + outline: 4px auto -webkit-focus-ring-color; +} + +@media (prefers-color-scheme: light) { + :root { + color: #213547; + background-color: #ffffff; + } + a:hover { + color: #747bff; + } + button { + background-color: #f9f9f9; + } +} diff --git a/frontend/src/main.jsx b/frontend/src/main.jsx new file mode 100644 index 0000000..5cc5991 --- /dev/null +++ b/frontend/src/main.jsx @@ -0,0 +1,10 @@ +import React from 'react' +import ReactDOM from 'react-dom/client' +import App from './App' +import './index.css' + +ReactDOM.createRoot(document.getElementById('root')).render( + + + , +) diff --git a/frontend/vite.config.js b/frontend/vite.config.js new file mode 100644 index 0000000..5a33944 --- /dev/null +++ b/frontend/vite.config.js @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [react()], +}) -- 2.40.1 From 03142bc3c3b0df9536cd9b9c52910b4fc2b347aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Wed, 25 Jan 2023 11:48:17 +0100 Subject: [PATCH 02/38] Add vite proxy config --- frontend/vite.config.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 5a33944..d54c977 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -1,7 +1,12 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], -}) + server: { + proxy: { + "/": "http://localhost:8001", + }, + }, +}); -- 2.40.1 From bec4e3716a9eb7bcbf7c9c1b3e01840160e28d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Wed, 25 Jan 2023 11:49:22 +0100 Subject: [PATCH 03/38] CI: autotag --- .drone.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index e7df4da..49c540a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -30,9 +30,7 @@ steps: image: plugins/docker settings: repo: registry.kucharczyk.xyz/timetracker - tags: - - ${DRONE_COMMIT_REF} - - ${DRONE_COMMIT_BRANCH} + auto_tag: true when: branch: exclude: -- 2.40.1 From a4ec5d0dbc066e0ac79da6f5ca4a73d86665e139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Wed, 25 Jan 2023 12:05:37 +0100 Subject: [PATCH 04/38] Add django-rest-framework --- games/serializers.py | 0 poetry.lock | 125 +++++++++++++++++++++++++++++++++++++++- pyproject.toml | 3 + timetracker/settings.py | 7 +++ timetracker/urls.py | 58 ++++++++++++++++++- 5 files changed, 189 insertions(+), 4 deletions(-) create mode 100644 games/serializers.py diff --git a/games/serializers.py b/games/serializers.py new file mode 100644 index 0000000..e69de29 diff --git a/poetry.lock b/poetry.lock index 657f395..b791d1a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -143,6 +143,36 @@ files = [ [package.dependencies] Django = ">=3.2" +[[package]] +name = "django-rest-framework" +version = "0.1.0" +description = "alias." +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "django-rest-framework-0.1.0.tar.gz", hash = "sha256:47a8f496fa69e3b6bd79f68dd7a1527d907d6b77f009e9db7cf9bb21cc565e4a"}, +] + +[package.dependencies] +djangorestframework = "*" + +[[package]] +name = "djangorestframework" +version = "3.14.0" +description = "Web APIs for Django, made easy." +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "djangorestframework-3.14.0-py3-none-any.whl", hash = "sha256:eb63f58c9f218e1a7d064d17a70751f528ed4e1d35547fdade9aaf4cd103fd08"}, + {file = "djangorestframework-3.14.0.tar.gz", hash = "sha256:579a333e6256b09489cbe0a067e66abe55c6595d8926be6b99423786334350c8"}, +] + +[package.dependencies] +django = ">=3.0" +pytz = "*" + [[package]] name = "djhtml" version = "1.5.2" @@ -495,6 +525,97 @@ files = [ {file = "pathspec-0.11.2.tar.gz", hash = "sha256:e0d8d0ac2f12da61956eb2306b69f9469b42f4deb0f3cb6ed47b9cce9996ced3"}, ] +[[package]] +name = "pillow" +version = "9.4.0" +description = "Python Imaging Library (Fork)" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "Pillow-9.4.0-1-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:1b4b4e9dda4f4e4c4e6896f93e84a8f0bcca3b059de9ddf67dac3c334b1195e1"}, + {file = "Pillow-9.4.0-1-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:fb5c1ad6bad98c57482236a21bf985ab0ef42bd51f7ad4e4538e89a997624e12"}, + {file = "Pillow-9.4.0-1-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:f0caf4a5dcf610d96c3bd32932bfac8aee61c96e60481c2a0ea58da435e25acd"}, + {file = "Pillow-9.4.0-1-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:3f4cc516e0b264c8d4ccd6b6cbc69a07c6d582d8337df79be1e15a5056b258c9"}, + {file = "Pillow-9.4.0-1-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:b8c2f6eb0df979ee99433d8b3f6d193d9590f735cf12274c108bd954e30ca858"}, + {file = "Pillow-9.4.0-1-pp38-pypy38_pp73-macosx_10_10_x86_64.whl", hash = "sha256:b70756ec9417c34e097f987b4d8c510975216ad26ba6e57ccb53bc758f490dab"}, + {file = "Pillow-9.4.0-1-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:43521ce2c4b865d385e78579a082b6ad1166ebed2b1a2293c3be1d68dd7ca3b9"}, + {file = "Pillow-9.4.0-2-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:9d9a62576b68cd90f7075876f4e8444487db5eeea0e4df3ba298ee38a8d067b0"}, + {file = "Pillow-9.4.0-2-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:87708d78a14d56a990fbf4f9cb350b7d89ee8988705e58e39bdf4d82c149210f"}, + {file = "Pillow-9.4.0-2-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:8a2b5874d17e72dfb80d917213abd55d7e1ed2479f38f001f264f7ce7bae757c"}, + {file = "Pillow-9.4.0-2-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:83125753a60cfc8c412de5896d10a0a405e0bd88d0470ad82e0869ddf0cb3848"}, + {file = "Pillow-9.4.0-2-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:9e5f94742033898bfe84c93c831a6f552bb629448d4072dd312306bab3bd96f1"}, + {file = "Pillow-9.4.0-2-pp38-pypy38_pp73-macosx_10_10_x86_64.whl", hash = "sha256:013016af6b3a12a2f40b704677f8b51f72cb007dac785a9933d5c86a72a7fe33"}, + {file = "Pillow-9.4.0-2-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:99d92d148dd03fd19d16175b6d355cc1b01faf80dae93c6c3eb4163709edc0a9"}, + {file = "Pillow-9.4.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:2968c58feca624bb6c8502f9564dd187d0e1389964898f5e9e1fbc8533169157"}, + {file = "Pillow-9.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c5c1362c14aee73f50143d74389b2c158707b4abce2cb055b7ad37ce60738d47"}, + {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bd752c5ff1b4a870b7661234694f24b1d2b9076b8bf337321a814c612665f343"}, + {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9a3049a10261d7f2b6514d35bbb7a4dfc3ece4c4de14ef5876c4b7a23a0e566d"}, + {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:16a8df99701f9095bea8a6c4b3197da105df6f74e6176c5b410bc2df2fd29a57"}, + {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:94cdff45173b1919350601f82d61365e792895e3c3a3443cf99819e6fbf717a5"}, + {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:ed3e4b4e1e6de75fdc16d3259098de7c6571b1a6cc863b1a49e7d3d53e036070"}, + {file = "Pillow-9.4.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d5b2f8a31bd43e0f18172d8ac82347c8f37ef3e0b414431157718aa234991b28"}, + {file = "Pillow-9.4.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:09b89ddc95c248ee788328528e6a2996e09eaccddeeb82a5356e92645733be35"}, + {file = "Pillow-9.4.0-cp310-cp310-win32.whl", hash = "sha256:f09598b416ba39a8f489c124447b007fe865f786a89dbfa48bb5cf395693132a"}, + {file = "Pillow-9.4.0-cp310-cp310-win_amd64.whl", hash = "sha256:f6e78171be3fb7941f9910ea15b4b14ec27725865a73c15277bc39f5ca4f8391"}, + {file = "Pillow-9.4.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:3fa1284762aacca6dc97474ee9c16f83990b8eeb6697f2ba17140d54b453e133"}, + {file = "Pillow-9.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:eaef5d2de3c7e9b21f1e762f289d17b726c2239a42b11e25446abf82b26ac132"}, + {file = "Pillow-9.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a4dfdae195335abb4e89cc9762b2edc524f3c6e80d647a9a81bf81e17e3fb6f0"}, + {file = "Pillow-9.4.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6abfb51a82e919e3933eb137e17c4ae9c0475a25508ea88993bb59faf82f3b35"}, + {file = "Pillow-9.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:451f10ef963918e65b8869e17d67db5e2f4ab40e716ee6ce7129b0cde2876eab"}, + {file = "Pillow-9.4.0-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:6663977496d616b618b6cfa43ec86e479ee62b942e1da76a2c3daa1c75933ef4"}, + {file = "Pillow-9.4.0-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:60e7da3a3ad1812c128750fc1bc14a7ceeb8d29f77e0a2356a8fb2aa8925287d"}, + {file = "Pillow-9.4.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:19005a8e58b7c1796bc0167862b1f54a64d3b44ee5d48152b06bb861458bc0f8"}, + {file = "Pillow-9.4.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:f715c32e774a60a337b2bb8ad9839b4abf75b267a0f18806f6f4f5f1688c4b5a"}, + {file = "Pillow-9.4.0-cp311-cp311-win32.whl", hash = "sha256:b222090c455d6d1a64e6b7bb5f4035c4dff479e22455c9eaa1bdd4c75b52c80c"}, + {file = "Pillow-9.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:ba6612b6548220ff5e9df85261bddc811a057b0b465a1226b39bfb8550616aee"}, + {file = "Pillow-9.4.0-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:5f532a2ad4d174eb73494e7397988e22bf427f91acc8e6ebf5bb10597b49c493"}, + {file = "Pillow-9.4.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5dd5a9c3091a0f414a963d427f920368e2b6a4c2f7527fdd82cde8ef0bc7a327"}, + {file = "Pillow-9.4.0-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ef21af928e807f10bf4141cad4746eee692a0dd3ff56cfb25fce076ec3cc8abe"}, + {file = "Pillow-9.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:847b114580c5cc9ebaf216dd8c8dbc6b00a3b7ab0131e173d7120e6deade1f57"}, + {file = "Pillow-9.4.0-cp37-cp37m-manylinux_2_28_aarch64.whl", hash = "sha256:653d7fb2df65efefbcbf81ef5fe5e5be931f1ee4332c2893ca638c9b11a409c4"}, + {file = "Pillow-9.4.0-cp37-cp37m-manylinux_2_28_x86_64.whl", hash = "sha256:46f39cab8bbf4a384ba7cb0bc8bae7b7062b6a11cfac1ca4bc144dea90d4a9f5"}, + {file = "Pillow-9.4.0-cp37-cp37m-win32.whl", hash = "sha256:7ac7594397698f77bce84382929747130765f66406dc2cd8b4ab4da68ade4c6e"}, + {file = "Pillow-9.4.0-cp37-cp37m-win_amd64.whl", hash = "sha256:46c259e87199041583658457372a183636ae8cd56dbf3f0755e0f376a7f9d0e6"}, + {file = "Pillow-9.4.0-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:0e51f608da093e5d9038c592b5b575cadc12fd748af1479b5e858045fff955a9"}, + {file = "Pillow-9.4.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:765cb54c0b8724a7c12c55146ae4647e0274a839fb6de7bcba841e04298e1011"}, + {file = "Pillow-9.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:519e14e2c49fcf7616d6d2cfc5c70adae95682ae20f0395e9280db85e8d6c4df"}, + {file = "Pillow-9.4.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d197df5489004db87d90b918033edbeee0bd6df3848a204bca3ff0a903bef837"}, + {file = "Pillow-9.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0845adc64fe9886db00f5ab68c4a8cd933ab749a87747555cec1c95acea64b0b"}, + {file = "Pillow-9.4.0-cp38-cp38-manylinux_2_28_aarch64.whl", hash = "sha256:e1339790c083c5a4de48f688b4841f18df839eb3c9584a770cbd818b33e26d5d"}, + {file = "Pillow-9.4.0-cp38-cp38-manylinux_2_28_x86_64.whl", hash = "sha256:a96e6e23f2b79433390273eaf8cc94fec9c6370842e577ab10dabdcc7ea0a66b"}, + {file = "Pillow-9.4.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:7cfc287da09f9d2a7ec146ee4d72d6ea1342e770d975e49a8621bf54eaa8f30f"}, + {file = "Pillow-9.4.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:d7081c084ceb58278dd3cf81f836bc818978c0ccc770cbbb202125ddabec6628"}, + {file = "Pillow-9.4.0-cp38-cp38-win32.whl", hash = "sha256:df41112ccce5d47770a0c13651479fbcd8793f34232a2dd9faeccb75eb5d0d0d"}, + {file = "Pillow-9.4.0-cp38-cp38-win_amd64.whl", hash = "sha256:7a21222644ab69ddd9967cfe6f2bb420b460dae4289c9d40ff9a4896e7c35c9a"}, + {file = "Pillow-9.4.0-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:0f3269304c1a7ce82f1759c12ce731ef9b6e95b6df829dccd9fe42912cc48569"}, + {file = "Pillow-9.4.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:cb362e3b0976dc994857391b776ddaa8c13c28a16f80ac6522c23d5257156bed"}, + {file = "Pillow-9.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a2e0f87144fcbbe54297cae708c5e7f9da21a4646523456b00cc956bd4c65815"}, + {file = "Pillow-9.4.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:28676836c7796805914b76b1837a40f76827ee0d5398f72f7dcc634bae7c6264"}, + {file = "Pillow-9.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0884ba7b515163a1a05440a138adeb722b8a6ae2c2b33aea93ea3118dd3a899e"}, + {file = "Pillow-9.4.0-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:53dcb50fbdc3fb2c55431a9b30caeb2f7027fcd2aeb501459464f0214200a503"}, + {file = "Pillow-9.4.0-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:e8c5cf126889a4de385c02a2c3d3aba4b00f70234bfddae82a5eaa3ee6d5e3e6"}, + {file = "Pillow-9.4.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:6c6b1389ed66cdd174d040105123a5a1bc91d0aa7059c7261d20e583b6d8cbd2"}, + {file = "Pillow-9.4.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:0dd4c681b82214b36273c18ca7ee87065a50e013112eea7d78c7a1b89a739153"}, + {file = "Pillow-9.4.0-cp39-cp39-win32.whl", hash = "sha256:6d9dfb9959a3b0039ee06c1a1a90dc23bac3b430842dcb97908ddde05870601c"}, + {file = "Pillow-9.4.0-cp39-cp39-win_amd64.whl", hash = "sha256:54614444887e0d3043557d9dbc697dbb16cfb5a35d672b7a0fcc1ed0cf1c600b"}, + {file = "Pillow-9.4.0-pp38-pypy38_pp73-macosx_10_10_x86_64.whl", hash = "sha256:b9b752ab91e78234941e44abdecc07f1f0d8f51fb62941d32995b8161f68cfe5"}, + {file = "Pillow-9.4.0-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d3b56206244dc8711f7e8b7d6cad4663917cd5b2d950799425076681e8766286"}, + {file = "Pillow-9.4.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aabdab8ec1e7ca7f1434d042bf8b1e92056245fb179790dc97ed040361f16bfd"}, + {file = "Pillow-9.4.0-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:db74f5562c09953b2c5f8ec4b7dfd3f5421f31811e97d1dbc0a7c93d6e3a24df"}, + {file = "Pillow-9.4.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:e9d7747847c53a16a729b6ee5e737cf170f7a16611c143d95aa60a109a59c336"}, + {file = "Pillow-9.4.0-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:b52ff4f4e002f828ea6483faf4c4e8deea8d743cf801b74910243c58acc6eda3"}, + {file = "Pillow-9.4.0-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:575d8912dca808edd9acd6f7795199332696d3469665ef26163cd090fa1f8bfa"}, + {file = "Pillow-9.4.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c3c4ed2ff6760e98d262e0cc9c9a7f7b8a9f61aa4d47c58835cdaf7b0b8811bb"}, + {file = "Pillow-9.4.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:e621b0246192d3b9cb1dc62c78cfa4c6f6d2ddc0ec207d43c0dedecb914f152a"}, + {file = "Pillow-9.4.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:8f127e7b028900421cad64f51f75c051b628db17fb00e099eb148761eed598c9"}, + {file = "Pillow-9.4.0.tar.gz", hash = "sha256:a1c2d7780448eb93fbcc3789bf3916aa5720d942e37945f4056680317f1cd23e"}, +] + +[package.extras] +docs = ["furo", "olefile", "sphinx (>=2.4)", "sphinx-copybutton", "sphinx-inline-tabs", "sphinx-issues (>=3.0.1)", "sphinx-removed-in", "sphinxext-opengraph"] +tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "packaging", "pyroma", "pytest", "pytest-cov", "pytest-timeout"] + [[package]] name = "platformdirs" version = "3.11.0" @@ -861,5 +982,5 @@ watchdog = ["watchdog (>=2.3)"] [metadata] lock-version = "2.0" -python-versions = "^3.12" -content-hash = "32e7c40e7148530effb10ebd5d67a4f1c8fe30794a4d3b5d213d4f30048c79ea" +python-versions = "^3.10" +content-hash = "4ca6b31c654012f0d2b72bd44d3f40d986b183d6dd731c3a2aaed9a733032c08" diff --git a/pyproject.toml b/pyproject.toml index b9e7dd2..ee1ec1f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,6 +12,9 @@ python = "^3.12" django = "^4.2.0" gunicorn = "^20.1.0" uvicorn = "^0.20.0" +pandas = "^1.5.2" +matplotlib = "^3.6.3" +django-rest-framework = "^0.1.0" [tool.poetry.group.dev.dependencies] black = "^22.12.0" diff --git a/timetracker/settings.py b/timetracker/settings.py index d2ca081..3b548a4 100644 --- a/timetracker/settings.py +++ b/timetracker/settings.py @@ -38,6 +38,7 @@ INSTALLED_APPS = [ "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", + "rest_framework", ] if DEBUG: @@ -150,3 +151,9 @@ if _csrf_trusted_origins: CSRF_TRUSTED_ORIGINS = _csrf_trusted_origins.split(",") else: CSRF_TRUSTED_ORIGINS = [] + +REST_FRAMEWORK = { + "DEFAULT_PERMISSION_CLASSES": [ + "rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly" + ] +} diff --git a/timetracker/urls.py b/timetracker/urls.py index 55e776b..7077354 100644 --- a/timetracker/urls.py +++ b/timetracker/urls.py @@ -17,10 +17,64 @@ from django.conf import settings from django.contrib import admin from django.urls import include, path from django.views.generic import RedirectView +from rest_framework import routers, serializers, viewsets +from games.models import Game, Purchase, Platform, Session + + +class GameSerializer(serializers.HyperlinkedModelSerializer): + class Meta: + model = Game + fields = "__all__" + + +class PlatformSerializer(serializers.HyperlinkedModelSerializer): + class Meta: + model = Platform + fields = "__all__" + + +class PurchaseSerializer(serializers.HyperlinkedModelSerializer): + class Meta: + model = Purchase + fields = "__all__" + + +class SessionSerializer(serializers.HyperlinkedModelSerializer): + class Meta: + model = Session + fields = "__all__" + + +class GameViewSet(viewsets.ModelViewSet): + queryset = Game.objects.all() + serializer_class = GameSerializer + + +class PlatformViewSet(viewsets.ModelViewSet): + queryset = Platform.objects.all() + serializer_class = PlatformSerializer + + +class PurchaseViewSet(viewsets.ModelViewSet): + queryset = Purchase.objects.all() + serializer_class = PurchaseSerializer + + +class SessionViewSet(viewsets.ModelViewSet): + queryset = Session.objects.all() + serializer_class = SessionSerializer + + +router = routers.DefaultRouter() +router.register(r"games", GameViewSet) +router.register(r"platforms", PlatformViewSet) +router.register(r"purchases", PurchaseViewSet) +router.register(r"sessions", SessionViewSet) + urlpatterns = [ - path("", RedirectView.as_view(url="/tracker")), - path("tracker/", include("games.urls")), + path("", include(router.urls)), + path("api-auth/", include("rest_framework.urls", namespace="rest_framework")), ] if settings.DEBUG: -- 2.40.1 From aecf0d6a6eb5fd3d400e94f7df4a63066fde6ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Wed, 25 Jan 2023 12:17:56 +0100 Subject: [PATCH 05/38] Change API url --- timetracker/urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/timetracker/urls.py b/timetracker/urls.py index 7077354..f056a77 100644 --- a/timetracker/urls.py +++ b/timetracker/urls.py @@ -73,7 +73,7 @@ router.register(r"sessions", SessionViewSet) urlpatterns = [ - path("", include(router.urls)), + path("api/", include(router.urls)), path("api-auth/", include("rest_framework.urls", namespace="rest_framework")), ] -- 2.40.1 From 048401b20ac46e67588cf16b6ad58ebfe06bae11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Wed, 25 Jan 2023 12:47:39 +0100 Subject: [PATCH 06/38] Integrate TailwindCSS --- Makefile | 10 +-- common/input.css | 113 ---------------------------------- frontend/index.html | 10 ++- frontend/package.json | 7 ++- frontend/postcss.config.cjs | 6 ++ frontend/src/App.css | 41 ------------ frontend/src/App.jsx | 54 +++++++++------- frontend/src/assets/react.svg | 1 - frontend/src/index.css | 78 +++++------------------ frontend/tailwind.config.cjs | 12 ++++ frontend/vite.config.js | 2 +- tailwind.config.js | 19 ------ 12 files changed, 79 insertions(+), 274 deletions(-) delete mode 100644 common/input.css create mode 100644 frontend/postcss.config.cjs delete mode 100644 frontend/src/assets/react.svg create mode 100644 frontend/tailwind.config.cjs delete mode 100644 tailwind.config.js diff --git a/Makefile b/Makefile index 8d45097..3e3c57e 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,12 @@ -all: css migrate +all: migrate -initialize: npm css migrate sethookdir loadplatforms +initialize: npm migrate sethookdir loadplatforms HTMLFILES := $(shell find games/templates -type f) npm: npm install -css: common/input.css - npx tailwindcss -i ./common/input.css -o ./games/static/base.css - -css-dev: css - npx tailwindcss -i ./common/input.css -o ./games/static/base.css --watch - makemigrations: poetry run python manage.py makemigrations diff --git a/common/input.css b/common/input.css deleted file mode 100644 index e8a7e7d..0000000 --- a/common/input.css +++ /dev/null @@ -1,113 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -@font-face { - font-family: "IBM Plex Mono"; - src: url("fonts/IBMPlexMono-regular.woff2") format("woff2"); - font-weight: 400; - font-style: normal; -} - -@font-face { - font-family: "IBM Plex Sans"; - src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2"); - font-weight: 400; - font-style: normal; -} - -@font-face { - font-family: "IBM Plex Serif"; - src: url("fonts/IBMPlexSerif-Regular.woff2") format("woff2"); - font-weight: 400; - font-style: normal; -} - -form label { - @apply dark:text-slate-400; -} - -.responsive-table { - @apply dark:text-white mx-auto; -} - -.responsive-table tr:nth-child(even) { - @apply bg-slate-800 -} - -.responsive-table tbody tr:nth-child(odd) { - @apply bg-slate-900 -} - -.responsive-table thead th { - @apply text-left border-b-2 border-b-slate-500 text-xl; -} - -.responsive-table thead th:not(:first-child), -.responsive-table td:not(:first-child) { - @apply border-l border-l-slate-500; -} - -@layer utilities { - .max-w-20char { - max-width: 20ch; - } - .max-w-35char { - max-width: 40ch; - } - .max-w-40char { - max-width: 40ch; - } -} - -form input, -select, -textarea { - @apply dark:border dark:border-slate-900 dark:bg-slate-500 dark:text-slate-100; -} - -form input:disabled, -select:disabled, -textarea:disabled { - @apply dark:bg-slate-700 dark:text-slate-400; -} - -.errorlist { - @apply mt-4 mb-1 pl-3 py-2 bg-red-600 text-slate-200 w-[300px]; -} - -@media screen and (min-width: 768px) { - form input, - select, - textarea { - width: 300px; - } -} - -@media screen and (max-width: 768px) { - form input, - select, - textarea { - width: 150px; - } -} - -#button-container button { - @apply mx-1; -} - -th { - @apply text-right; -} - -th label { - @apply mr-4; -} - -.basic-button-container { - @apply flex space-x-2 justify-center; -} - -.basic-button { - @apply inline-block px-6 py-2.5 bg-blue-600 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out; -} diff --git a/frontend/index.html b/frontend/index.html index 79c4701..b52f64c 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -2,11 +2,15 @@ - + + - Vite + React + + + + Timetracker - +
diff --git a/frontend/package.json b/frontend/package.json index 2371d17..af93702 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,8 +9,11 @@ "preview": "vite preview" }, "dependencies": { + "autoprefixer": "^10.4.13", + "postcss": "^8.4.21", "react": "^18.2.0", - "react-dom": "^18.2.0" + "react-dom": "^18.2.0", + "tailwindcss": "^3.2.4" }, "devDependencies": { "@types/react": "^18.0.26", @@ -18,4 +21,4 @@ "@vitejs/plugin-react": "^3.0.0", "vite": "^4.0.0" } -} \ No newline at end of file +} diff --git a/frontend/postcss.config.cjs b/frontend/postcss.config.cjs new file mode 100644 index 0000000..33ad091 --- /dev/null +++ b/frontend/postcss.config.cjs @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/frontend/src/App.css b/frontend/src/App.css index 2c5e2ef..e69de29 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -1,41 +0,0 @@ -#root { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; -} - -.logo { - height: 6em; - padding: 1.5em; - will-change: filter; -} -.logo:hover { - filter: drop-shadow(0 0 2em #646cffaa); -} -.logo.react:hover { - filter: drop-shadow(0 0 2em #61dafbaa); -} - -@keyframes logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} - -@media (prefers-reduced-motion: no-preference) { - a:nth-of-type(2) .logo { - animation: logo-spin infinite 20s linear; - } -} - -.card { - padding: 2em; -} - -.read-the-docs { - color: #888; -} diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index ef0adc0..0831da0 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1,33 +1,41 @@ import { useState } from 'react' -import reactLogo from './assets/react.svg' import './App.css' function App() { const [count, setCount] = useState(0) return ( -
- -

Vite + React

-
- -

- Edit src/App.jsx and save to test HMR -

-
-

- Click on the Vite and React logos to learn more -

-
+ <> +
+ + {/* {% block content %}No content here.{% endblock content %} */} +
+ {/* {% load version %} */} + {/* {% version %} ({% version_date %}) */} + ) } diff --git a/frontend/src/assets/react.svg b/frontend/src/assets/react.svg deleted file mode 100644 index 6c87de9..0000000 --- a/frontend/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/src/index.css b/frontend/src/index.css index 917888c..539a4ec 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -1,70 +1,22 @@ -:root { - font-family: Inter, Avenir, Helvetica, Arial, sans-serif; - font-size: 16px; - line-height: 24px; - font-weight: 400; +@tailwind base; +@tailwind components; +@tailwind utilities; - color-scheme: light dark; - color: rgba(255, 255, 255, 0.87); - background-color: #242424; - - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - -webkit-text-size-adjust: 100%; +form label { + @apply dark:text-slate-400; } -a { - font-weight: 500; - color: #646cff; - text-decoration: inherit; -} -a:hover { - color: #535bf2; +form input, +select, +textarea { + @apply dark:border dark:border-slate-900 dark:bg-slate-500 dark:text-slate-100; } -body { - margin: 0; - display: flex; - place-items: center; - min-width: 320px; - min-height: 100vh; +#session-table { + display: grid; + grid-template-columns: 3fr 1fr repeat(2, 2fr) 0.5fr 1fr; } -h1 { - font-size: 3.2em; - line-height: 1.1; -} - -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.6em 1.2em; - font-size: 1em; - font-weight: 500; - font-family: inherit; - background-color: #1a1a1a; - cursor: pointer; - transition: border-color 0.25s; -} -button:hover { - border-color: #646cff; -} -button:focus, -button:focus-visible { - outline: 4px auto -webkit-focus-ring-color; -} - -@media (prefers-color-scheme: light) { - :root { - color: #213547; - background-color: #ffffff; - } - a:hover { - color: #747bff; - } - button { - background-color: #f9f9f9; - } -} +#button-container button { + @apply mx-1; +} \ No newline at end of file diff --git a/frontend/tailwind.config.cjs b/frontend/tailwind.config.cjs new file mode 100644 index 0000000..e8ecc87 --- /dev/null +++ b/frontend/tailwind.config.cjs @@ -0,0 +1,12 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + darkMode: "class", + content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"], + theme: { + fontFamily: { + sans: ["Inter", "sans-serif"], + }, + extend: {}, + }, + plugins: [require("@tailwindcss/typography"), require("@tailwindcss/forms")], +}; diff --git a/frontend/vite.config.js b/frontend/vite.config.js index d54c977..3c471a7 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -6,7 +6,7 @@ export default defineConfig({ plugins: [react()], server: { proxy: { - "/": "http://localhost:8001", + "/api": "http://127.0.0.1:8001", }, }, }); diff --git a/tailwind.config.js b/tailwind.config.js deleted file mode 100644 index 8047bc1..0000000 --- a/tailwind.config.js +++ /dev/null @@ -1,19 +0,0 @@ -const defaultTheme = require('tailwindcss/defaultTheme') - -module.exports = { - darkMode: 'class', - content: ["./games/**/*.{html,js}"], - theme: { - extend: { - fontFamily: { - 'sans': ['IBM Plex Sans', ...defaultTheme.fontFamily.sans], - 'mono': ['IBM Plex Mono', ...defaultTheme.fontFamily.mono], - 'serif': ['IBM Plex Serif', ...defaultTheme.fontFamily.serif], - } - }, - }, - plugins: [ - require('@tailwindcss/typography'), - require('@tailwindcss/forms') - ], -} -- 2.40.1 From 0c564ef1466951ffd2201868c19eea41adc68614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Wed, 25 Jan 2023 12:56:32 +0100 Subject: [PATCH 07/38] Add Nav component --- frontend/package.json | 4 ++ frontend/src/App.jsx | 48 +++++++----------------- frontend/src/components/Nav.jsx | 66 +++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 35 deletions(-) create mode 100644 frontend/src/components/Nav.jsx diff --git a/frontend/package.json b/frontend/package.json index af93702..a99d4b3 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,7 +10,10 @@ }, "dependencies": { "autoprefixer": "^10.4.13", + "eslint-config-prettier": "^8.6.0", + "eslint-plugin-prettier": "^4.2.1", "postcss": "^8.4.21", + "prettier": "^2.8.3", "react": "^18.2.0", "react-dom": "^18.2.0", "tailwindcss": "^3.2.4" @@ -19,6 +22,7 @@ "@types/react": "^18.0.26", "@types/react-dom": "^18.0.9", "@vitejs/plugin-react": "^3.0.0", + "eslint": "^8.32.0", "vite": "^4.0.0" } } diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 0831da0..6abeeac 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1,42 +1,20 @@ -import { useState } from 'react' -import './App.css' +import { useState } from "react"; +import "./App.css"; +import Nav from "./components/Nav"; function App() { - const [count, setCount] = useState(0) + const [count, setCount] = useState(0); return ( <> -
- - {/* {% block content %}No content here.{% endblock content %} */} -
- {/* {% load version %} */} - {/* {% version %} ({% version_date %}) */} - - ) +
+
+ {/* {% load version %} */} + {/* {% version %} ({% version_date %}) */} + + ); } -export default App +export default App; diff --git a/frontend/src/components/Nav.jsx b/frontend/src/components/Nav.jsx new file mode 100644 index 0000000..90fc858 --- /dev/null +++ b/frontend/src/components/Nav.jsx @@ -0,0 +1,66 @@ +function Nav() { + return ( + + ); +} + +export default Nav -- 2.40.1 From b95d5dfb9806e954660c83f63cbbd357f448a750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Wed, 25 Jan 2023 13:07:45 +0100 Subject: [PATCH 08/38] Remove top-level package.json --- package.json | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 package.json diff --git a/package.json b/package.json deleted file mode 100644 index 6f4d295..0000000 --- a/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "devDependencies": { - "@tailwindcss/forms": "^0.5.6", - "@tailwindcss/typography": "^0.5.10", - "tailwindcss": "^3.3.3" - } -} -- 2.40.1 From 2e891fc1668dff84ab699c4333c5d8e3bd5828d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Wed, 25 Jan 2023 13:19:50 +0100 Subject: [PATCH 09/38] Remove cruft --- frontend/public/vite.svg | 1 - 1 file changed, 1 deletion(-) delete mode 100644 frontend/public/vite.svg diff --git a/frontend/public/vite.svg b/frontend/public/vite.svg deleted file mode 100644 index e7b8dfb..0000000 --- a/frontend/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file -- 2.40.1 From 81fbcc9281f652962aa46d8e54d64ee92cbde935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Wed, 25 Jan 2023 13:31:05 +0100 Subject: [PATCH 10/38] Add eslint and prettier --- frontend/.eslintrc.cjs | 17 +++++++++++++++++ frontend/.prettierrc | 9 +++++++++ frontend/package.json | 4 ++++ frontend/src/components/Nav.jsx | 7 +++++-- 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 frontend/.eslintrc.cjs create mode 100644 frontend/.prettierrc diff --git a/frontend/.eslintrc.cjs b/frontend/.eslintrc.cjs new file mode 100644 index 0000000..f1eb049 --- /dev/null +++ b/frontend/.eslintrc.cjs @@ -0,0 +1,17 @@ +module.exports = { + env: { + browser: true, + es2021: true + }, + extends: ["eslint/recommended", "plugin:react/recommended", "plugin:prettier/recommended"], + overrides: [], + parserOptions: { + ecmaVersion: "latest", + sourceType: "module" + }, + plugins: ["react"], + rules: {}, + parserOptions: { + ecmaFeatures: { jsx: true } + } +}; diff --git a/frontend/.prettierrc b/frontend/.prettierrc new file mode 100644 index 0000000..b518bea --- /dev/null +++ b/frontend/.prettierrc @@ -0,0 +1,9 @@ +{ + "semi": true, + "tabWidth": 2, + "printWidth": 100, + "singleQuote": true, + "trailingComma": "none", + "bracketSameLine": false, + "singleAttributePerLine": true +} \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index a99d4b3..2199022 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -23,6 +23,10 @@ "@types/react-dom": "^18.0.9", "@vitejs/plugin-react": "^3.0.0", "eslint": "^8.32.0", + "eslint-plugin-import": "^2.27.5", + "eslint-plugin-jsx-a11y": "^6.7.1", + "eslint-plugin-react": "^7.32.1", + "eslint-plugin-react-hooks": "^4.6.0", "vite": "^4.0.0" } } diff --git a/frontend/src/components/Nav.jsx b/frontend/src/components/Nav.jsx index 90fc858..b85921c 100644 --- a/frontend/src/components/Nav.jsx +++ b/frontend/src/components/Nav.jsx @@ -2,7 +2,10 @@ function Nav() { return (