fix(connection): Happ TV quick-connect is Happ-only + matches config-block styles

The TV quick-connect block (Подключить TV / Сканировать QR) is a Happ-only
feature (check.happ.su/sendtv), but it rendered for ANY app on a TV platform and
used one-off button styles (solid btn-primary + grey btn-secondary) that clashed
with the outlined-accent buttons that come from the subscription-page config.

- Show TvQuickConnect only for the Happ app (detected by its happ:// deep-link
  scheme, name as fallback).
- Extract the config-block button style into a shared blockButtonClass and use it
  for the TV buttons too, so they adapt to exactly the same visual language as the
  panel-config blocks (no divergent one-off styling).
- Align the code input with the Happ Android TV API doc (5-digit numeric):
  placeholder 12345 + inputMode numeric. The send call already matches the spec
  (POST check.happ.su/sendtv/{code}, body {"data": base64(subscriptionUrl)}).
This commit is contained in:
c0mrade
2026-06-03 15:49:58 +03:00
parent b210a04dbb
commit 5855a88dc6
4 changed files with 39 additions and 15 deletions

View File

@@ -34,6 +34,14 @@ const RENDERERS: Record<string, React.ComponentType<BlockRendererProps>> = {
minimal: MinimalBlock,
};
/** TV quick-connect is a Happ-only feature (check.happ.su/sendtv) — show it only
* for the Happ app, detected by its happ:// deep-link scheme (name as fallback). */
function isHappApp(app: RemnawaveAppClient | null): boolean {
if (!app) return false;
if ((app.deepLink ?? '').toLowerCase().startsWith('happ://')) return true;
return app.name.toLowerCase().includes('happ');
}
interface Props {
appConfig: AppConfig;
onOpenDeepLink: (url: string) => void;
@@ -312,8 +320,9 @@ export default function InstallationGuide({
</a>
)}
{/* Blocks — for TV: first block, Quick Connect, last block */}
{selectedApp && isTvPlatform && appConfig.subscriptionUrl ? (
{/* Blocks — for the Happ TV app: first block, Quick Connect, last block.
Other apps (or non-TV) render their blocks normally. */}
{selectedApp && isTvPlatform && isHappApp(selectedApp) && appConfig.subscriptionUrl ? (
<>
{selectedApp.blocks.length > 0 && (
<Renderer