main
Stepan Pilipenko 1 month ago
parent b782338c64
commit 7a6b9c446f

@ -1,7 +1,7 @@
services:
web:
build:
context: app
context: backend
target: dev-envs
ports:
- '8090:8090'

@ -6,8 +6,8 @@
"liveServer.settings.host": "localhost",
// "liveServer.settings.https": {
// "enable": true,
// "cert": "/Users/16716942/SOFTWARRIOR/TemaBot2/app/certs/localhost.crt",
// "key": "/Users/16716942/SOFTWARRIOR/TemaBot2/app/certs/localhost.key",
// "cert": "/Users/16716942/SOFTWARRIOR/TemaBot2/backend/certs/localhost.crt",
// "key": "/Users/16716942/SOFTWARRIOR/TemaBot2/backend/certs/localhost.key",
// "passphrase": ""
// }
}

@ -2,8 +2,8 @@ import json
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from app.api import api
from app.utils import decimal_to_float
from backend.api import api
from backend.utils import decimal_to_float
@csrf_exempt
async def shop(request):

@ -69,7 +69,7 @@ TEMPLATES = [
},
]
WSGI_APPLICATION = 'settings.wsgi.app'
WSGI_APPLICATION = 'settings.wsgi.backend'
# Database

@ -1,7 +1,7 @@
"""
WSGI config for vercel_app project.
It exposes the WSGI callable as a module-level variable named ``app``.
It exposes the WSGI callable as a module-level variable named ``backend``.
For more information on this file, see
https://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/

@ -1,6 +1,6 @@
import unittest
import psycopg2
from app.api import (
from backend.api import (
registration,
add_product_to_basket,
buy_products,
@ -11,8 +11,8 @@ from app.api import (
get_histories_with_products,
add_money # Импортируем напрямую
)
from app.api import add_product_to_shop, delete_product_from_shop
from app.consts import *
from backend.api import add_product_to_shop, delete_product_from_shop
from backend.consts import *
class TestFullUserFlow(unittest.TestCase):

@ -3,7 +3,7 @@ services:
platform: linux/arm64/v8
image: firstsoftwarrior/game_shop
build:
context: app
context: backend
target: builder
container_name: firstsoftwarrior-game_shop
ports:

@ -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?

@ -0,0 +1,3 @@
# Ignore artifacts:
build
coverage

@ -0,0 +1,9 @@
{
"semi": false,
"singleQuote": true,
"tabWidth": 4,
"trailingComma": "es5",
"printWidth": 100,
"bracketSpacing": true,
"arrowParens": "avoid"
}

@ -0,0 +1,73 @@
# 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...
},
},
])
```

@ -0,0 +1,26 @@
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'
import eslintConfigPrettier from 'eslint-config-prettier/flat'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs['recommended-latest'],
reactRefresh.configs.vite,
prettier,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
},
eslintConfigPrettier,
])

@ -0,0 +1,13 @@
<!doctype html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>UOFT Shop</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,46 @@
{
"name": "shop",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview",
"prepare": "husky",
"preter": "npx eslint-config-prettier"
},
"dependencies": {
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@fontsource/roboto": "^5.2.8",
"@mui/icons-material": "^7.3.4",
"@mui/material": "^7.3.4",
"@reduxjs/toolkit": "^2.9.2",
"react": "^19.1.1",
"react-dom": "^19.1.1"
},
"devDependencies": {
"@eslint/js": "^9.36.0",
"@types/node": "^24.6.0",
"@types/react": "^19.1.16",
"@types/react-dom": "^19.1.9",
"@vitejs/plugin-react": "^5.0.4",
"clsx": "^2.1.1",
"eslint": "^9.36.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.22",
"globals": "^16.4.0",
"husky": "^9.1.7",
"lint-staged": "^16.2.6",
"prettier": "3.6.2",
"typescript": "~5.9.3",
"typescript-eslint": "^8.45.0",
"vite": "^7.1.7"
},
"lint-staged": {
"**/*": "prettier --write --ignore-unknown"
}
}

@ -0,0 +1,9 @@
<svg width="36" height="36" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0,256) scale(0.1,-0.1)" fill="#873099" stroke="aqua">
<rect x="0" y="0" width="2560" height="2560" fill="white"/>
<path d="M0 1280 l0 -1280 1280 0 1280 0 0 1280 0 1280 -1280 0 -1280 0 0-1280z m1274 266 c87 -43 144 -122 167 -234 l13 -62 63 0 62 0 3 158 3 157 178 3 177 2 0 -40 0 -40 -135 0 -135 0 0 -120 0 -120 125 0 125 0 0 -40 0 -40 -125 0 -125 0 0 -156 0 -155 -42 3 -43 3 -3 158 -3 157 -63 0 -64 0 -7 -37 c-22 -120 -88 -213 -183 -260 -50 -25 -68 -28 -147 -27 -133 1 -209 41 -276 145 l-32 49 -78 0 -78 0 -12 -40 c-17 -58 -71 -115 -127 -137 -69 -26 -193-24 -249 5 -49 25 -95 78 -113 130 -9 25 -14 119 -17 300 l-5 262 45 0 46 0 3-257 c3-242 4-261 25-298 25-47 65-73 125-81 82-11 163 30 183 94 6 22 6 22 -100 22 l-106 0 3 33 3 32 108 3 108 3 -3 27 c-3 27 -3 27 -93 29 -49 1-98 2-107 2 -14 1 -18 10 -18 36 l0 35 110 0 110 0 0 160 0 160 45 0 45 0 0-160 0-160 64 0 63 0 6 49 c6 49 32 111 69 163 27 39 104 90 158 105 73 21 188 11 254 -21z m1216 -16 l0 -40 -100 0 -100 0 -2 -312 -3 -313 -40 0 -40 0 -3 313 -2 312 -100 0 -100 0 0 40 0 40 245 0 245 0 0 -40z"/>
<path d="M1012 1474 c-29 -14 -61 -39 -72 -54 -31 -43 -60 -112 -60 -142 l0-28 241 0 241 0 -7 43 c-10 60 -49 132 -87 160 -74 55 -173 63 -256 21z"/>
<path d="M667 1174 c-4 -4 -7 -18 -7 -31 0 -22 4 -23 66 -23 l65 0 -3 28 c-3 25 -6 27 -59 30 -30 1 -58 -1 -62 -4z"/>
<path d="M880 1150 l0 -30 135 0 135 0 0 -35 0 -35 -115 0 c-63 0 -115 -3-115 -6 0 -22 52 -71 98 -92 73 -33 161 -28 230 15 51 31 95 104 108 176 l6 37 -241 0 -241 0 0 -30z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

@ -0,0 +1,9 @@
import { Shop } from './pages'
export const App = () => {
return (
<>
<Shop />
</>
)
}

@ -0,0 +1,68 @@
:root {
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
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;
}
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.2rem;
line-height: 1.1;
}
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6rem 1.2rem;
font-size: 1rem;
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;
}
}

@ -0,0 +1,17 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import '@fontsource/roboto/300.css'
import '@fontsource/roboto/400.css'
import '@fontsource/roboto/500.css'
import '@fontsource/roboto/700.css'
import './index.css'
import { App } from './app.tsx'
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>
)

@ -0,0 +1 @@
export * from './shop'

@ -0,0 +1,3 @@
.shop {
color: red;
}

@ -0,0 +1,12 @@
import type { JSX } from 'react'
import styles from './shop.module.css'
import { Button } from '@mui/material'
export const Shop = (): JSX.Element => {
return (
<>
<span className={styles.shop}>{'Магазин'}</span>
<Button variant="contained">Contained</Button>
</>
)
}

@ -0,0 +1,28 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2022",
"useDefineForClassFields": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"module": "ESNext",
"types": ["vite/client"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["src"]
}

@ -0,0 +1,4 @@
{
"files": [],
"references": [{ "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" }]
}

@ -0,0 +1,26 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2023",
"lib": ["ES2023"],
"module": "ESNext",
"types": ["node"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
}

@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
})
Loading…
Cancel
Save