Redesign settings page with sectioned layout, side navigation and choice cards

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
TomandClaude Opus 5.5 committed 2026-11-15 19:21:41 +01:00
1 parent 6b9bf3cd5f
commit de22f035dc
11 files changed
+934 -294

No files matched your search

@@ -9,80 +9,83 @@
@inject RuntimeSettingsStore Store
@inject NavigationManager Navigation
<section class="card form" id="hold-method">
<header class="section-head">
<h2>Haltemethode</h2>
@if (_hasOverrides)
{
<span class="badge">Überschrieben</span>
}
</header>
<SettingsSection Id="hold-method" Title="Haltemethode" Description="Womit Flypaper gefangene Bots beschäftigt und wie langsam es antwortet. Änderungen gelten ab dem nächsten Fang." Badge="@(_hasOverrides ? "Angepasst" : null)">
@if (Saved == "saved")
{
<div class="banner ok">Gespeichert. Gilt ab dem nächsten Fang.</div>
<Notice>Gespeichert. Gilt ab dem nächsten Fang.</Notice>
}
else if (Saved == "reset")
{
<div class="banner ok">Haltemethode auf Standard zurückgesetzt.</div>
<Notice>Haltemethode auf Standard zurückgesetzt.</Notice>
}
<EditForm Model="Model" FormName="hold-method" OnSubmit="SaveAsync" action="/settings" class="form">
<label for="drip-content">Inhalt</label>
<InputSelect id="drip-content" @bind-Value="Model!.Content">
<option value="@DripContent.Html">HTML-Fülltext</option>
<option value="@DripContent.Text">Zufallstext (plain text)</option>
<option value="@DripContent.Alternating">Wechselnd (pro Fang zufällig)</option>
</InputSelect>
<FieldError Errors="_errors" Field="@nameof(HoldMethodModel.Content)" />
<EditForm Model="Model" FormName="hold-method" OnSubmit="SaveAsync" action="/settings#hold-method" id="hold-method-form">
<div class="s-body">
<fieldset class="choices">
<legend>Inhalt</legend>
<InputRadioGroup @bind-Value="Model!.Content">
<div class="choice-grid">
@foreach (var choice in Choices)
{
<label class="choice">
<InputRadio Value="@choice.Value" />
<span class="choice-body">
<strong>@choice.Title</strong>
<span>@choice.Text</span>
</span>
</label>
}
</div>
</InputRadioGroup>
@if (_errors.TryGetValue(nameof(HoldMethodModel.Content), out var contentError))
{
<p class="field-error">@contentError</p>
}
</fieldset>
<div class="grid">
<div>
<label for="drip-min-delay">Pause min. <span class="muted">(ms)</span></label>
<InputText id="drip-min-delay" @bind-Value="Model!.MinDelayMs" class="mono" inputmode="numeric" data-bandwidth-input />
<FieldError Errors="_errors" Field="@nameof(HoldMethodModel.MinDelayMs)" />
<div class="fields">
<SettingsField Label="Pause min." For="drip-min-delay" Unit="ms" Hint="10 bis 30000" Errors="_errors" Key="@nameof(HoldMethodModel.MinDelayMs)">
<InputText id="drip-min-delay" @bind-Value="Model!.MinDelayMs" inputmode="numeric" data-bandwidth-input />
</SettingsField>
<SettingsField Label="Pause max." For="drip-max-delay" Unit="ms" Hint="Zufällig zwischen min. und max." Errors="_errors" Key="@nameof(HoldMethodModel.MaxDelayMs)">
<InputText id="drip-max-delay" @bind-Value="Model!.MaxDelayMs" inputmode="numeric" data-bandwidth-input />
</SettingsField>
<SettingsField Label="Paket min." For="drip-min-chunk" Unit="Bytes" Hint="1 bis 4096" Errors="_errors" Key="@nameof(HoldMethodModel.MinChunkSize)">
<InputText id="drip-min-chunk" @bind-Value="Model!.MinChunkSize" inputmode="numeric" data-bandwidth-input />
</SettingsField>
<SettingsField Label="Paket max." For="drip-max-chunk" Unit="Bytes" Hint="Zufällig zwischen min. und max." Errors="_errors" Key="@nameof(HoldMethodModel.MaxChunkSize)">
<InputText id="drip-max-chunk" @bind-Value="Model!.MaxChunkSize" inputmode="numeric" data-bandwidth-input />
</SettingsField>
<SettingsField Label="Maximale Haltedauer" For="hold" Hint="hh:mm:ss, höchstens 7 Tage" Errors="_errors" Key="@nameof(HoldMethodModel.MaxHoldDuration)">
<InputText id="hold" @bind-Value="Model!.MaxHoldDuration" />
</SettingsField>
</div>
<div>
<label for="drip-max-delay">Pause max. <span class="muted">(ms)</span></label>
<InputText id="drip-max-delay" @bind-Value="Model!.MaxDelayMs" class="mono" inputmode="numeric" data-bandwidth-input />
<FieldError Errors="_errors" Field="@nameof(HoldMethodModel.MaxDelayMs)" />
</div>
<div>
<label for="drip-min-chunk">Paket min. <span class="muted">(Bytes)</span></label>
<InputText id="drip-min-chunk" @bind-Value="Model!.MinChunkSize" class="mono" inputmode="numeric" data-bandwidth-input />
<FieldError Errors="_errors" Field="@nameof(HoldMethodModel.MinChunkSize)" />
</div>
<div>
<label for="drip-max-chunk">Paket max. <span class="muted">(Bytes)</span></label>
<InputText id="drip-max-chunk" @bind-Value="Model!.MaxChunkSize" class="mono" inputmode="numeric" data-bandwidth-input />
<FieldError Errors="_errors" Field="@nameof(HoldMethodModel.MaxChunkSize)" />
</div>
<div>
<label for="hold">Maximale Haltedauer <span class="muted">(hh:mm:ss)</span></label>
<InputText id="hold" @bind-Value="Model!.MaxHoldDuration" class="mono" />
<FieldError Errors="_errors" Field="@nameof(HoldMethodModel.MaxHoldDuration)" />
</div>
</div>
<p class="muted">
Pause 10 ms bis 30 s, Paket 1 bis 4096 Bytes. Ø ca. <strong id="drip-bandwidth">@Bandwidth</strong> Bytes/s pro gefangener Verbindung.
</p>
<div class="actions">
<button type="submit">Speichern</button>
<div class="estimate">
<span class="estimate-value">Ø <strong id="drip-bandwidth">@Bandwidth</strong> Bytes/s</span>
<span class="muted">pro gefangener Verbindung, berechnet aus Pausen und Paketgrößen</span>
</div>
</div>
</EditForm>
<EditForm Model="_resetModel" FormName="hold-method-reset" OnSubmit="ResetAsync" action="/settings" class="danger-zone">
<div class="actions">
<button type="submit" class="secondary" disabled="@(!_hasOverrides)" onclick="return confirm('Haltemethode auf Standard zurücksetzen?')">Auf Standard zurücksetzen</button>
</div>
</EditForm>
</section>
<footer class="s-foot">
<EditForm Model="_resetModel" FormName="hold-method-reset" OnSubmit="ResetAsync" action="/settings#hold-method">
<button type="submit" class="ghost" disabled="@(!_hasOverrides)" onclick="return confirm('Haltemethode auf Standard zurücksetzen?')">Auf Standard zurücksetzen</button>
</EditForm>
<button type="submit" form="hold-method-form">Speichern</button>
</footer>
</SettingsSection>
<script src="@Assets["settings.js"]" defer></script>
@code {
private static readonly (string Value, string Title, string Text)[] Choices =
[
(nameof(DripContent.Html), "HTML-Fülltext", "Eine endlose Webseite mit Überschriften, Absätzen und Links. Wirkt auf Crawler am echtesten."),
(nameof(DripContent.Text), "Zufallstext", "Schlichter Text ohne Markup, ausgeliefert als text/plain."),
(nameof(DripContent.Alternating), "Wechselnd", "Pro Fang zufällig eine der beiden. Gut, um zu vergleichen, was Bots länger hält.")
];
private readonly object _resetModel = new();
private IReadOnlyDictionary<string, string> _errors = new Dictionary<string, string>();
private bool _hasOverrides;