diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ceeabba --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Ксения Судакова + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 1e7514a..1710d8d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,14 @@ # Phone Store — Интернет-магазин мобильных телефонов -Полноценное web-приложение на Flask + SQLite для лабораторной работы. +Демонстрационное web-приложение на Flask + SQLite. + +> **Важно! Демонстрационный проект.** +> Приложение создано исключительно в учебных и демонстрационных целях. +> Представленные товары, названия моделей, описания, изображения, +> характеристики и цены являются условными демонстрационными данными. +> Они не являются реальными предложениями о продаже, не связаны +> с действующими магазинами и не отражают актуальные рыночные цены. +> Оформление заказа носит исключительно демонстрационный характер. ## Возможности @@ -82,4 +90,12 @@ phone_store/ ## Автор -Учебный проект (лабораторная работа) +**Ксения Судакова** + +## Лицензия + +Проект распространяется на условиях лицензии [MIT](LICENSE). + +Разрешается свободно использовать, копировать, изменять и распространять +проект, в том числе в коммерческих целях, при сохранении уведомления +об авторских правах и текста лицензии. diff --git a/static/css/style.css b/static/css/style.css index e8522ef..b2fe74c 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -912,3 +912,91 @@ body { grid-template-columns: 1fr; } } + + +/* ===== Light and dark themes ===== */ +.theme-toggle { + width: 40px; + height: 40px; + display: inline-flex; + align-items: center; + justify-content: center; + flex-shrink: 0; + border: 1px solid var(--border); + border-radius: 50%; + background: var(--card-bg); + color: var(--text); + font-size: 22px; + cursor: pointer; + transition: background var(--transition), color var(--transition), + border-color var(--transition), transform var(--transition); +} + +.theme-toggle:hover { + border-color: var(--accent); + color: var(--accent); + transform: rotate(12deg); +} + +:root[data-theme="dark"] { + color-scheme: dark; + --primary: #172b45; + --primary-dark: #0f1f33; + --accent: #60a5fa; + --accent-hover: #3b82f6; + --bg: #111827; + --card-bg: #1f2937; + --text: #e5e7eb; + --text-muted: #9ca3af; + --border: #374151; + --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.25), + 0 2px 4px -2px rgba(0, 0, 0, 0.2); + --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), + 0 4px 6px -4px rgba(0, 0, 0, 0.25); +} + +:root[data-theme="dark"] .filter-select, +:root[data-theme="dark"] .qty-btn, +:root[data-theme="dark"] .search-input, +:root[data-theme="dark"] .form-group input, +:root[data-theme="dark"] .form-group textarea { + background: #111827; + color: var(--text); + border-color: var(--border); +} + +:root[data-theme="dark"] .product-image-link, +:root[data-theme="dark"] .product-detail-image, +:root[data-theme="dark"] .cart-item-image { + background: #273449; +} + +:root[data-theme="dark"] .product-price, +:root[data-theme="dark"] .product-price-large, +:root[data-theme="dark"] .total-price { + color: #93c5fd; +} + +:root[data-theme="dark"] .flash-success { + background: #123528; + color: #a7f3d0; + border-color: #166534; +} + +:root[data-theme="dark"] .flash-error { + background: #3b1d24; + color: #fecaca; + border-color: #7f1d1d; +} + +:root[data-theme="dark"] .flash-info { + background: #172d4a; + color: #bfdbfe; + border-color: #1e40af; +} + +@media (prefers-reduced-motion: reduce) { + .theme-toggle { + transition: none; + } +} diff --git a/static/js/script.js b/static/js/script.js index aacf9c4..b4126d5 100644 --- a/static/js/script.js +++ b/static/js/script.js @@ -4,6 +4,42 @@ */ document.addEventListener('DOMContentLoaded', function () { + // Переключение светлой и тёмной темы + const themeToggle = document.getElementById('theme-toggle'); + const themeIcon = themeToggle?.querySelector('.theme-icon'); + + function applyTheme(theme) { + document.documentElement.dataset.theme = theme; + + if (themeIcon) { + themeIcon.textContent = theme === 'dark' ? '☀' : '☾'; + } + + if (themeToggle) { + const label = theme === 'dark' + ? 'Переключить на светлую тему' + : 'Переключить на тёмную тему'; + + themeToggle.setAttribute('aria-label', label); + themeToggle.setAttribute('title', label); + } + } + + applyTheme(document.documentElement.dataset.theme || 'light'); + + themeToggle?.addEventListener('click', function () { + const nextTheme = + document.documentElement.dataset.theme === 'dark' ? 'light' : 'dark'; + + applyTheme(nextTheme); + + try { + localStorage.setItem('phone-store-theme', nextTheme); + } catch (error) { + // Тема останется активной до перезагрузки страницы. + } + }); + // Автоматическое скрытие flash-сообщений через 4 секунды const flashes = document.querySelectorAll('.flash'); flashes.forEach(function (flash) { diff --git a/templates/base.html b/templates/base.html index bb0ad54..a03ea0d 100644 --- a/templates/base.html +++ b/templates/base.html @@ -4,6 +4,18 @@