diff --git a/package.json b/package.json index 37fd0ed..677ec84 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "telegram-invite-automation", - "version": "1.0.0", + "version": "1.1.0", "private": true, "description": "Automated user parsing and invites for Telegram groups", "main": "src/main/index.js", diff --git a/src/renderer/App.jsx b/src/renderer/App.jsx index fde83c1..2aa4947 100644 --- a/src/renderer/App.jsx +++ b/src/renderer/App.jsx @@ -2454,8 +2454,15 @@ export default function App() { setTaskForm({ ...taskForm, dailyLimit: Number(event.target.value) })} + value={taskForm.dailyLimit === "" ? "" : taskForm.dailyLimit} + onChange={(event) => { + const value = event.target.value; + setTaskForm({ ...taskForm, dailyLimit: value === "" ? "" : Number(value) }); + }} + onBlur={() => { + const value = Number(taskForm.dailyLimit); + setTaskForm({ ...taskForm, dailyLimit: Number.isFinite(value) && value > 0 ? value : 1 }); + }} /> @@ -2491,8 +2512,15 @@ export default function App() { setTaskForm({ ...taskForm, warmupDailyIncrease: Number(event.target.value) })} + value={taskForm.warmupDailyIncrease === "" ? "" : taskForm.warmupDailyIncrease} + onChange={(event) => { + const value = event.target.value; + setTaskForm({ ...taskForm, warmupDailyIncrease: value === "" ? "" : Number(value) }); + }} + onBlur={() => { + const value = Number(taskForm.warmupDailyIncrease); + setTaskForm({ ...taskForm, warmupDailyIncrease: Number.isFinite(value) && value >= 0 ? value : 0 }); + }} disabled={!taskForm.warmupEnabled} /> @@ -2574,12 +2602,22 @@ export default function App() { { - const nextValue = Number(event.target.value); + const value = event.target.value; + if (value === "") { + setTaskForm({ ...taskForm, maxCompetitorBots: "", maxOurBots: "" }); + return; + } + const nextValue = Number(value); const nextForm = { ...taskForm, maxCompetitorBots: nextValue, maxOurBots: nextValue }; setTaskForm(sanitizeTaskForm(nextForm)); }} + onBlur={() => { + const value = Number(taskForm.maxCompetitorBots); + const normalized = Number.isFinite(value) && value > 0 ? value : 1; + setTaskForm(sanitizeTaskForm({ ...taskForm, maxCompetitorBots: normalized, maxOurBots: normalized })); + }} /> Одинаковое количество для конкурентов и нашей группы. @@ -2590,11 +2628,17 @@ export default function App() { { - const nextValue = Number(event.target.value); - const nextForm = { ...taskForm, maxCompetitorBots: nextValue }; - setTaskForm(nextForm); + const value = event.target.value; + setTaskForm({ + ...taskForm, + maxCompetitorBots: value === "" ? "" : Number(value) + }); + }} + onBlur={() => { + const value = Number(taskForm.maxCompetitorBots); + setTaskForm({ ...taskForm, maxCompetitorBots: Number.isFinite(value) && value > 0 ? value : 1 }); }} /> Используется для авто-вступления в группы конкурентов. @@ -2604,8 +2648,15 @@ export default function App() { setTaskForm({ ...taskForm, maxOurBots: Number(event.target.value) })} + value={taskForm.maxOurBots === "" ? "" : taskForm.maxOurBots} + onChange={(event) => { + const value = event.target.value; + setTaskForm({ ...taskForm, maxOurBots: value === "" ? "" : Number(value) }); + }} + onBlur={() => { + const value = Number(taskForm.maxOurBots); + setTaskForm({ ...taskForm, maxOurBots: Number.isFinite(value) && value > 0 ? value : 1 }); + }} /> {roleMode === "split" ? "Ограничивает аккаунты, которые будут приглашать." : "Ограничивает количество инвайтящих аккаунтов."} @@ -2686,8 +2737,15 @@ export default function App() { setTaskForm({ ...taskForm, stopBlockedPercent: Number(event.target.value) })} + value={taskForm.stopBlockedPercent === "" ? "" : taskForm.stopBlockedPercent} + onChange={(event) => { + const value = event.target.value; + setTaskForm({ ...taskForm, stopBlockedPercent: value === "" ? "" : Number(value) }); + }} + onBlur={() => { + const value = Number(taskForm.stopBlockedPercent); + setTaskForm({ ...taskForm, stopBlockedPercent: Number.isFinite(value) && value > 0 ? value : 1 }); + }} disabled={!taskForm.stopOnBlocked} /> diff --git a/src/renderer/styles/app.css b/src/renderer/styles/app.css index fef5c1e..69b8347 100644 --- a/src/renderer/styles/app.css +++ b/src/renderer/styles/app.css @@ -480,37 +480,37 @@ body { } .action-bar { - padding: 14px; - gap: 10px; + padding: 8px 10px; + gap: 6px; } .action-bar h2 { - font-size: 16px; + font-size: 14px; } .action-bar .status-caption { - font-size: 11px; + font-size: 10px; } .action-bar .status-pill { - font-size: 11px; - padding: 4px 10px; + font-size: 10px; + padding: 3px 8px; } .action-buttons .cta { margin-left: auto; - padding: 6px 12px; + padding: 4px 8px; border-radius: 999px; font-weight: 600; } .action-buttons .cta + .cta { - margin-left: 10px; + margin-left: 8px; } .action-buttons button { - padding: 6px 10px; - font-size: 12px; + padding: 4px 8px; + font-size: 11px; } .status-pill { diff --git a/src/renderer/tabs/SettingsTab.jsx b/src/renderer/tabs/SettingsTab.jsx index 1cd8acb..512c228 100644 --- a/src/renderer/tabs/SettingsTab.jsx +++ b/src/renderer/tabs/SettingsTab.jsx @@ -10,8 +10,15 @@ function SettingsTab({ settings, onSettingsChange, saveSettings }) { onSettingsChange("accountMaxGroups", Number(event.target.value))} + value={settings.accountMaxGroups === "" ? "" : settings.accountMaxGroups} + onChange={(event) => { + const value = event.target.value; + onSettingsChange("accountMaxGroups", value === "" ? "" : Number(value)); + }} + onBlur={() => { + const value = Number(settings.accountMaxGroups); + onSettingsChange("accountMaxGroups", Number.isFinite(value) && value > 0 ? value : 1); + }} />