This commit is contained in:
2026-09-03 13:08:01 +03:00
parent d5783423d6
commit 946c1beabf
41 changed files with 3558 additions and 103 deletions
+54
View File
@@ -0,0 +1,54 @@
#logo {
display: block;
width: 50%;
height: 50%;
margin: auto;
padding: 10% 0 0;
background-position: center;
background-repeat: no-repeat;
background-size: 100% 100%;
background-origin: content-box;
}
.result {
height: 20px;
line-height: 20px;
margin: 1.5rem auto;
}
.input-box .btn {
width: 60px;
height: 30px;
line-height: 30px;
border-radius: 3px;
border: none;
margin: 0 0 0 20px;
padding: 0 8px;
cursor: pointer;
}
.input-box .btn:hover {
background-image: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%);
color: #333333;
}
.input-box .input {
border: none;
border-radius: 3px;
outline: none;
height: 30px;
line-height: 30px;
padding: 0 10px;
background-color: rgba(240, 240, 240, 1);
-webkit-font-smoothing: antialiased;
}
.input-box .input:hover {
border: none;
background-color: rgba(255, 255, 255, 1);
}
.input-box .input:focus {
border: none;
background-color: rgba(255, 255, 255, 1);
}
@@ -0,0 +1,93 @@
Copyright 2016 The Nunito Project Authors (contact@sansoxygen.com),
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

