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

@@ -0,0 +1,16 @@
/**
* Shared button styling for connection blocks. The config-driven blocks
* (BlockButtons) and the Happ TV quick-connect both render through this so the
* latter adapts to exactly the same visual language as the styles coming from
* the subscription-page config — no divergent one-off button styles.
*/
export function blockButtonClass(variant: 'light' | 'subtle', isLight?: boolean): string {
if (variant === 'light') {
return isLight
? 'rounded-xl border border-accent-500/50 px-4 py-2 text-sm font-medium text-accent-600 shadow-sm transition-all hover:bg-accent-500/10'
: 'rounded-xl border border-accent-500/40 px-4 py-2 text-sm font-medium text-accent-400 transition-all hover:bg-accent-500/10';
}
return isLight
? 'rounded-xl px-3 py-1.5 text-sm font-medium text-dark-300 transition-all hover:bg-dark-700/30'
: 'rounded-xl px-3 py-1.5 text-sm font-medium text-dark-300 transition-all hover:bg-dark-700/50';
}