fix(overlay): strip spinner frame from subsync overlay card

- Add overlayBody override to ConfiguredStatusNotificationOptions so overlay/OSD/desktop can diverge
- Extract getSubsyncStatusNotificationOptions() to strip the ASCII spinner frame from the overlay card (OSD keeps it since it renders the raw spinner)
- Add tests for spinner stripping and subsync result notifications
This commit is contained in:
2026-07-31 18:03:26 -07:00
parent b2bbf1ae12
commit 6607c333bc
3 changed files with 81 additions and 10 deletions
@@ -12,6 +12,8 @@ export interface ConfiguredStatusNotificationDeps {
export interface ConfiguredStatusNotificationOptions {
id?: string;
/** Overrides the overlay card body (the OSD/desktop paths keep the raw message). */
overlayBody?: string;
title?: string;
variant?: OverlayNotificationPayload['variant'];
persistent?: boolean;
@@ -31,6 +33,23 @@ export function getPlaybackFeedbackNotificationOptions(
return {};
}
export function getSubsyncStatusNotificationOptions(
message: string,
): ConfiguredStatusNotificationOptions {
const syncing = message.startsWith('Subsync: syncing');
const failed = message.toLowerCase().includes('failed');
return {
id: 'subsync-status',
title: 'Subsync',
// The overlay card renders its own animated spinner, so drop the ASCII
// spinner frame that the OSD path still needs.
overlayBody: syncing ? message.replace(/\s+[|/\-\\]$/, '') : message,
variant: failed ? 'error' : syncing ? 'progress' : 'info',
persistent: syncing,
desktop: !syncing,
};
}
export function getYoutubeFlowStatusNotificationOptions(
message: string,
): ConfiguredStatusNotificationOptions {
@@ -74,7 +93,7 @@ export function notifyConfiguredStatus(
deps.showOverlayNotification({
id: options.id,
title: options.title ?? 'SubMiner',
body: message,
body: options.overlayBody ?? message,
variant: options.variant ?? 'info',
persistent: options.persistent ?? false,
});