+189
View File
@@ -0,0 +1,189 @@
import {
CheckConnection,
SetFrequency,
Quit,
} from "../wailsjs/go/main/App";
// импорт через ES-модуль, а не строкой-путём — иначе vite не подставит
// правильный хэшированный путь в собранном билде (сломается в проде)
import logoDarkUrl from "./assets/images/logo-dark.jpg";
(function() {
// === Тема (тёмная/светлая) ===
const themeToggle = document.getElementById('theme-toggle');
themeToggle.addEventListener('click', () => {
const cur = document.body.getAttribute('data-theme');
const next = cur === 'light' ? 'dark' : 'light';
document.body.setAttribute('data-theme', next);
themeToggle.textContent = next === 'light' ? '☾' : '☀';
});
// === Интро при запуске (лого "двери" разъезжаются) ===
const NATURAL_W = 640, NATURAL_H = 480;
const AXIS_X = 312; // ось раздела — середина носа черепа / верхнего зубца шестерни
const LOGO_DARK_URL = logoDarkUrl;
const introOverlay = document.getElementById('intro-overlay');
const doorLeft = document.querySelector('#intro-overlay .door-left');
const doorRight = document.querySelector('#intro-overlay .door-right');
function layoutDoors() {
const W = window.innerWidth;
const H = window.innerHeight;
const scale = Math.max(W / NATURAL_W, H / NATURAL_H); // object-fit: cover на весь размер окна
const renderW = NATURAL_W * scale;
const renderH = NATURAL_H * scale;
const offsetX = (W - renderW) / 2;
const offsetY = (H - renderH) / 2;
const axisDisplayX = offsetX + AXIS_X * scale;
const leftW = Math.max(0, Math.min(W, axisDisplayX));
const rightW = W - leftW;
doorLeft.style.width = leftW + 'px';
doorLeft.style.backgroundImage = `url(${LOGO_DARK_URL})`;
doorLeft.style.backgroundSize = renderW + 'px ' + renderH + 'px';
doorLeft.style.backgroundPosition = offsetX + 'px ' + offsetY + 'px';
doorRight.style.left = leftW + 'px';
doorRight.style.width = rightW + 'px';
doorRight.style.backgroundImage = `url(${LOGO_DARK_URL})`;
doorRight.style.backgroundSize = renderW + 'px ' + renderH + 'px';
doorRight.style.backgroundPosition = (offsetX - leftW) + 'px ' + offsetY + 'px';
}
const OPEN_AT = 2100; // момент начала разъезда дверей от старта интро, мс
const APPEAR_START = 100;
const APPEAR_DUR = 450;
function playIntro() {
introOverlay.style.display = '';
introOverlay.classList.remove('appear', 'open');
void introOverlay.offsetWidth; // reflow reset
layoutDoors();
setTimeout(() => introOverlay.classList.add('appear'), APPEAR_START);
setTimeout(() => introOverlay.classList.add('open'), OPEN_AT);
// прячем оверлей из потока/кликов после того как двери разъехались и погасли
setTimeout(() => { introOverlay.style.display = 'none'; }, OPEN_AT + 1170);
}
window.addEventListener('resize', layoutDoors);
playIntro(); // main.js подключён как type="module" — DOM уже готов на этот момент
// === Переключение вкладок ===
const tabButtons = document.querySelectorAll('.tab-button');
const tabContents = document.querySelectorAll('.tab-content');
tabButtons.forEach(button => {
button.addEventListener('click', () => {
tabButtons.forEach(btn => btn.classList.remove('active'));
tabContents.forEach(content => content.classList.remove('active'));
button.classList.add('active');
const tabId = button.getAttribute('data-tab');
document.getElementById(`tab-${tabId}`).classList.add('active');
});
});
// === Элементы интерфейса ===
const btnCheck = document.getElementById('btn-check');
const btnFreq = document.getElementById('btn-freq');
const btnQuit = document.getElementById('btn-quit');
const statusIndicator = document.getElementById('status-indicator');
const statusText = document.getElementById('status-text');
const freqLabel = document.getElementById('frequency-label');
const freqValue = document.getElementById('frequency-value');
// Модальное окно
const modal = document.getElementById('freq-modal');
const closeModal = document.getElementById('close-modal');
const freqInput = document.getElementById('freq-input');
const btnMinus = document.getElementById('btn-minus');
const btnPlus = document.getElementById('btn-plus');
const btnSetFreq = document.getElementById('btn-set-freq');
const modalError = document.getElementById('modal-error');
// === Проверка подключения ===
btnCheck.addEventListener('click', () => {
CheckConnection()
.then((response) => {
// Обновление индикатора соединения
statusIndicator.classList.remove('indicator-red');
statusIndicator.classList.add('indicator-green');
statusText.textContent = `Соединение установлено! ${response.status}`;
// Обновление панели частоты (текущая)
freqLabel.textContent = 'Текущая частота:';
freqValue.textContent = response.frequency;
})
.catch((err) => {
console.error('Ошибка CheckConnection:', err);
statusText.textContent = 'Ошибка: не удалось выполнить проверку';
});
});
// === Установка частоты (открытие модального окна) ===
btnFreq.addEventListener('click', () => {
modal.classList.remove('hidden');
// Показываем текущую частоту из панели (или 145)
const current = freqValue.textContent !== '---' ? freqValue.textContent : '145';
freqInput.value = current;
modalError.classList.add('hidden');
});
// Закрытие модального окна
closeModal.addEventListener('click', () => {
modal.classList.add('hidden');
});
window.addEventListener('click', (e) => {
if (e.target === modal) {
modal.classList.add('hidden');
}
});
// Кнопки +/- для изменения значения на 1
btnMinus.addEventListener('click', () => {
let val = parseInt(freqInput.value, 10) || 1;
val = Math.max(1, val - 1); // минимум 1
freqInput.value = val.toString();
});
btnPlus.addEventListener('click', () => {
let val = parseInt(freqInput.value, 10) || 1;
val += 1;
freqInput.value = val.toString();
});
// Кнопка "Установить"
btnSetFreq.addEventListener('click', () => {
const inputVal = freqInput.value.trim();
// Проверка: только цифры
if (!/^\d+$/.test(inputVal)) {
modalError.textContent = 'Вводимое значение должно быть целым положительным числом';
modalError.classList.remove('hidden');
return;
}
const num = parseInt(inputVal, 10);
if (num <= 0) {
modalError.textContent = 'Вводимое значение должно быть целым положительным числом';
modalError.classList.remove('hidden');
return;
}
SetFrequency(inputVal)
.then((newFreq) => {
// Обновляем панель частоты
freqLabel.textContent = 'Установленная частота:';
freqValue.textContent = newFreq;
modal.classList.add('hidden');
})
.catch((err) => {
modalError.textContent = err;
modalError.classList.remove('hidden');
});
});
// === Закрыть приложение ===
btnQuit.addEventListener('click', () => {
Quit();
});
})();
+343
View File
@@ -0,0 +1,343 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
font-family: Arial, sans-serif;
overflow: hidden;
}
/* ===================== ТЕМА (тёмная/светлая) ===================== */
body {
background: radial-gradient(circle at 50% 18%, #1a1d24 0%, #0d0f13 70%);
transition: background 0.3s ease;
}
body[data-theme="light"] {
background: radial-gradient(circle at 50% 18%, #ffffff 0%, #dde1e7 70%);
}
#theme-toggle {
position: fixed;
top: 16px; right: 18px;
z-index: 500;
width: 34px; height: 34px;
border-radius: 50%;
border: 1px solid #333a46;
background: #222a37;
color: #ccc;
cursor: pointer;
font-size: 14px;
display: flex; align-items: center; justify-content: center;
}
body[data-theme="light"] #theme-toggle {
border-color: #c7cbd1;
background: #ffffff;
color: #555;
}
/* ===================== КАРТОЧКА ПРИЛОЖЕНИЯ ===================== */
#app {
width: 360px;
border-radius: 14px;
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
overflow: hidden;
background: #1b1e24;
transition: background 0.3s ease;
}
body[data-theme="light"] #app {
background: #ffffff;
}
/* ---- бренд-блок ---- */
#brand {
display: flex; flex-direction: column; align-items: center;
padding: 26px 24px 16px;
gap: 6px;
}
.logo-icon {
position: relative;
width: 64px; height: 48px; /* пропорции 640:480 исходного лого */
margin-bottom: 6px;
}
.logo-icon img {
position: absolute; inset: 0;
width: 100%; height: 100%;
object-fit: contain;
}
.logo-icon .logo-dark { mix-blend-mode: screen; display: block; }
.logo-icon .logo-light { mix-blend-mode: multiply; display: none; }
body[data-theme="light"] .logo-icon .logo-dark { display: none; }
body[data-theme="light"] .logo-icon .logo-light { display: block; }
#brand h1 {
color: #eeeeee;
font-size: 21px;
letter-spacing: 3.5px;
font-weight: 700;
}
#brand .tag {
color: #7a7f89;
font-size: 11px;
letter-spacing: 1.2px;
}
body[data-theme="light"] #brand h1 { color: #1b1d22; }
body[data-theme="light"] #brand .tag { color: #888d97; }
/* Панель вкладок (пока скрыта атрибутом hidden в HTML) */
.tabs {
display: flex;
background: transparent;
}
.tabs[hidden] {
display: none; /* без этого .tabs{display:flex} выше перебивает атрибут hidden */
}
.tab-button {
flex: 1;
padding: 12px;
background: transparent;
border: none;
cursor: pointer;
font-size: 14px;
color: #9aa0aa;
transition: background 0.2s;
}
.tab-button:hover { background: rgba(255,255,255,0.05); }
.tab-button.active {
color: #eee;
border-bottom: 2px solid #b8362a;
font-weight: bold;
}
body[data-theme="light"] .tab-button { color: #7a7f89; }
body[data-theme="light"] .tab-button.active { color: #1b1d22; }
/* Содержимое вкладок */
.tab-content { display: none; padding: 4px 22px 24px; }
.tab-content.active { display: block; }
/* Вертикально расположенные кнопки */
.buttons-vertical {
display: flex;
flex-direction: column;
gap: 10px;
margin-bottom: 12px;
}
.action-button {
padding: 11px;
font-size: 14px;
cursor: pointer;
border: 1px solid #2a2d34;
border-radius: 8px;
background-color: #15171c;
color: #e8e8e8;
transition: background-color 0.2s, border-color 0.2s;
}
.action-button:hover {
background-color: #1d2027;
border-color: #3a3e46;
}
body[data-theme="light"] .action-button {
background-color: #ffffff;
border-color: #ccd1d9;
color: #22242a;
}
body[data-theme="light"] .action-button:hover {
background-color: #f0f2f5;
border-color: #aeb4bd;
}
.close-button {
background-color: #b8362a;
color: white;
border-color: #8f2a20;
}
.close-button:hover { background-color: #c73f31; }
body[data-theme="light"] .close-button {
background-color: #e74c3c;
border-color: #c0392b;
color: #fff;
}
body[data-theme="light"] .close-button:hover { background-color: #d8432f; }
/* Панель частоты */
#frequency-panel {
display: flex;
justify-content: space-between;
align-items: center;
padding: 9px 13px;
background-color: #15171c;
border: 1px solid #2a2d34;
border-radius: 8px;
margin-bottom: 9px;
}
#frequency-label { font-weight: bold; color: #9aa0aa; font-size: 13px; }
#frequency-value { font-size: 17px; color: #f2f2f2; }
body[data-theme="light"] #frequency-panel { background-color: #ffffff; border-color: #ccd1d9; }
body[data-theme="light"] #frequency-label { color: #7a7f89; }
body[data-theme="light"] #frequency-value { color: #1b1d22; }
/* Панель статуса */
#status-panel {
display: flex;
align-items: center;
gap: 9px;
padding: 9px 13px;
background-color: #15171c;
border: 1px solid #2a2d34;
border-radius: 8px;
}
body[data-theme="light"] #status-panel { background-color: #ffffff; border-color: #ccd1d9; }
.indicator {
width: 14px;
height: 14px;
border-radius: 50%;
display: inline-block;
}
.indicator-red { background-color: #e74c3c; }
.indicator-green { background-color: #2ecc71; }
#status-text { font-size: 14px; color: #ddd; }
body[data-theme="light"] #status-text { color: #333; }
/* ===================== ИНТРО (двери) ===================== */
#intro-overlay {
position: fixed;
inset: 0;
z-index: 1000;
background: #000; /* подстраховка: перекрывает всё, даже пока JS ещё не выставил размеры дверей */
transform: scale(1.04);
}
#intro-overlay.appear {
animation: introPop 0.45s cubic-bezier(.2,.9,.3,1) forwards;
}
@keyframes introPop { to { transform: scale(1); } }
.door {
position: absolute;
top: 0; bottom: 0;
overflow: hidden;
background-color: #000;
background-repeat: no-repeat;
transition: transform 1.17s cubic-bezier(.65,0,.35,1);
}
.door-left { left: 0; }
.door-right { left: 0; } /* left/width выставляются из JS под реальный размер окна */
#intro-overlay.open .door-left { transform: translateX(-100%); }
#intro-overlay.open .door-right { transform: translateX(100%); }
#intro-overlay.open {
transition: opacity 0.45s ease 0.65s;
opacity: 0;
pointer-events: none;
}
/* Модальное окно */
.modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 100;
}
.modal.hidden {
display: none;
}
.modal-content {
background: #1b1e24;
padding: 20px;
border-radius: 8px;
width: 300px;
box-shadow: 0 5px 15px rgba(0,0,0,0.4);
position: relative;
color: #eee;
}
body[data-theme="light"] .modal-content {
background: #ffffff;
color: #222;
}
.close-modal {
position: absolute;
top: 10px;
right: 15px;
font-size: 22px;
cursor: pointer;
color: #999;
}
.close-modal:hover { color: #eee; }
body[data-theme="light"] .close-modal { color: #777; }
body[data-theme="light"] .close-modal:hover { color: #333; }
.modal-content h3 {
margin-bottom: 15px;
text-align: center;
}
.freq-input-group {
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
margin-bottom: 15px;
}
.freq-btn {
width: 40px;
height: 40px;
font-size: 20px;
background: #b8362a;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background 0.2s;
}
.freq-btn:hover { background: #c73f31; }
#freq-input {
width: 100px;
padding: 8px;
font-size: 18px;
text-align: center;
border: 1px solid #444;
border-radius: 4px;
background: #15171c;
color: #eee;
}
body[data-theme="light"] #freq-input {
border-color: #ccc;
background: #fff;
color: #222;
}
#btn-set-freq {
display: block;
width: 100%;
margin-top: 10px;
}
.error-msg {
color: #e74c3c;
margin-top: 8px;
text-align: center;
font-size: 14px;
}
.error-msg.hidden {
display: none;
}