Logout: - It navigated to "authenticatio/logout", a misspelled route. - The correct template route, authentication/logout, would throw anyway. Its RemoteAuthenticatorView casts the AuthenticationStateProvider to the OIDC template's service, and the app registers TokenAuthStateProvider instead. - It now signs out through TokenAuthStateProvider.LogoutAsync, as the code commented out in the page intended, and returns home. LoginDisplay's sign-out goes through it as well. - This also drops the obsolete SignOutSessionStateManager, the build's last warning. The IndexedDB schema never declared the ClientLogs store that IStorage.AddLog writes to, so every client log write failed inside its try/catch. Version 2 adds the store, keyed by the Id AddLog assigns. DInputBase.NameAttribute renders no name instead of name="" when the form maps no field names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
102 lines
3.1 KiB
Plaintext
102 lines
3.1 KiB
Plaintext
@inherits DInputBase<bool>
|
|
|
|
@* daisyUI Toggle: https://daisyui.com/components/toggle/ . With CheckedIcon/UncheckedIcon the toggle class moves to a
|
|
wrapper around the checkbox and the two icons (each must be a single element: daisyUI shows the wrapper's 2nd child
|
|
while unchecked and its 3rd while checked). daisyUI colors such a wrapper only through aria-checked, which a label
|
|
may not carry, so its color is a has-checked: variable instead. With LabelText all of it sits in a label.label. *@
|
|
@if (!HasIcons && LabelText is null)
|
|
{
|
|
@Checkbox(Cx("toggle", IsInvalid ? "toggle-error" : ColorClass, SizeClass, CssClass))
|
|
}
|
|
else if (!HasIcons)
|
|
{
|
|
<label class="label">
|
|
@Checkbox(Cx("toggle", IsInvalid ? "toggle-error" : ColorClass, SizeClass, CssClass))
|
|
@LabelText
|
|
</label>
|
|
}
|
|
else if (LabelText is null)
|
|
{
|
|
<label class="@WrapperClass">@IconParts</label>
|
|
}
|
|
else
|
|
{
|
|
<label class="label">
|
|
<span class="@WrapperClass">@IconParts</span>
|
|
@LabelText
|
|
</label>
|
|
}
|
|
|
|
@code {
|
|
[Parameter] public DColor Color { get; set; }
|
|
[Parameter] public DSize Size { get; set; }
|
|
[Parameter] public string LabelText { get; set; }
|
|
[Parameter] public RenderFragment CheckedIcon { get; set; }
|
|
[Parameter] public RenderFragment UncheckedIcon { get; set; }
|
|
|
|
bool HasIcons => CheckedIcon is not null || UncheckedIcon is not null;
|
|
|
|
string WrapperClass => Cx("toggle", IsInvalid ? "has-checked:[--input-color:var(--color-error)]" : WrapperColorClass, SizeClass, CssClass);
|
|
|
|
RenderFragment Checkbox(string cssClass) =>
|
|
@<input @attributes="InputAttributes" type="checkbox" class="@cssClass" name="@NameAttribute" checked="@CurrentValue"
|
|
@onchange="OnChange" aria-invalid="@(IsInvalid ? "true" : null)" />;
|
|
|
|
RenderFragment IconParts => @<text>
|
|
@Checkbox(null)
|
|
@if (UncheckedIcon is null)
|
|
{
|
|
<span></span>
|
|
}
|
|
else
|
|
{
|
|
@UncheckedIcon
|
|
}
|
|
@if (CheckedIcon is null)
|
|
{
|
|
<span></span>
|
|
}
|
|
else
|
|
{
|
|
@CheckedIcon
|
|
}
|
|
</text>;
|
|
|
|
string ColorClass => Color switch
|
|
{
|
|
DColor.Neutral => "toggle-neutral",
|
|
DColor.Primary => "toggle-primary",
|
|
DColor.Secondary => "toggle-secondary",
|
|
DColor.Accent => "toggle-accent",
|
|
DColor.Info => "toggle-info",
|
|
DColor.Success => "toggle-success",
|
|
DColor.Warning => "toggle-warning",
|
|
DColor.Error => "toggle-error",
|
|
_ => null
|
|
};
|
|
|
|
string WrapperColorClass => Color switch
|
|
{
|
|
DColor.Neutral => "has-checked:[--input-color:var(--color-neutral)]",
|
|
DColor.Primary => "has-checked:[--input-color:var(--color-primary)]",
|
|
DColor.Secondary => "has-checked:[--input-color:var(--color-secondary)]",
|
|
DColor.Accent => "has-checked:[--input-color:var(--color-accent)]",
|
|
DColor.Info => "has-checked:[--input-color:var(--color-info)]",
|
|
DColor.Success => "has-checked:[--input-color:var(--color-success)]",
|
|
DColor.Warning => "has-checked:[--input-color:var(--color-warning)]",
|
|
DColor.Error => "has-checked:[--input-color:var(--color-error)]",
|
|
_ => null
|
|
};
|
|
|
|
string SizeClass => Size switch
|
|
{
|
|
DSize.Xs => "toggle-xs",
|
|
DSize.Sm => "toggle-sm",
|
|
DSize.Lg => "toggle-lg",
|
|
DSize.Xl => "toggle-xl",
|
|
_ => null
|
|
};
|
|
|
|
void OnChange(ChangeEventArgs e) => CurrentValue = e.Value is true;
|
|
}
|