A profile shows the hashtags an account features as chips opening their feed; under another account's header is what the persona keeps of it for itself alone: for one it follows, a bell (follow with notify), the languages of its posts that reach the home feed (follow with languages[]) and Recommend (endorsements, private here), and for any account a private note saved on blur or with Save. Settings edits the persona's featured hashtags (added by name or from those used lately, 10 at most) and its reading preferences (/clientapi/avatar/private/preferences), which CascadingState keeps per persona and the card applies to sensitive media and content warnings. A hashtag's tab features it on the profile. Explore has Who to follow (/api/v2/suggestions, dismissed for good after asking); Administration has Staff picks. The Direct tab follows the direct stream's conversation events; status notifications show the post. The follows CSV carries notify and languages. Verified: Release build, 0 errors (the 3 warnings were there before). Not run against PrivaPub or in the pasture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WpVCoDeM1qUTRp4fXQdfof
249 lines
8.6 KiB
Plaintext
249 lines
8.6 KiB
Plaintext
@page "/settings"
|
|
@inherits LocalizableComponentBase
|
|
<Title>@Localizer["Settings"]</Title>
|
|
|
|
<section class="block relative w-full h-full neo-inset neo-xs rounded-xl">
|
|
|
|
<div class="flex flex-col gap-4 p-4 md:p-5 w-full h-full absolute overflow-y-auto">
|
|
|
|
<DCollapse Icon="DCollapseIcon.Arrow" IsOpen="true">
|
|
<Header>
|
|
<p class="inline-flex items-center gap-2">
|
|
<i class="ion-md-cog text-xl"></i> <span>@Localizer["General"]</span>
|
|
</p>
|
|
</Header>
|
|
<ChildContent>
|
|
@* Every theme setting; NavMenu's toggle and slider are shortcuts to the dark and hue ones. *@
|
|
<div class="flex flex-col gap-4 w-full p-3 md:p-4">
|
|
<DToggle LabelText="@Localizer["Follow the system's light or dark setting"]" Value="CascadingState.PublicCacheData.PageSettings.PreferSystemTheming"
|
|
ValueChanged="v => Update(s => s.PreferSystemTheming = v)" ValueExpression="() => CascadingState.PublicCacheData.PageSettings.PreferSystemTheming" />
|
|
<DToggle LabelText="@Localizer["Dark mode"]" Value="IsDark"
|
|
ValueChanged="v => Update(s => s.SetDarkMode(v))" ValueExpression="() => IsDark" />
|
|
<DToggle LabelText="@Localizer["Grey"]" Value="IsGray"
|
|
ValueChanged="v => Update(s => s.SetGray(v, IsDark))" ValueExpression="() => IsGray" />
|
|
@* The theme is the login's: taken at sign-in, saved to it as it changes here (CascadingState.SaveSettingsSoon). *@
|
|
<DToggle LabelText="@Localizer["Keep the theme the same on every device signed in to this login"]" Value="CascadingState.PublicCacheData.PageSettings.SyncWithLogin"
|
|
ValueChanged="v => Update(s => s.SyncWithLogin = v)" ValueExpression="() => CascadingState.PublicCacheData.PageSettings.SyncWithLogin"
|
|
data-sync-with-login />
|
|
<DToggle LabelText="@Localizer["Remind me to describe pictures before publishing"]" Value="CascadingState.PublicCacheData.PageSettings.RemindAltText"
|
|
ValueChanged="v => Update(s => s.RemindAltText = v)" ValueExpression="() => CascadingState.PublicCacheData.PageSettings.RemindAltText"
|
|
data-remind-alt-text />
|
|
<label class="flex flex-col gap-2 max-w-md">
|
|
<span class="text-sm">@Localizer["Language"]</span>
|
|
@* Language names stay in their own language. Changing it reloads the app with the new culture. *@
|
|
<DSelect TValue="string" class="w-full" Value="CascadingState.PublicCacheData.PageSettings.CurrentLanguageCode"
|
|
ValueChanged="ChangeLanguage" ValueExpression="() => CascadingState.PublicCacheData.PageSettings.CurrentLanguageCode">
|
|
<option value="en">English</option>
|
|
<option value="it">Italiano</option>
|
|
</DSelect>
|
|
</label>
|
|
<label class="flex flex-col gap-2 max-w-md">
|
|
<span class="text-sm">@Localizer["Light theme colour"]</span>
|
|
<DRange TValue="short" class="neo-hue-track w-full" Size="DSize.Xs" Min="0" Max="359" Step="1"
|
|
Value="CascadingState.PublicCacheData.PageSettings.LightThemeIndexColour" ValueChanged="v => Update(s => s.SetHue(false, v))"
|
|
ValueExpression="() => CascadingState.PublicCacheData.PageSettings.LightThemeIndexColour" />
|
|
</label>
|
|
<label class="flex flex-col gap-2 max-w-md">
|
|
<span class="text-sm">@Localizer["Dark theme colour"]</span>
|
|
<DRange TValue="short" class="neo-hue-track w-full" Size="DSize.Xs" Min="0" Max="359" Step="1"
|
|
Value="CascadingState.PublicCacheData.PageSettings.DarkThemeIndexColour" ValueChanged="v => Update(s => s.SetHue(true, v))"
|
|
ValueExpression="() => CascadingState.PublicCacheData.PageSettings.DarkThemeIndexColour" />
|
|
</label>
|
|
</div>
|
|
</ChildContent>
|
|
</DCollapse>
|
|
|
|
<DCollapse Icon="DCollapseIcon.Arrow">
|
|
<Header>
|
|
<p class="inline-flex items-center gap-2">
|
|
<i class="ion-md-funnel text-xl"></i> <span>@Localizer["Filters"]</span>
|
|
</p>
|
|
</Header>
|
|
<ChildContent>
|
|
<div class="flex flex-wrap items-center gap-3 w-full p-3 md:p-4">
|
|
<p class="flex-1 min-w-48 text-sm">@Localizer["Words, phrases and posts this persona would rather not see, and where."]</p>
|
|
<a class="btn btn-sm" href="filters"><i class="ion-md-funnel"></i><span>@Localizer["Manage filters"]</span></a>
|
|
</div>
|
|
</ChildContent>
|
|
</DCollapse>
|
|
|
|
<DCollapse Icon="DCollapseIcon.Arrow">
|
|
<Header>
|
|
<p class="inline-flex items-center gap-2" data-settings-account>
|
|
<i class="ion-md-key text-xl"></i> <span>@Localizer["Login"]</span>
|
|
</p>
|
|
</Header>
|
|
<ChildContent>
|
|
<div class="block w-full p-3 md:p-4">
|
|
@if (CascadingState.IsSignedIn)
|
|
{
|
|
<AccountEditor />
|
|
}
|
|
else
|
|
{
|
|
<a class="link" href="login">@Localizer["Sign in to PrivaPub"]</a>
|
|
}
|
|
</div>
|
|
</ChildContent>
|
|
</DCollapse>
|
|
|
|
<DCollapse Icon="DCollapseIcon.Arrow">
|
|
<Header>
|
|
<p class="inline-flex items-center gap-2">
|
|
<i class="ion-md-people text-xl"></i> <span>@Localizer["Personas"]</span>
|
|
</p>
|
|
</Header>
|
|
<ChildContent>
|
|
<div class="block w-full p-3 md:p-4">
|
|
@if (CascadingState.IsSignedIn)
|
|
{
|
|
<PersonasEditor />
|
|
}
|
|
else
|
|
{
|
|
<a class="link" href="login">@Localizer["Sign in to PrivaPub"]</a>
|
|
}
|
|
</div>
|
|
</ChildContent>
|
|
</DCollapse>
|
|
|
|
@* opened by a link to it (settings?open=profile, from the persona's own profile) *@
|
|
<DCollapse Icon="DCollapseIcon.Arrow" @bind-IsOpen="isProfileOpen">
|
|
<Header>
|
|
<p class="inline-flex items-center gap-2" data-settings-profile>
|
|
<i class="ion-md-person text-xl"></i> <span>@Localizer["Profile"]</span>
|
|
</p>
|
|
</Header>
|
|
<ChildContent>
|
|
<div class="block w-full p-3 md:p-4">
|
|
@if (CascadingState.IsSignedIn)
|
|
{
|
|
<div class="flex flex-col gap-6">
|
|
<ProfileEditor />
|
|
<FeaturedTagsEditor />
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<a class="link" href="login">@Localizer["Sign in to PrivaPub"]</a>
|
|
}
|
|
</div>
|
|
</ChildContent>
|
|
</DCollapse>
|
|
|
|
<DCollapse Icon="DCollapseIcon.Arrow">
|
|
<Header>
|
|
<p class="inline-flex items-center gap-2" data-settings-reading>
|
|
<i class="ion-md-eye text-xl"></i> <span>@Localizer["Reading"]</span>
|
|
</p>
|
|
</Header>
|
|
<ChildContent>
|
|
<div class="block w-full p-3 md:p-4">
|
|
@if (CascadingState.IsSignedIn)
|
|
{
|
|
<ReadingPreferencesEditor />
|
|
}
|
|
else
|
|
{
|
|
<a class="link" href="login">@Localizer["Sign in to PrivaPub"]</a>
|
|
}
|
|
</div>
|
|
</ChildContent>
|
|
</DCollapse>
|
|
|
|
<DCollapse Icon="DCollapseIcon.Arrow">
|
|
<Header>
|
|
<p class="inline-flex items-center gap-2">
|
|
<i class="ion-md-archive text-xl"></i> <span>@Localizer["Data import/export"]</span>
|
|
</p>
|
|
</Header>
|
|
<ChildContent>
|
|
<div class="block w-full p-3 md:p-4">
|
|
@if (CascadingState.IsSignedIn)
|
|
{
|
|
<div class="flex flex-col gap-6">
|
|
<PersonaArchivePanel />
|
|
<DataTransfer />
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<a class="link" href="login">@Localizer["Sign in to PrivaPub"]</a>
|
|
}
|
|
</div>
|
|
</ChildContent>
|
|
</DCollapse>
|
|
|
|
<DCollapse Icon="DCollapseIcon.Arrow">
|
|
<Header>
|
|
<p class="inline-flex items-center gap-2">
|
|
<i class="ion-md-notifications text-xl"></i> <span>@Localizer["Notifications"]</span>
|
|
</p>
|
|
</Header>
|
|
<ChildContent>
|
|
<div class="block w-full p-3 md:p-4">
|
|
@if (CascadingState.IsSignedIn)
|
|
{
|
|
<NotificationPolicyEditor />
|
|
}
|
|
else
|
|
{
|
|
<a class="link" href="login">@Localizer["Sign in to PrivaPub"]</a>
|
|
}
|
|
</div>
|
|
</ChildContent>
|
|
</DCollapse>
|
|
|
|
<DCollapse Icon="DCollapseIcon.Arrow">
|
|
<Header>
|
|
<p class="inline-flex items-center gap-2">
|
|
<i class="ion-md-eye-off text-xl"></i> <span>@Localizer["Mutes/Blocks"]</span>
|
|
</p>
|
|
</Header>
|
|
<ChildContent>
|
|
<div class="block w-full p-3 md:p-4">
|
|
@if (CascadingState.IsSignedIn)
|
|
{
|
|
<MutesAndBlocks />
|
|
}
|
|
else
|
|
{
|
|
<a class="link" href="login">@Localizer["Sign in to PrivaPub"]</a>
|
|
}
|
|
</div>
|
|
</ChildContent>
|
|
</DCollapse>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
@code {
|
|
|
|
/// <summary>A section to open as the page opens: profile (the persona's profile and featured hashtags).</summary>
|
|
[SupplyParameterFromQuery(Name = "open")] public string Open { get; set; }
|
|
|
|
bool isProfileOpen;
|
|
string openedFor;
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
if (Open == openedFor)
|
|
return;
|
|
openedFor = Open;
|
|
if (Open == "profile")
|
|
isProfileOpen = true;
|
|
}
|
|
|
|
bool IsDark => CascadingState.Status.IsDarkTheme();
|
|
bool IsGray => CascadingState.PublicCacheData.PageSettings.IsGray();
|
|
|
|
Task Update(Action<PageSettings> change) => CascadingState.UpdatePageSettings(change).AsTask();
|
|
|
|
async Task ChangeLanguage(string languageCode)
|
|
{
|
|
await Update(settings => settings.CurrentLanguageCode = languageCode);
|
|
Navigation.NavigateTo(Navigation.Uri, forceLoad: true);
|
|
}
|
|
}
|