Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat(league): registro de features com estado e motivo de indisponibilidade (#261)

antonio75cd8d3d6c7e
diff --git a/src-tauri/src/commands/league/locator.rs b/src-tauri/src/commands/league/locator.rs
index 47ec909b..4d910be9 100644
--- a/src-tauri/src/commands/league/locator.rs
+++ b/src-tauri/src/commands/league/locator.rs
@@ -218,6 +218,13 @@ async fn credentials_from_lockfiles(listing: &str) -> Option<(LcuCredentials, So
None
}
+/// Install directory of the game, when it can be told from the running process.
+/// Features that need files on disk (replays, the settings lock) depend on this.
+pub async fn install_dir() -> Option<PathBuf> {
+ let listing = read_process_command_lines().await.ok()?;
+ install_dirs_from_listing(&listing).into_iter().next()
+}
+
pub async fn discover() -> Option<(LcuCredentials, Source)> {
let listing = read_process_command_lines().await.unwrap_or_default();
if let Some(credentials) = credentials_from_listing(&listing) {
diff --git a/src-tauri/src/commands/league/mod.rs b/src-tauri/src/commands/league/mod.rs
index 7ab955ff..3926f531 100644
--- a/src-tauri/src/commands/league/mod.rs
+++ b/src-tauri/src/commands/league/mod.rs
@@ -1492,6 +1492,15 @@ pub async fn league_end_of_game_stats() -> Result<Value, String> {
lcu_get_raw(&client, "/lol-end-of-game/v1/eog-stats-block").await
}
+/// Where the game is installed, as far as the running process reveals. Null when
+/// the client is not running or the path could not be told.
+#[tauri::command]
+pub async fn league_install_dir() -> Result<Value, String> {
+ ensure_enabled()?;
+ let dir = locator::install_dir().await;
+ Ok(json!({ "path": dir.map(|p| p.to_string_lossy().to_string()) }))
+}
+
/// Objective respawn estimates and a readable feed of what just happened,
/// derived from the in-game event log.
#[tauri::command]
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 65f600cf..384d77af 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -809,6 +809,7 @@ pub fn run() {
commands::auth_webview::open_auth_webview,
commands::league::league_status,
commands::league::league_get,
+ commands::league::league_install_dir,
commands::league::league_set_positions,
commands::league::league_end_of_game_stats,
commands::league::league_set_icon,
diff --git a/src/components/league/AnalysisTab.svelte b/src/components/league/AnalysisTab.svelte
index 2fdd9e56..10cb46d2 100644
--- a/src/components/league/AnalysisTab.svelte
+++ b/src/components/league/AnalysisTab.svelte
@@ -3,6 +3,7 @@
import { t } from "$lib/i18n";
import { CDRAGON, TAG_KEYS, type Champion, type RankedEntry, type ScoutPlayer } from "./shared";
import { markedPlayers, winrateSquad } from "$lib/league-scouting";
+ import { availability, featureById, type Platform } from "./registry";
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
let {
@@ -18,6 +19,8 @@
notes,
onSaveNote,
timesSeenBefore,
+ platform,
+ clientConnected,
}: {
analysis: any;
analysisLoading: boolean;
@@ -31,8 +34,20 @@
notes: Record<string, string>;
onSaveNote: (puuid: string, text: string) => void;
timesSeenBefore: (puuid: string) => number;
+ platform?: Platform;
+ clientConnected?: boolean;
} = $props();
+ let analysisFeature = featureById("analysis");
+ let analysisAvailability = $derived.by(() => {
+ if (!analysisFeature) return { available: true as const };
+ return availability(analysisFeature, {
+ platform: platform ?? "macos",
+ clientConnected: clientConnected ?? true,
+ inGame: phase === "ChampSelect" || phase === "InProgress",
+ });
+ });
+
let marked = $derived(markedPlayers(scoutPlayers, notes));
let squadSide = $derived(winrateSquad(scoutPlayers, analysis?.premades ?? [], scoutReports));
@@ -144,7 +159,7 @@
</section>
{:else}
<div class="guard-card">
- <p>{$t("league.win_unavailable")}</p>
+ <p>{analysisAvailability.available ? $t("league.win_unavailable") : $t(analysisAvailability.reasonKey)}</p>
<button class="button" onclick={onRefreshAnalysis} disabled={analysisLoading}>{$t("league.refresh")}</button>
</div>
{/if}
diff --git a/src/components/league/LiveTab.svelte b/src/components/league/LiveTab.svelte
index b77efa53..261ee0ce 100644
--- a/src/components/league/LiveTab.svelte
+++ b/src/components/league/LiveTab.svelte
@@ -1,19 +1,40 @@
<script lang="ts">
import { t } from "$lib/i18n";
import { CDRAGON, ROLES, assetUrl, formatGameTime, type GoalKey, type Role } from "./shared";
+ import { availability, featureById, needsBadge, type Platform } from "./registry";
let {
liveMetrics,
cooldowns,
liveEvents,
goalValue,
+ platform,
+ clientConnected,
}: {
liveMetrics: any;
cooldowns: any;
liveEvents: any;
goalValue: (role: Role, key: GoalKey) => number;
+ platform?: Platform;
+ clientConnected?: boolean;
} = $props();
+ let context = $derived({
+ platform: platform ?? "macos",
+ clientConnected: clientConnected ?? true,
+ inGame: Boolean(liveMetrics?.players?.length),
+ });
+
+ let objectivesFeature = featureById("objectives");
+ let objectivesAvailability = $derived(
+ objectivesFeature ? availability(objectivesFeature, context) : { available: true as const },
+ );
+
+ let liveFeature = featureById("live-metrics");
+ let liveAvailability = $derived(
+ liveFeature ? availability(liveFeature, context) : { available: true as const },
+ );
+
let selfRow = $derived(liveMetrics?.players?.find((r: any) => r.isSelf) ?? null);
let myTeam = $derived(selfRow?.team ?? "ORDER");
let enemyTeam = $derived(myTeam === "ORDER" ? "CHAOS" : "ORDER");
@@ -239,6 +260,12 @@
{#if objectives.length > 0 || feed.length > 0}
<section class="card">
<div class="card-head">
+ <h3>
+ {$t("league.objectives_title")}
+ {#if objectivesFeature && needsBadge(objectivesFeature)}
+ <span class="feature-badge">{$t(`league.badge_${objectivesFeature.state}`)}</span>
+ {/if}
+ </h3>
<h3>{$t("league.objectives_title")}</h3>
</div>
{#if objectives.length > 0}
@@ -289,6 +316,6 @@
{/if}
{:else}
<div class="guard-card">
- <p>{$t("league.gold_unavailable")}</p>
+ <p>{liveAvailability.available ? $t("league.gold_unavailable") : $t(liveAvailability.reasonKey)}</p>
</div>
{/if}
diff --git a/src/components/league/MetaTab.svelte b/src/components/league/MetaTab.svelte
index 2b6d077a..8b8bdf84 100644
--- a/src/components/league/MetaTab.svelte
+++ b/src/components/league/MetaTab.svelte
@@ -3,6 +3,7 @@
import { invoke } from "@tauri-apps/api/core";
import { t } from "$lib/i18n";
import { translateBackendError } from "$lib/error-translate";
+ import { featureById, needsBadge } from "./registry";
import { getSettings, updateSettings } from "$lib/stores/settings-store.svelte";
import { CDRAGON, type Champion } from "./shared";
@@ -125,6 +126,7 @@
}
});
+ const buildFeature = featureById("build-reference");
let metaInfo = $state<any>(null);
let metaLoading = $state(false);
let metaError = $state("");
@@ -335,6 +337,12 @@
{/if}
<div class="divider"></div>
<div class="card-head">
+ <h4 class="section-title">
+ {$t("league.meta_reference")}
+ {#if buildFeature && needsBadge(buildFeature)}
+ <span class="feature-badge">{$t(`league.badge_${buildFeature.state}`)}</span>
+ {/if}
+ </h4>
<h4 class="section-title">{$t("league.meta_reference")}</h4>
<button
class="button"
diff --git a/src/components/league/registry.test.ts b/src/components/league/registry.test.ts
new file mode 100644
index 00000000..8d0a828d
--- /dev/null
+++ b/src/components/league/registry.test.ts
@@ -0,0 +1,77 @@
+import { describe, it, expect } from "vitest";
+import {
+ availability,
+ featureById,
+ LEAGUE_FEATURES,
+ needsBadge,
+ type Feature,
+} from "./registry";
+
+const online = { platform: "macos" as const, clientConnected: true, inGame: true };
+
+describe("availability", () => {
+ const feature: Feature = {
+ id: "x",
+ labelKey: "k",
+ state: "stable",
+ platforms: ["windows", "macos"],
+ requiresClient: true,
+ requiresGame: true,
+ };
+
+ it("clears a feature whose requirements are all met", () => {
+ expect(availability(feature, online)).toEqual({ available: true });
+ });
+
+ it("reports the platform first, because nothing else can fix it", () => {
+ const result = availability(feature, { ...online, platform: "linux", clientConnected: false });
+ expect(result).toEqual({ available: false, reasonKey: "league.unavailable_platform" });
+ });
+
+ it("reports the client before the game", () => {
+ expect(availability(feature, { ...online, clientConnected: false, inGame: false })).toEqual({
+ available: false,
+ reasonKey: "league.unavailable_client",
+ });
+ });
+
+ it("reports the game when only that is missing", () => {
+ expect(availability(feature, { ...online, inGame: false })).toEqual({
+ available: false,
+ reasonKey: "league.unavailable_game",
+ });
+ });
+
+ it("lets a feature with no requirements run anywhere it is supported", () => {
+ const anywhere: Feature = { id: "y", labelKey: "k", state: "stable", platforms: ["linux"] };
+ expect(availability(anywhere, { platform: "linux", clientConnected: false, inGame: false })).toEqual({
+ available: true,
+ });
+ });
+});
+
+describe("the registry itself", () => {
+ it("has unique ids", () => {
+ const ids = LEAGUE_FEATURES.map((f) => f.id);
+ expect(new Set(ids).size).toBe(ids.length);
+ });
+
+ it("looks features up by id", () => {
+ expect(featureById("auto-accept")?.flag).toBe("auto_accept");
+ expect(featureById("nope")).toBeUndefined();
+ });
+
+ it("marks only beta and experimental features", () => {
+ expect(needsBadge({ id: "a", labelKey: "k", state: "beta", platforms: [] })).toBe(true);
+ expect(needsBadge({ id: "a", labelKey: "k", state: "experimental", platforms: [] })).toBe(true);
+ expect(needsBadge({ id: "a", labelKey: "k", state: "stable", platforms: [] })).toBe(false);
+ });
+
+ it("never claims a client-only feature works without the client", () => {
+ for (const feature of LEAGUE_FEATURES.filter((f) => f.requiresGame)) {
+ expect(feature.requiresGame).toBe(true);
+ const result = availability(feature, { ...online, inGame: false });
+ expect(result.available).toBe(false);
+ }
+ });
+});
diff --git a/src/components/league/registry.ts b/src/components/league/registry.ts
new file mode 100644
index 00000000..0518efe8
--- /dev/null
+++ b/src/components/league/registry.ts
@@ -0,0 +1,72 @@
+/// What the user can expect from a feature. `experimental` and `beta` are marked
+/// in the UI with a discreet badge; `unavailable` renders an explanation of why
+/// instead of a broken control.
+export type FeatureState = "stable" | "beta" | "experimental" | "unavailable";
+
+export type Platform = "windows" | "macos" | "linux";
+
+export type Feature = {
+ id: string;
+ /// i18n key for the human-readable name.
+ labelKey: string;
+ state: FeatureState;
+ platforms: Platform[];
+ /// Key under `settings.league` that switches it off, when there is one.
+ flag?: string;
+ /// Reason the feature cannot run, as an i18n key. Only meaningful together
+ /// with the checks below.
+ requiresClient?: boolean;
+ requiresGame?: boolean;
+};
+
+/// Single place that records what each league surface needs to work, so a
+/// disabled control can always explain itself instead of silently failing.
+export const LEAGUE_FEATURES: readonly Feature[] = [
+ { id: "scouting", labelKey: "league.scout_title", state: "stable", platforms: ["windows", "macos"], requiresClient: true },
+ { id: "analysis", labelKey: "league.win_title", state: "stable", platforms: ["windows", "macos"], requiresClient: true },
+ { id: "build-reference", labelKey: "league.meta_reference", state: "beta", platforms: ["windows", "macos", "linux"] },
+ { id: "tier-list", labelKey: "league.tiers_title", state: "stable", platforms: ["windows", "macos", "linux"] },
+ { id: "live-metrics", labelKey: "league.gold_title", state: "stable", platforms: ["windows", "macos"], requiresGame: true },
+ { id: "objectives", labelKey: "league.objectives_title", state: "beta", platforms: ["windows", "macos"], requiresGame: true },
+ { id: "profile-tools", labelKey: "league.profile_tools", state: "beta", platforms: ["windows", "macos"], requiresClient: true },
+ { id: "restart-ux", labelKey: "league.restart_ux", state: "stable", platforms: ["windows", "macos"], requiresClient: true },
+ { id: "auto-accept", labelKey: "league.auto_accept", state: "stable", platforms: ["windows", "macos"], flag: "auto_accept", requiresClient: true },
+ { id: "auto-pick", labelKey: "league.auto_pick", state: "stable", platforms: ["windows", "macos"], flag: "auto_pick", requiresClient: true },
+ { id: "auto-ban", labelKey: "league.auto_ban", state: "stable", platforms: ["windows", "macos"], flag: "auto_ban", requiresClient: true },
+ { id: "auto-swaps", labelKey: "league.auto_swaps", state: "experimental", platforms: ["windows", "macos"], flag: "auto_accept_swaps", requiresClient: true },
+ { id: "auto-requeue", labelKey: "league.auto_requeue", state: "experimental", platforms: ["windows", "macos"], flag: "auto_requeue", requiresClient: true },
+];
+
+export type Availability =
+ | { available: true }
+ | { available: false; reasonKey: string };
+
+export type Context = {
+ platform: Platform;
+ clientConnected: boolean;
+ inGame: boolean;
+};
+
+/// Why a feature cannot be used right now, in the order the user can act on:
+/// platform first (nothing to do about it), then the client, then the game.
+export function availability(feature: Feature, context: Context): Availability {
+ if (!feature.platforms.includes(context.platform)) {
+ return { available: false, reasonKey: "league.unavailable_platform" };
+ }
+ if (feature.requiresClient && !context.clientConnected) {
+ return { available: false, reasonKey: "league.unavailable_client" };
+ }
+ if (feature.requiresGame && !context.inGame) {
+ return { available: false, reasonKey: "league.unavailable_game" };
+ }
+ return { available: true };
+}
+
+export function featureById(id: string): Feature | undefined {
+ return LEAGUE_FEATURES.find((feature) => feature.id === id);
+}
+
+/// Features worth marking in the UI, so a badge is never guesswork.
+export function needsBadge(feature: Feature): boolean {
+ return feature.state === "beta" || feature.state === "experimental";
+}
diff --git a/src/lib/i18n/el.json b/src/lib/i18n/el.json
index 19571f43..401edb07 100644
--- a/src/lib/i18n/el.json
+++ b/src/lib/i18n/el.json
@@ -230,6 +230,11 @@
"dodge": "Dodge",
"dodge_warning": "Αν φύγεις τώρα μετράει ως dodge: χάνεις LP και παίρνεις καθυστέρηση ουράς.",
"dodge_confirm": "Φύγε ούτως ή άλλως",
+ "unavailable_platform": "Μη διαθέσιμο σε αυτό το σύστημα.",
+ "unavailable_client": "Άνοιξε τον client του League of Legends για να το χρησιμοποιήσεις.",
+ "unavailable_game": "Διαθέσιμο κατά τη διάρκεια παιχνιδιού.",
+ "badge_beta": "beta",
+ "badge_experimental": "πειραματικό",
"profile_tools": "Προσαρμογή προφίλ",
"profile_icon": "Εικονίδιο summoner",
"profile_icon_saved": "Το εικονίδιο ενημερώθηκε.",
diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json
index dbb146fc..8d492892 100644
--- a/src/lib/i18n/en.json
+++ b/src/lib/i18n/en.json
@@ -248,6 +248,11 @@
"dodge": "Dodge",
"dodge_warning": "Leaving now counts as a dodge: you lose LP and get a queue delay.",
"dodge_confirm": "Dodge anyway",
+ "unavailable_platform": "Not available on this system.",
+ "unavailable_client": "Open the League of Legends client to use this.",
+ "unavailable_game": "Available while a match is running.",
+ "badge_beta": "beta",
+ "badge_experimental": "experimental",
"profile_tools": "Customise profile",
"profile_icon": "Summoner icon",
"profile_icon_saved": "Icon updated.",
diff --git a/src/lib/i18n/es.json b/src/lib/i18n/es.json
index 8178ac3b..c93a6e83 100644
--- a/src/lib/i18n/es.json
+++ b/src/lib/i18n/es.json
@@ -230,6 +230,11 @@
"dodge": "Dodge",
"dodge_warning": "Salir ahora cuenta como dodge: pierdes PL y recibes retraso de cola.",
"dodge_confirm": "Salir igualmente",
+ "unavailable_platform": "No disponible en este sistema.",
+ "unavailable_client": "Abre el cliente de League of Legends para usar esto.",
+ "unavailable_game": "Disponible durante una partida.",
+ "badge_beta": "beta",
+ "badge_experimental": "experimental",
"profile_tools": "Personalizar perfil",
"profile_icon": "Icono de invocador",
"profile_icon_saved": "Icono actualizado.",
diff --git a/src/lib/i18n/fr.json b/src/lib/i18n/fr.json
index a05a58ae..2afc5829 100644
--- a/src/lib/i18n/fr.json
+++ b/src/lib/i18n/fr.json
@@ -230,6 +230,11 @@
"dodge": "Dodge",
"dodge_warning": "Quitter maintenant compte comme un dodge : perte de PL et délai de file.",
"dodge_confirm": "Quitter quand même",
+ "unavailable_platform": "Non disponible sur ce système.",
+ "unavailable_client": "Ouvrez le client League of Legends pour l'utiliser.",
+ "unavailable_game": "Disponible pendant une partie.",
+ "badge_beta": "bêta",
+ "badge_experimental": "expérimental",
"profile_tools": "Personnaliser le profil",
"profile_icon": "Icône d'invocateur",
"profile_icon_saved": "Icône mise à jour.",
diff --git a/src/lib/i18n/it.json b/src/lib/i18n/it.json
index 7dda446c..91ca9309 100644
--- a/src/lib/i18n/it.json
+++ b/src/lib/i18n/it.json
@@ -230,6 +230,11 @@
"dodge": "Dodge",
"dodge_warning": "Uscire ora conta come dodge: perdi PL e subisci un ritardo in coda.",
"dodge_confirm": "Esci comunque",
+ "unavailable_platform": "Non disponibile su questo sistema.",
+ "unavailable_client": "Apri il client di League of Legends per usarlo.",
+ "unavailable_game": "Disponibile durante una partita.",
+ "badge_beta": "beta",
+ "badge_experimental": "sperimentale",
"profile_tools": "Personalizza profilo",
"profile_icon": "Icona evocatore",
"profile_icon_saved": "Icona aggiornata.",
diff --git a/src/lib/i18n/ja.json b/src/lib/i18n/ja.json
index 827e3976..5d8f5bf2 100644
--- a/src/lib/i18n/ja.json
+++ b/src/lib/i18n/ja.json
@@ -230,6 +230,11 @@
"dodge": "ドッジ",
"dodge_warning": "今退出するとドッジ扱いになり、LPを失いキュー制限を受けます。",
"dodge_confirm": "それでも退出",
+ "unavailable_platform": "このシステムでは利用できません。",
+ "unavailable_client": "League of Legends クライアントを起動してください。",
+ "unavailable_game": "試合中に利用できます。",
+ "badge_beta": "ベータ",
+ "badge_experimental": "実験的",
"profile_tools": "プロフィールを設定",
"profile_icon": "サモナーアイコン",
"profile_icon_saved": "アイコンを更新しました。",
diff --git a/src/lib/i18n/keys.ts b/src/lib/i18n/keys.ts
index 47882706..6bf543d3 100644
--- a/src/lib/i18n/keys.ts
+++ b/src/lib/i18n/keys.ts
@@ -423,6 +423,8 @@ export type TranslationKeys =
| 'league.auto_trade_desc'
| 'league.auto_trade_off'
| 'league.automation_title'
+ | 'league.badge_beta'
+ | 'league.badge_experimental'
| 'league.ban_delay'
| 'league.ban_delay_desc'
| 'league.ban_list'
@@ -658,6 +660,9 @@ export type TranslationKeys =
| 'league.tiers_pick'
| 'league.tiers_position'
| 'league.tiers_title'
+ | 'league.unavailable_client'
+ | 'league.unavailable_game'
+ | 'league.unavailable_platform'
| 'league.unranked'
| 'league.victory'
| 'league.win_allies'
diff --git a/src/lib/i18n/pt.json b/src/lib/i18n/pt.json
index 7646cec0..cf4729c5 100644
--- a/src/lib/i18n/pt.json
+++ b/src/lib/i18n/pt.json
@@ -230,6 +230,11 @@
"dodge": "Dodge",
"dodge_warning": "Sair agora conta como dodge: você perde PDL e pega atraso de fila.",
"dodge_confirm": "Sair mesmo assim",
+ "unavailable_platform": "Não disponível neste sistema.",
+ "unavailable_client": "Abra o cliente de League of Legends para usar isto.",
+ "unavailable_game": "Disponível durante uma partida.",
+ "badge_beta": "beta",
+ "badge_experimental": "experimental",
"profile_tools": "Personalizar perfil",
"profile_icon": "Ícone de invocador",
"profile_icon_saved": "Ícone atualizado.",
diff --git a/src/lib/i18n/ru.json b/src/lib/i18n/ru.json
index d27a8ee8..234ff9ee 100644
--- a/src/lib/i18n/ru.json
+++ b/src/lib/i18n/ru.json
@@ -230,6 +230,11 @@
"dodge": "Додж",
"dodge_warning": "Выход сейчас считается доджем: вы потеряете LP и получите задержку очереди.",
"dodge_confirm": "Всё равно выйти",
+ "unavailable_platform": "Недоступно в этой системе.",
+ "unavailable_client": "Откройте клиент League of Legends, чтобы это использовать.",
+ "unavailable_game": "Доступно во время матча.",
+ "badge_beta": "бета",
+ "badge_experimental": "экспериментально",
"profile_tools": "Настроить профиль",
"profile_icon": "Иконка призывателя",
"profile_icon_saved": "Иконка обновлена.",
diff --git a/src/lib/i18n/zh-TW.json b/src/lib/i18n/zh-TW.json
index 7bd26dff..6bbc44fd 100644
--- a/src/lib/i18n/zh-TW.json
+++ b/src/lib/i18n/zh-TW.json
@@ -230,6 +230,11 @@
"dodge": "閃退",
"dodge_warning": "現在退出將視為閃退:你會失去積分並受到排隊延遲。",
"dodge_confirm": "仍要退出",
+ "unavailable_platform": "此系統不支援。",
+ "unavailable_client": "請開啟英雄聯盟客戶端後使用。",
+ "unavailable_game": "對局進行中可用。",
+ "badge_beta": "測試版",
+ "badge_experimental": "實驗性",
"profile_tools": "自訂個人檔案",
"profile_icon": "召喚師頭像",
"profile_icon_saved": "頭像已更新。",
diff --git a/src/lib/i18n/zh.json b/src/lib/i18n/zh.json
index 2f06d127..3971ffa4 100644
--- a/src/lib/i18n/zh.json
+++ b/src/lib/i18n/zh.json
@@ -230,6 +230,11 @@
"dodge": "秒退",
"dodge_warning": "现在退出将视为秒退:你会扣除胜点并受到排队惩罚。",
"dodge_confirm": "仍要退出",
+ "unavailable_platform": "此系统不支持。",
+ "unavailable_client": "请打开英雄联盟客户端后使用。",
+ "unavailable_game": "对局进行中可用。",
+ "badge_beta": "测试版",
+ "badge_experimental": "实验性",
"profile_tools": "自定义资料",
"profile_icon": "召唤师图标",
"profile_icon_saved": "图标已更新。",
diff --git a/src/routes/league/+page.svelte b/src/routes/league/+page.svelte
index 6112b8e2..f1807c23 100644
--- a/src/routes/league/+page.svelte
+++ b/src/routes/league/+page.svelte
@@ -20,6 +20,7 @@
import AutomationTab from "$components/league/AutomationTab.svelte";
import HistoryTab from "$components/league/HistoryTab.svelte";
import type { Champion, GoalKey, LobbyQueue, RankedEntry, Role, ScoutPlayer } from "$components/league/shared";
+ import type { Platform } from "$components/league/registry";
type LeagueStatus = { connected: boolean; port: number | null; region: string | null };
@@ -137,6 +138,15 @@
let cooldowns = $state<any>(null);
let liveEvents = $state<any>(null);
+ // The registry needs to know where it runs to explain platform limits.
+ let platform = $derived<Platform>(
+ navigator.userAgent.includes("Windows")
+ ? "windows"
+ : navigator.userAgent.includes("Mac")
+ ? "macos"
+ : "linux",
+ );
+
const GOALS_KEY = "league-role-goals";
// Baselines mirror the Rust defaults; a support is not judged on CS.
@@ -453,7 +463,7 @@
<OverviewTab {summoner} {ranked} {phase} {champSelect} {liveGame} {lobby} {queues} {actionError} {champions} {championById} {championByAlias} onAction={action} />
</div>
<div class="tab-panel" class:active={tab === "analysis"}>
- <AnalysisTab {analysis} {analysisLoading} onRefreshAnalysis={loadAnalysis} {phase} {scoutPlayers} {scoutReports} {scoutLoading} onRefreshScouting={loadScouting} {championById} {notes} onSaveNote={saveNote} {timesSeenBefore} />
+ <AnalysisTab {analysis} {analysisLoading} onRefreshAnalysis={loadAnalysis} {phase} {scoutPlayers} {scoutReports} {scoutLoading} onRefreshScouting={loadScouting} {championById} {notes} onSaveNote={saveNote} {timesSeenBefore} {platform} clientConnected={status.connected} />
</div>
<div class="tab-panel" class:active={tab === "meta"}>
<MetaTab {champSelectChampionId} {myAssignedPosition} {championById} {champions} region={status.region} />
@@ -462,6 +472,7 @@
<SearchTab {championById} />
</div>
<div class="tab-panel" class:active={tab === "live"}>
+ <LiveTab {liveMetrics} {cooldowns} {liveEvents} {goalValue} {platform} clientConnected={status.connected} />
<LiveTab {liveMetrics} {cooldowns} {liveEvents} {goalValue} />
</div>
<div class="tab-panel" class:active={tab === "goals"}>
@@ -1922,6 +1933,17 @@
background: var(--surface-hover);
}
+ .league-page :global(.feature-badge) {
+ font-size: 10px;
+ font-weight: 400;
+ color: var(--text-muted);
+ border: 1px solid var(--border);
+ border-radius: 999px;
+ padding: 1px 6px;
+ margin-left: 6px;
+ vertical-align: middle;
+ }
+
.league-page :global(.profile-tools) {
margin-bottom: 10px;
}