Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL=postgresql+psycopg2://postgres:postgres@localhost:5432/lms2
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.
Binary file added 5-lesson/celerybeat-schedule
Binary file not shown.
Empty file added 5-lesson/logs/email_worker.log
Empty file.
130 changes: 130 additions & 0 deletions 6-lesson/10/fetch.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<title>Магазин — список товаров</title>
<style>
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
sans-serif;
max-width: 600px;
margin: 40px auto;
}

h1 {
margin-bottom: 16px;
}

#view {
border: 1px solid #e5e7eb;
padding: 16px;
border-radius: 8px;
min-height: 120px;
}

ul {
padding-left: 18px;
}

li {
margin-bottom: 4px;
}

nav a {
margin-right: 12px;
cursor: pointer;
text-decoration: underline;
}
</style>
</head>
<body>
<h1>Магазин</h1>

<nav>
<a id="link-products">Товары</a>
<a id="link-cart">Корзина</a>
</nav>

<div id="view">
Загрузка...
</div>

<script>
async function showProducts() {
const view = document.getElementById("view");
view.textContent = "Загрузка товаров...";

const response = await fetch("/api/products");
const products = await response.json();

const list = document.createElement("ul");

products.forEach((product) => {
const li = document.createElement("li");
li.textContent = product.name + " — " + product.price + " ₽";
list.appendChild(li);
});

view.innerHTML = "";
view.appendChild(list);
}

async function showCart() {
const view = document.getElementById("view");
view.textContent = "Загрузка корзины...";


const response = await fetch("/api/cart");
const cart = await response.json();

const list = document.createElement("ul");

if (cart.items.length === 0) {
view.textContent = "В корзине пока пусто.";
return;
}

cart.items.forEach((item) => {
const li = document.createElement("li");
li.textContent =
item.name + " — " + item.price + " ₽ × " + item.quantity;
list.appendChild(li);
});

view.innerHTML = "";
view.appendChild(list);
}

document
.getElementById("link-products")
.addEventListener("click", (event) => {
event.preventDefault();
showProducts();
});

document.getElementById("link-cart").addEventListener("click", (event) => {
event.preventDefault();
showCart();
});

showProducts();
</script>
</body>
</html>

<!--

GET /api/products
[
{ "name": "Ноутбук", "price": 50000 },
{ "name": "Мышка", "price": 1500 },
{ "name": "Клавиатура","price": 3000 }
]

GET /api/cart
{
"items": [
{ "name": "Ноутбук", "price": 50000, "quantity": 1 }
]
}
-->
42 changes: 42 additions & 0 deletions 6-lesson/10/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<title>Магазин — список товаров</title>
<style>
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
sans-serif;
max-width: 600px;
margin: 40px auto;
}

h1 {
margin-bottom: 16px;
}

ul {
padding-left: 18px;
}

li {
margin-bottom: 4px;
}

a {
display: inline-block;
margin-top: 16px;
}
</style>
</head>
<body>
<h1>Товары</h1>
<ul>
<li>Ноутбук — 50 000 ₽</li>
<li>Мышка — 1 500 ₽</li>
<li>Клавиатура — 3 000 ₽</li>
</ul>

<a href="/cart.html">Перейти в корзину</a>
</body>
</html>
24 changes: 24 additions & 0 deletions 6-lesson/23/demo-01/.gitignore
Original file line number Diff line number Diff line change
@@ -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?
16 changes: 16 additions & 0 deletions 6-lesson/23/demo-01/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# React + 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 using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
29 changes: 29 additions & 0 deletions 6-lesson/23/demo-01/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import { defineConfig, globalIgnores } from 'eslint/config'

export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{js,jsx}'],
extends: [
js.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
rules: {
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
},
},
])
12 changes: 12 additions & 0 deletions 6-lesson/23/demo-01/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>demo-01</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="src/main.jsx"></script>
</body>
</html>
Loading