Below xl every feed tab but the selected one was a lone icon with no name, for a screen reader or a finger. DTab takes an AccessibleName, which DTabs renders as the tab's label and tooltip, and FeedTabs names each tab; on a phone every tab shows its name too. The strip is marked as one that scrolls sideways (data-scroll-x), says it holds the feeds, and on a phone fades at the edge where more tabs wait (edge-fade-x, a scroll-driven animation where the browser has one); the selected tab is brought into view when it changes (window.revealActive). Explore's tabs get the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
55 lines
2.3 KiB
C#
55 lines
2.3 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using decePubClient.Models;
|
|
|
|
using Microsoft.JSInterop;
|
|
|
|
namespace decePubClient.Services;
|
|
|
|
public class AppStatusService(IJSRuntime jsRuntime)
|
|
{
|
|
readonly IJSInProcessRuntime JsSyncRuntime = (IJSInProcessRuntime)jsRuntime;
|
|
|
|
public async ValueTask<bool> IsOnline(CancellationToken cancellationToken = default) =>
|
|
await jsRuntime.InvokeAsync<bool>("isOnline", cancellationToken);
|
|
|
|
public bool IsServiceWorkerAvailable() => JsSyncRuntime.Invoke<bool>("isServiceWorkerAvailable");
|
|
|
|
public string Language() => JsSyncRuntime.Invoke<string>("getLanguage");
|
|
|
|
public void Language(string language) => JsSyncRuntime.InvokeVoid("setLanguage", language);
|
|
|
|
public long GetHeight(string classId) => JsSyncRuntime.Invoke<long>("getHeight", classId);
|
|
|
|
public void SetAppBadge(int counter) => JsSyncRuntime.InvokeVoid("setAppBadge", counter);
|
|
|
|
public void ClearAppBadge() => JsSyncRuntime.InvokeVoid("clearAppBadge");
|
|
|
|
public async ValueTask ClearCache(CancellationToken cancellationToken = default) =>
|
|
await jsRuntime.InvokeVoidAsync("clearCache", cancellationToken);
|
|
|
|
public async ValueTask ClearLocalStorage(CancellationToken cancellationToken = default) =>
|
|
await jsRuntime.InvokeVoidAsync("clearLocalStorage", cancellationToken);
|
|
|
|
public void ReloadPage()
|
|
{
|
|
JsSyncRuntime.InvokeVoid("reloadPage");
|
|
}
|
|
|
|
// wwwroot/js/theme.js
|
|
public void ApplyTheme(PageSettings pageSettings) => JsSyncRuntime.InvokeVoid("neoTheme.apply", pageSettings);
|
|
|
|
public bool IsDarkTheme() => JsSyncRuntime.Invoke<bool>("neoTheme.isDark");
|
|
|
|
public bool IsMobileMedia() => JsSyncRuntime.Invoke<bool>("isMobileMedia");
|
|
|
|
// a sideways-scrolling strip of tabs shows its selected tab
|
|
public void RevealActive(ElementReference strip) => JsSyncRuntime.InvokeVoid("revealActive", strip);
|
|
|
|
public bool CanShare() => JsSyncRuntime.Invoke<bool>("canShareStuff");
|
|
|
|
public async ValueTask ShareTextUrl(string title, string text, Uri uri, CancellationToken cancellationToken = default) =>
|
|
await jsRuntime.InvokeVoidAsync("shareTextUrl", cancellationToken, title, text, uri.ToString());
|
|
|
|
public async ValueTask ShareText(string title, string text, CancellationToken cancellationToken = default) =>
|
|
await jsRuntime.InvokeVoidAsync("shareText", cancellationToken, title, text);
|
|
} |