+ {/* Header & Sub-navigation */}
+
+
+
+
+ {locale === "ru" ? "Модули и плагины" : "Modules & Plugins"}
+
+ MODULES PREVIEW
+
+
+
+ {locale === "ru"
+ ? "Автономная тестовая редакция для управления официальными модулями и установки сторонних модулей AzerothCore в виде DLL."
+ : "Standalone preview for official module management and dynamic third-party DLL plugin installation."}
+
+
+
+ {/* Global actions */}
+
+
+
+ {locale === "ru" ? "Экспорт отчёта" : "Export Diagnostics"}
+
+
+
+
+ {locale === "ru" ? "Подключить test-realm-v03" : "Register test-realm-v03"}
+
+
+
+
+ {/* Notification Banner */}
+ {notification && (
+
+ ✓ {notification}
+ setNotification(null)} className="text-muted hover:text-ink">
+
+
+
+ )}
+
+ {/* Error Banner */}
+ {error && (
+
+ ⚠ {error.technical || (error.human ? human(error.human).message : "Unknown error")}
+ setError(null)} className="text-muted hover:text-ink">
+
+
+
+ )}
+
+ {/* Toolchain Health Status Bar */}
+ {toolchain && (
+
+
+ {toolchain.msvc_available ? (
+
+ ) : (
+
+ )}
+
+ MSVC (vcvars64): {toolchain.msvc_available ? "Ready" : "Missing"}
+
+
+
+ {toolchain.cmake_available ? (
+
+ ) : (
+
+ )}
+
+ CMake: {toolchain.cmake_available ? "Ready" : "Missing"}
+
+
+
+ {toolchain.ninja_available ? (
+
+ ) : (
+
+ )}
+
+ Ninja: {toolchain.ninja_available ? "Ready" : "Missing"}
+
+
+
+ {toolchain.sdk_available ? (
+
+ ) : (
+
+ )}
+
+ Plugin SDK v0.3: {toolchain.sdk_available ? "Ready" : "Missing"}
+
+
+
+ )}
+
+ {/* GitHub URL Intake Bar on General Modules Screen */}
+
+
+
+
+ setGithubUrl(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" && githubUrl.trim()) {
+ void runAnalysis();
+ }
+ }}
+ placeholder={
+ locale === "ru"
+ ? "Укажите ссылку на GitHub-репозиторий модуля (например, https://github.com/azerothcore/mod-npc-buffer)..."
+ : "Enter GitHub repository URL (e.g., https://github.com/azerothcore/mod-npc-buffer)..."
+ }
+ className="w-full rounded border border-line bg-bg pl-9 pr-3 py-1.5 text-xs text-ink placeholder:text-muted/60 focus:border-gold focus:outline-none"
+ />
+
+
+
+ void runAnalysis()}
+ disabled={analyzing || !githubUrl.trim()}
+ className="text-xs h-8 px-3"
+ >
+ {analyzing ? : }
+ {locale === "ru" ? "Анализировать" : "Analyze"}
+
+
+ {
+ if (!githubUrl.trim()) return;
+ await runAnalysis();
+ await startControlledBuild();
+ }}
+ disabled={building || analyzing || !githubUrl.trim()}
+ className="text-xs h-8 px-3.5 font-medium"
+ >
+ {building ? : }
+ {locale === "ru" ? "Собрать и установить" : "Build & Install"}
+
+
+
+
+ {/* Compact analysis banner when report is ready */}
+ {report && (
+
+
+ {report.repository_name}
+ @{report.commit.substring(0, 8)}
+
+ {report.classification}
+
+ {report.sql_files.length > 0 && (
+
+ {report.sql_files.length} SQL
+
+ )}
+
+
+
+
+ {locale === "ru" ? "Экспорт JSON" : "Export JSON"}
+
+ void startControlledBuild()} disabled={building} className="text-xs h-7 px-2.5">
+ {locale === "ru" ? "Перейти к сборке" : "Build"}
+
+ {buildResult?.success && (
+
+ {locale === "ru" ? "Установить в реалм" : "Install"}
+
+ )}
+ setReport(null)} className="text-muted hover:text-ink ml-1" title="Скрыть">
+
+
+
+
+ )}
+
+ {analysisError && (
+
+ ⚠ {analysisError}
+ setAnalysisError(null)} className="text-muted hover:text-ink">
+
+
+
+ )}
+
+
+ {/* Tabs Header */}
+
+
setActiveTab("installed")}
+ className={cn(
+ "flex items-center gap-2 border-b-2 px-3.5 py-2 text-sm font-medium transition-colors",
+ activeTab === "installed"
+ ? "border-gold text-gold"
+ : "border-transparent text-muted hover:text-ink"
+ )}
+ >
+
+ {locale === "ru" ? "Установленные модули" : "Installed Modules"}
+ {installedModules.length > 0 && (
+
+ {installedModules.length}
+
+ )}
+
+
+
setActiveTab("catalog")}
+ className={cn(
+ "flex items-center gap-2 border-b-2 px-3.5 py-2 text-sm font-medium transition-colors",
+ activeTab === "catalog"
+ ? "border-gold text-gold"
+ : "border-transparent text-muted hover:text-ink"
+ )}
+ >
+
+ {locale === "ru" ? "Каталог модулей" : "Modules Catalog"}
+
+ {publicCatalog ? publicCatalog.total_count : `${VERIFIED_CATALOG.length}+`}
+
+
+
+
setActiveTab("builds")}
+ className={cn(
+ "flex items-center gap-2 border-b-2 px-3.5 py-2 text-sm font-medium transition-colors",
+ activeTab === "builds"
+ ? "border-gold text-gold"
+ : "border-transparent text-muted hover:text-ink"
+ )}
+ >
+
+ {locale === "ru" ? "Сборка & логи MSVC" : "Builds & MSVC Logs"}
+ {building && }
+
+
+
setActiveTab("toolchain")}
+ className={cn(
+ "flex items-center gap-2 border-b-2 px-3.5 py-2 text-sm font-medium transition-colors",
+ activeTab === "toolchain"
+ ? "border-gold text-gold"
+ : "border-transparent text-muted hover:text-ink"
+ )}
+ >
+
+ {locale === "ru" ? "Среда сборки & SDK" : "Environment & SDK"}
+
+
+
+ {/* TAB 0: INSTALLED MODULES */}
+ {activeTab === "installed" && (
+
+
+
+
+ {locale === "ru"
+ ? "Установленные модули и динамические плагины сервера. Включайте, выключайте и настраивайте параметры каждого модуля."
+ : "Installed server modules and dynamic DLL plugins. Enable, disable, and configure parameters for each module."}
+
+
+ {changed && (
+
+ {t("mod.restart")}
+
+ )}
+
+
+
+ {modules === null && !error && (
+
+
+ {t("overview.checking")}
+
+ )}
+ {modules !== null && installedModules.length === 0 && (
+
+
+ {locale === "ru" ? "Нет установленных модулей" : "No installed modules"}
+
+
+ {locale === "ru"
+ ? "Выберите модули из Каталога или укажите ссылку на GitHub выше для установки."
+ : "Choose modules from the Catalog or provide a GitHub URL above to install."}
+
+ setActiveTab("catalog")}
+ className="mt-2 text-xs"
+ >
+
+ {locale === "ru" ? "Открыть каталог модулей" : "Open Modules Catalog"}
+
+
+ )}
+ {installedModules.map((m, i) => {
+ const isDynamic = m.component_type === "DYNAMIC_DLL" || (!OFFICIAL_IDS.has(m.id) && (installedPlugins.some((p) => p.id === m.id) || m.id.length === 40));
+ const canRemove = m.can_remove ?? isDynamic;
+ return (
+
+
+
+
+
+
+
{cleanModuleName(m.name, m.id)}
+ {m.version && (
+ {m.version}
+ )}
+
+ {m.component_type === "DYNAMIC_DLL" && (
+
+ DLL
+
+ )}
+ {m.component_type === "CORE_EMBEDDED" && (
+
+ EMBEDDED
+
+ )}
+ {m.component_type === "CONTENT_PACK" && (
+
+ CONTENT
+
+ )}
+ {m.component_type === "CLIENT_PATCH" && (
+
+ CLIENT PATCH
+
+ )}
+
+
+ {m.description[locale] ?? m.description.en}
+
+ {m.id === "companions" && (
+
+ {locale === "ru"
+ ? "Взаимоисключение: не работает одновременно со SQUID's Playerbots."
+ : "Mutual exclusion: cannot run concurrently with SQUID's Playerbots."}
+
+ )}
+ {(m.id === "playerbots" || m.id === "squid") && (
+
+ {locale === "ru"
+ ? "Взаимоисключение: отключает CoA Companions при активации."
+ : "Mutual exclusion: disables CoA Companions upon activation."}
+
+ )}
+
+ {m.installed && m.switchable && (
+
void toggleOfficialModule(m)}
+ className={cn(
+ "relative mt-1 h-6 w-11 shrink-0 cursor-pointer rounded-full transition-colors",
+ m.enabled ? "bg-gold" : "bg-white/15",
+ m.id === "custom-races" && racesInstalling && "opacity-50 cursor-not-allowed"
+ )}
+ >
+
+
+ )}
+ {m.installed && !m.switchable && m.status !== "soon" && (
+
{t("mod.alwaysOn")}
+ )}
+
+
+ {toggling === m.id && (
+
+
+ {t("mod.switching")}
+
+ )}
+
+ {/* Custom Races Client Patch status & actions */}
+ {m.id === "custom-races" && (
+
+
+ {locale === "ru"
+ ? "Установленная версия патча клиента: "
+ : "Installed client patch version: "}
+ {racesPatchStatus?.version ?? (locale === "ru" ? "не записана" : "not recorded")}
+
+ {racesInstalling && racesProgress ? (
+
+
+
+
+ {racesProgress.step}
+
+
+ {Math.round(racesProgress.percent * 100)}%
+
+
+
+
+ ) : (
+
+
+ {racesPatchStatus?.state === "enabled" && (
+
+
+ {locale === "ru" ? "Патч клиента: Включен" : "Client Patch: Active"}
+
+ )}
+ {racesPatchStatus?.state === "disabled" && (
+
+
+ {locale === "ru"
+ ? "Патч клиента: Отключен (.disabled)"
+ : "Client Patch: Disabled (.disabled)"}
+
+ )}
+ {racesPatchStatus?.state === "not-installed" && (
+
+
+ {locale === "ru" ? "Патч клиента: Не установлен" : "Client Patch: Not Installed"}
+
+ )}
+ {racesPatchStatus?.state === "partially-installed" && (
+
+
+ {locale === "ru"
+ ? `Патч клиента: ${racesPatchStatus.installedMpqs}/${racesPatchStatus.totalMpqs} MPQ`
+ : `Client Patch: ${racesPatchStatus.installedMpqs}/${racesPatchStatus.totalMpqs} MPQ`}
+
+ )}
+
+
+ void installClientPatch()}
+ >
+ {racesInstalling && }
+ {racesPatchStatus?.state === "not-installed"
+ ? locale === "ru"
+ ? "Установить патч клиента"
+ : "Install Client Patch"
+ : locale === "ru"
+ ? "Восстановить патч клиента"
+ : "Repair Client Patch"}
+
+ {racesPatchStatus && racesPatchStatus.state !== "not-installed" && (
+ void uninstallClientPatch()}
+ className="text-xs"
+ >
+ {locale === "ru" ? "Удалить патч клиента" : "Uninstall Client Patch"}
+
+ )}
+
+
+ {locale === "ru"
+ ? m.enabled
+ ? "После установки патч будет включён."
+ : "После установки патч останется отключённым: модуль сервера выключен или отсутствует."
+ : m.enabled
+ ? "The patch will be enabled after installation."
+ : "The patch will stay disabled after installation: the server module is off or missing."}
+
+
+ )}
+
+ )}
+
+
+
+ void api.openLink(m.repo)}
+ title={t("mod.github")}
+ aria-label={`${t("mod.github")}: ${m.name}`}
+ className="flex h-7 w-7 cursor-pointer items-center justify-center rounded-md border border-line text-muted transition-colors hover:border-gold/50 hover:text-ink"
+ >
+
+
+ {!m.page && m.installed && m.has_settings && m.status !== "soon" && (
+ setOpenSettings(openSettings === m.id ? null : m.id)}
+ className={cn("text-xs h-7 px-2.5", openSettings === m.id && "bg-gold/15 text-gold border border-gold/40")}
+ >
+ {t("mod.settings")}
+
+ )}
+
+
+ {canRemove && (
+
removePlugin(m.id)}
+ disabled={actionInProgress === `remove-${m.id}`}
+ className="text-bad hover:text-bad hover:bg-bad/10 text-xs h-7 px-2"
+ >
+
+ {locale === "ru" ? "Удалить" : "Remove"}
+
+ )}
+
+
+
+ {/* Inline settings drawer */}
+ {selectedModule?.has_settings &&
+ !selectedModule.page &&
+ selectedModuleIndex >= 0 &&
+ Math.floor(selectedModuleIndex / 2) === Math.floor(i / 2) &&
+ (i % 2 === 1 || i === installedModules.length - 1) && (
+
+
+
+
+ {t("mod.settingsOf", { name: selectedModule.name })}
+
+ setOpenSettings(null)}
+ className="text-muted hover:text-ink text-xs flex items-center gap-1"
+ >
+
+
+
+ setChanged(true)}
+ onRegisterGuard={setGuard}
+ />
+ {selectedModule.id === "custom-races" && (
+ setChanged(true)}
+ onRegisterGuard={setRacesGuard}
+ />
+ )}
+
+ )}
+
+ );
+ })}
+
+
+ )}
+
+ {/* TAB 1: AZEROTHCORE & COA MODULE CATALOG */}
+ {activeTab === "catalog" && (
+
+ {/* Top header & offline/refresh bar */}
+
+
+
+
+ {locale === "ru" ? "Каталог модулей AzerothCore & CoA" : "AzerothCore & CoA Module Catalogue"}
+
+
+ {locale === "ru"
+ ? "Рекомендованные модули Conquest of Azeroth и публичный каталог сообщества AzerothCore (500+ модулей)."
+ : "Curated Conquest of Azeroth modules alongside the official AzerothCore community catalog (500+ modules)."}
+
+
+
+
+ void loadPublicCatalog(true)}
+ disabled={publicLoading}
+ className="text-xs h-7 px-2.5 text-muted hover:text-ink border border-line"
+ title={locale === "ru" ? "Принудительно обновить каталог из сети" : "Force refresh catalogue from remote"}
+ >
+
+ {locale === "ru" ? "Обновить каталог" : "Refresh"}
+
+
+
+
+ {/* Offline notice banner */}
+ {publicCatalog?.is_offline && (
+
+
+
+
+ {locale === "ru"
+ ? `Автономный режим: официальный каталог загружен из локального кэша (${formatDate(publicCatalog.cached_at)})`
+ : `Offline mode: official catalog loaded from local cache (${formatDate(publicCatalog.cached_at)})`}
+
+
+
void loadPublicCatalog(true)}
+ disabled={publicLoading}
+ className="h-6 text-xs text-amber-300 hover:text-white"
+ >
+
+ {locale === "ru" ? "Повторить" : "Retry"}
+
+
+ )}
+
+ {/* Catalog error notice */}
+ {publicError && (
+
+ {publicError}
+ void loadPublicCatalog(true)}
+ disabled={publicLoading}
+ className="h-6 text-xs text-bad hover:text-white"
+ >
+ {locale === "ru" ? "Повторить" : "Retry"}
+
+
+ )}
+
+ {/* Controls: Filter pills, Search, Sort */}
+
+ {/* Filter pills */}
+
+
setCatalogFilter("all")}
+ className={cn(
+ "rounded-full px-2.5 py-1 transition-colors",
+ catalogFilter === "all" ? "bg-gold text-black font-semibold" : "bg-black/30 text-muted hover:text-ink"
+ )}
+ >
+ {locale === "ru" ? "Все" : "All"} ({filteredVerifiedCatalog.length + filteredCommunityCatalog.length})
+
+
setCatalogFilter("recommended")}
+ className={cn(
+ "rounded-full px-2.5 py-1 transition-colors flex items-center gap-1",
+ catalogFilter === "recommended" ? "bg-gold/90 text-black font-semibold" : "bg-black/30 text-muted hover:text-ink"
+ )}
+ >
+
+ {locale === "ru" ? "Рекомендовано CoA" : "CoA Recommended"}
+
+
setCatalogFilter("official")}
+ className={cn(
+ "rounded-full px-2.5 py-1 transition-colors",
+ catalogFilter === "official" ? "bg-sky-400 text-black font-semibold" : "bg-black/30 text-muted hover:text-ink"
+ )}
+ >
+ {locale === "ru" ? "Официальные ядра" : "Official Core"} ({VERIFIED_CATALOG.filter((c) => c.isOfficial).length})
+
+
setCatalogFilter("verified")}
+ className={cn(
+ "rounded-full px-2.5 py-1 transition-colors",
+ catalogFilter === "verified" ? "bg-ok text-black font-semibold" : "bg-black/30 text-muted hover:text-ink"
+ )}
+ >
+ {locale === "ru" ? "Проверенные DLL" : "Verified DLLs"} ({VERIFIED_CATALOG.filter((c) => !c.isOfficial).length})
+
+
setCatalogFilter("community")}
+ className={cn(
+ "rounded-full px-2.5 py-1 transition-colors",
+ catalogFilter === "community" ? "bg-teal-400 text-black font-semibold" : "bg-black/30 text-muted hover:text-ink"
+ )}
+ >
+ {locale === "ru" ? "Сообщество AC" : "AC Community"}
+
+
setCatalogFilter("incompatible")}
+ className={cn(
+ "rounded-full px-2.5 py-1 transition-colors flex items-center gap-1",
+ catalogFilter === "incompatible" ? "bg-warn text-black font-semibold" : "bg-black/30 text-muted hover:text-ink"
+ )}
+ >
+
+ {locale === "ru" ? "Несовместимые" : "Incompatible / Blocked"}
+
+
+
+ {/* Search and Sort */}
+
+
+
+ setCatalogQuery(e.target.value)}
+ placeholder={
+ locale === "ru"
+ ? "Поиск по каталогу (название, автор, тег)..."
+ : "Search catalogue (name, author, topic)..."
+ }
+ className="w-full rounded-md border border-line bg-bg pl-8 pr-3 py-1.5 text-xs text-ink placeholder:text-muted/60 focus:border-gold focus:outline-none"
+ />
+
+
+
setCatalogSort(e.target.value as "stars" | "name" | "updated")}
+ className="rounded-md border border-line bg-bg px-2.5 py-1.5 text-xs text-ink focus:border-gold focus:outline-none"
+ >
+ ★ {locale === "ru" ? "По звёздам" : "By Stars"}
+ 🕒 {locale === "ru" ? "По обновлению" : "Recently Updated"}
+ 🔤 {locale === "ru" ? "По имени (A-Z)" : "Name (A-Z)"}
+
+
+
+
+ {/* GROUP A: RECOMMENDED FOR COA (ALWAYS ON TOP) */}
+ {filteredVerifiedCatalog.length > 0 && (
+
+
+
+
+
+ {locale === "ru" ? "Группа A: Рекомендовано для CoA" : "Group A: Recommended for CoA"}
+
+
+ {filteredVerifiedCatalog.length}
+
+
+
+ {locale === "ru" ? "Проверенная интеграция и поддержка CoA" : "Verified compatibility with CoA"}
+
+
+
+
+ {filteredVerifiedCatalog.map((item) => {
+ const matchedModule = modules?.find(
+ (m) => m.id === item.id || m.name.toLowerCase() === item.name.toLowerCase()
+ );
+ const isInstalled = Boolean(matchedModule?.installed);
+ const isEnabled = Boolean(matchedModule?.enabled);
+
+ return (
+
+
+
+
+
+
+
+
{item.name}
+
+ ★ CoA
+
+
+
({item.id})
+
{locale === "ru" ? item.description.ru : item.description.en}
+
+
+
+
+ {/* Qualification Badges */}
+
+ {item.isOfficial ? (
+
+ ✓ OFFICIAL_CORE
+
+ ) : item.qualification === "INSTALL_VERIFIED" ? (
+
+ ✓ INSTALL_VERIFIED
+
+ ) : item.qualification === "LINK_VERIFIED" ? (
+
+ ✓ LINK_VERIFIED
+
+ ) : (
+
+ ● BUILT
+
+ )}
+
+ {item.tier}
+ {item.sqlRequired && (
+ SQL
+ )}
+
+
+
+ {locale === "ru" ? item.notes.ru : item.notes.en}
+
+
+
+
+
void api.openLink(item.repo)}
+ className="flex items-center gap-1.5 text-xs text-muted hover:text-ink"
+ >
+
+ GitHub
+
+
+
+
setSelectedCatalogModule(item)}
+ className="text-xs h-7 px-2"
+ >
+
+ {locale === "ru" ? "Подробнее" : "Details"}
+
+
+ {isInstalled ? (
+
+
+ ✓ {locale === "ru" ? (isEnabled ? "Включен" : "Установлен") : (isEnabled ? "Active" : "Installed")}
+
+ {
+ if (matchedModule) {
+ setOpenSettings(matchedModule.id);
+ }
+ setActiveTab("installed");
+ }}
+ className="text-xs h-7 px-2.5 border border-gold/40 text-gold hover:bg-gold/10"
+ >
+
+ {locale === "ru" ? "Настроить" : "Configure"}
+
+
+ ) : item.isOfficial ? (
+
{
+ try {
+ const mod = modules?.find((m) => m.id === item.id);
+ if (mod && mod.enabled) {
+ setOpenSettings(mod.id);
+ setActiveTab("installed");
+ return;
+ }
+ await api.moduleSetEnabled(serverId, item.id, true);
+ setChanged(true);
+ await load();
+ setOpenSettings(item.id);
+ setActiveTab("installed");
+ onChanged?.();
+ } catch (e) {
+ setError(asUiError(e));
+ }
+ }}
+ className="text-xs h-7 px-3"
+ >
+
+ {locale === "ru" ? "Включить" : "Enable"}
+
+ ) : (
+
{
+ setGithubUrl(item.repo);
+ await runAnalysis(item.repo);
+ await startControlledBuild(item.repo);
+ }}
+ className="text-xs h-7 px-3"
+ >
+
+ {locale === "ru" ? "Собрать и установить" : "Build & Install"}
+
+ )}
+
+
+
+ );
+ })}
+
+
+ )}
+
+ {/* GROUP B: AZEROTHCORE COMMUNITY MODULES */}
+
+
+
+
+
+ {locale === "ru" ? "Группа B: Каталог сообщества AzerothCore" : "Group B: AzerothCore Community Modules"}
+
+
+ {filteredCommunityCatalog.length}
+
+
+
+ {locale === "ru" ? "Официальный каталог azerothcore.org" : "Official azerothcore.org catalogue"}
+
+
+
+ {publicLoading && !publicCatalog && (
+
+
+ {locale === "ru" ? "Загрузка каталога AzerothCore..." : "Loading AzerothCore catalogue..."}
+
+ )}
+
+ {filteredCommunityCatalog.length === 0 && !publicLoading && (
+
+ {locale === "ru" ? "Модули сообщества по заданным фильтрам не найдены." : "No community modules match the active filters."}
+
+ )}
+
+
+ {filteredCommunityCatalog.slice(0, communityDisplayLimit).map((item) => {
+ const status = checkModuleInstalled(item.html_url, item.name);
+ const isBlocked = item.coa_status === "Blocked";
+ const isIncompatible = item.coa_status === "Incompatible";
+
+ return (
+
+
+ {/* Card Header: Icon, Name, Metrics */}
+
+
+
+
+
+ {item.name}
+
+
{item.id}
+
+ {item.description || (locale === "ru" ? "Нет описания репозитория." : "No description provided.")}
+
+
+
+
+
+ {/* Status and Metric Badges */}
+
+
+
+
+
+ {item.stars}
+
+
+
+
+ {item.forks}
+
+
+ {item.category && (
+
+ {item.category}
+
+ )}
+
+ {item.license_spdx && (
+
+ {item.license_spdx}
+
+ )}
+
+
+ {/* Conflict / Engineering Notes */}
+ {item.conflict_reason ? (
+
+
+ {item.conflict_reason}
+
+ ) : item.coa_notes ? (
+
+ {item.coa_notes}
+
+ ) : item.topics.length > 0 ? (
+
+ {item.topics.slice(0, 3).map((topic) => (
+
+ #{topic}
+
+ ))}
+
+ ) : null}
+
+
+ {/* Card Footer: GitHub Link, Details, Action */}
+
+
void api.openLink(item.html_url)}
+ className="flex items-center gap-1.5 text-xs text-muted hover:text-ink"
+ >
+
+ GitHub
+
+
+
+
setSelectedPublicModule(item)}
+ className="text-xs h-7 px-2"
+ >
+
+ {locale === "ru" ? "Подробнее" : "Details"}
+
+
+ {status.installed ? (
+
+
+ ✓ {locale === "ru" ? (status.enabled ? "Включен" : "Установлен") : (status.enabled ? "Active" : "Installed")}
+
+ setActiveTab("installed")}
+ className="text-xs h-7 px-2.5 border border-gold/40 text-gold hover:bg-gold/10"
+ >
+
+ {locale === "ru" ? "Настроить" : "Configure"}
+
+
+ ) : isBlocked ? (
+
+
+ {locale === "ru" ? "Заблокирован" : "Blocked"}
+
+ ) : (
+
{
+ setGithubUrl(item.html_url);
+ await runAnalysis(item.html_url);
+ await startControlledBuild(item.html_url);
+ }}
+ className={cn(
+ "text-xs h-7 px-3",
+ isIncompatible && "bg-warn/80 hover:bg-warn text-black"
+ )}
+ >
+
+ {isIncompatible
+ ? locale === "ru"
+ ? "Собрать (с риском)"
+ : "Build (Risky)"
+ : locale === "ru"
+ ? "Собрать и установить"
+ : "Build & Install"}
+
+ )}
+
+
+
+ );
+ })}
+
+
+ {/* Pagination / Load more button */}
+ {filteredCommunityCatalog.length > communityDisplayLimit && (
+
+ setCommunityDisplayLimit((prev) => prev + 24)}
+ className="text-xs border border-line px-4"
+ >
+ {locale === "ru" ? "Показать ещё (+24 модуля)" : "Load More (+24 modules)"}
+
+
+ {locale === "ru"
+ ? `Показано ${Math.min(communityDisplayLimit, filteredCommunityCatalog.length)} из ${filteredCommunityCatalog.length}`
+ : `Showing ${Math.min(communityDisplayLimit, filteredCommunityCatalog.length)} of ${filteredCommunityCatalog.length}`}
+
+
+ )}
+
+
+ {/* Details Modal for Verified Modules */}
+ {selectedCatalogModule && (
+
+
+
+
+ {selectedCatalogModule.name}
+ ({selectedCatalogModule.id})
+
+ setSelectedCatalogModule(null)} className="text-muted hover:text-ink">
+
+
+
+
+
+
+
{locale === "ru" ? "Описание:" : "Description:"}
+
+ {locale === "ru" ? selectedCatalogModule.description.ru : selectedCatalogModule.description.en}
+
+
+
+
+
+ {locale === "ru" ? "Уровень верификации:" : "Verification Level:"}
+ {selectedCatalogModule.verificationLevel}
+
+
+ {locale === "ru" ? "Уровень архитектуры:" : "Architecture Tier:"}
+ {selectedCatalogModule.tier}
+
+
+
+
+
+ {locale === "ru" ? "Инженерные примечания и статус:" : "Engineering Notes & Status:"}
+
+
+ {locale === "ru" ? selectedCatalogModule.notes.ru : selectedCatalogModule.notes.en}
+
+
+
+
+
+ setSelectedCatalogModule(null)}>
+ {locale === "ru" ? "Закрыть" : "Close"}
+
+ {selectedCatalogModule.canInstall && (
+ {
+ const repo = selectedCatalogModule.repo;
+ const isOff = selectedCatalogModule.isOfficial;
+ const modId = selectedCatalogModule.id;
+ setSelectedCatalogModule(null);
+ if (isOff) {
+ try {
+ const m = modules?.find((x) => x.id === modId);
+ if (m && m.enabled) {
+ setOpenSettings(m.id);
+ setActiveTab("installed");
+ return;
+ }
+ await api.moduleSetEnabled(serverId, modId, true);
+ setChanged(true);
+ await load();
+ setOpenSettings(modId);
+ setActiveTab("installed");
+ onChanged?.();
+ } catch (e) {
+ setError(asUiError(e));
+ }
+ } else {
+ setGithubUrl(repo);
+ await runAnalysis(repo);
+ await startControlledBuild(repo);
+ }
+ }}
+ >
+
+ {selectedCatalogModule.isOfficial
+ ? locale === "ru"
+ ? "Включить модуль"
+ : "Enable Module"
+ : locale === "ru"
+ ? "Перейти к сборке"
+ : "Proceed to Build"}
+
+ )}
+
+
+
+ )}
+
+ {/* Details Modal for Public Community Modules */}
+ {selectedPublicModule && (
+
+
+
+
+
+ {selectedPublicModule.name}
+
+ {selectedPublicModule.id}
+
+
setSelectedPublicModule(null)} className="text-muted hover:text-ink">
+
+
+
+
+
+
+
{locale === "ru" ? "Описание:" : "Description:"}
+
+ {selectedPublicModule.description || (locale === "ru" ? "Нет описания." : "No description.")}
+
+
+
+ {/* Metadata grid */}
+
+
+ {locale === "ru" ? "Звёзды" : "Stars"}
+
+
+ {selectedPublicModule.stars}
+
+
+
+
+ {locale === "ru" ? "Форки" : "Forks"}
+
+
+ {selectedPublicModule.forks}
+
+
+
+
+ {locale === "ru" ? "Лицензия" : "License"}
+
+ {selectedPublicModule.license_spdx || "—"}
+
+
+
+
+ {locale === "ru" ? "Обновлён" : "Pushed"}
+
+ {formatDate(selectedPublicModule.pushed_at)}
+
+
+
+
+ {/* Compatibility status */}
+
+
+
+ {locale === "ru" ? "Совместимость с Conquest of Azeroth:" : "CoA Compatibility Status:"}
+
+
+
+
+ {selectedPublicModule.conflict_reason && (
+
+
{locale === "ru" ? "Причина блокировки / конфликта:" : "Conflict / Block Reason:"}
+
{selectedPublicModule.conflict_reason}
+
+ )}
+
+ {selectedPublicModule.coa_notes && (
+
+ {selectedPublicModule.coa_notes}
+
+ )}
+
+
+ {/* Topics */}
+ {selectedPublicModule.topics.length > 0 && (
+
+
{locale === "ru" ? "Темы (Topics):" : "Topics:"}
+
+ {selectedPublicModule.topics.map((t) => (
+
+ #{t}
+
+ ))}
+
+
+ )}
+
+
+
+
void api.openLink(selectedPublicModule.html_url)}
+ className="text-xs"
+ >
+
+ {locale === "ru" ? "Открыть на GitHub" : "View on GitHub"}
+
+
+
+ setSelectedPublicModule(null)}>
+ {locale === "ru" ? "Закрыть" : "Close"}
+
+
+ {selectedPublicModule.coa_status !== "Blocked" && (
+ {
+ const url = selectedPublicModule.html_url;
+ setSelectedPublicModule(null);
+ setGithubUrl(url);
+ await runAnalysis(url);
+ await startControlledBuild(url);
+ }}
+ className={cn(
+ "text-xs",
+ selectedPublicModule.coa_status === "Incompatible" && "bg-warn/80 hover:bg-warn text-black"
+ )}
+ >
+
+ {selectedPublicModule.coa_status === "Incompatible"
+ ? locale === "ru"
+ ? "Собрать (с риском)"
+ : "Build (Risky)"
+ : locale === "ru"
+ ? "Собрать и установить"
+ : "Build & Install"}
+
+ )}
+
+
+
+
+ )}
+
+ )}
+
+ {/* TAB 4: BUILDS & MSVC LOGS */}
+ {activeTab === "builds" && (
+
+ {/* Build Result Card */}
+ {buildResult && (
+
+
+
+ {buildResult.success ? (
+
+ ) : (
+
+ )}
+
+
+ {buildResult.display_name || buildResult.module_name} ({buildResult.duration_seconds.toFixed(1)}s)
+
+
+ {buildResult.success
+ ? `DLL Qualified: ${buildResult.dll_sha256?.substring(0, 24)}... (x64 /MD)`
+ : `Build failed with ${buildResult.errors.length} diagnostic error(s)`}
+
+
+
+
+ {buildResult.success && (
+
+ {locale === "ru" ? "Установить в реалм" : "Install to Realm"}
+
+ )}
+
+
+ {/* Error diagnostics */}
+ {buildResult.errors.length > 0 && (
+
+
MSVC Compiler / Linker Errors:
+
+
+ )}
+
+ )}
+
+ {/* Real-time Terminal Output */}
+
+
+
+
+ MSVC / CMake Build Output
+
+ {buildLogs.length} lines
+
+
+ {buildLogs.length === 0
+ ? "No build logs recorded yet. Start a build from the 'GitHub' tab."
+ : buildLogs.join("\n")}
+
+
+
+ )}
+
+ {/* TAB 5: TOOLCHAIN & ENVIRONMENT */}
+ {activeTab === "toolchain" && toolchain && (
+
+
+ {locale === "ru" ? "Среда компиляции и Plugin SDK" : "Compilation Environment & Plugin SDK"}
+
+
+ {locale === "ru"
+ ? "Controlled Build Engine использует изолированные рецепты сборки, MSVC x64 и заголовки SDK v0.3. Исходные CMakeLists.txt модулей не исполняются."
+ : "Controlled Build Engine uses isolated build recipes, MSVC x64 compiler, and SDK v0.3 headers. Upstream CMakeLists.txt is never executed."}
+
+
+
+
+ MSVC Toolchain (vcvars64.bat)
+ {toolchain.vcvars64_path || "NOT FOUND"}
+
+
+ CMake Executable
+ {toolchain.cmake_path || "NOT FOUND"}
+
+
+ Ninja Build Driver
+ {toolchain.ninja_path || "NOT FOUND"}
+
+
+ CoA Plugin SDK Directory
+ {toolchain.sdk_dir || "NOT FOUND"}
+
+
+ Host SDK ABI Fingerprint
+ {toolchain.sdk_abi_fingerprint || "UNKNOWN"}
+
+
+
+ )}
+
+ {/* SQL Review & Confirmation Dialog Modal */}
+ {showSqlDialog && (
+
+
+
+
+
+ {locale === "ru" ? "Проверка SQL-миграций" : "SQL Migrations Review"}
+
+
+
+ {locale === "ru"
+ ? "Этот модуль содержит SQL-файлы данных или структуры. MySQL DDL не поддерживает откат через обычные транзакции."
+ : "This module contains SQL structure or data files. MySQL DDL does not support rollback via standard transactions."}
+
+
+ {report && (
+
+
+
+ {locale === "ru" ? "Файлы миграций:" : "Migration Files:"}
+
+
+ {report.sql_files.map((s, idx) => (
+
+ • {s.file_path} ({s.statement_count} statements)
+
+ ))}
+
+
+
+
+
+
+ {locale === "ru"
+ ? "Миграции будут применены к тестовой БД реалма. Удаление плагина сохранит таблицы нетронутыми."
+ : "Migrations will be applied to the realm test DB. Removing the plugin will preserve tables."}
+
+
+
+ )}
+
+
+ setShowSqlDialog(false)}>
+ {locale === "ru" ? "Отмена" : "Cancel"}
+
+ performInstall(true)}>
+ {locale === "ru" ? "Подтвердить и применить SQL" : "Confirm and Apply SQL"}
+
+
+
+
+ )}
+
+ );
+}
+
+/** Settings sub-component for official modules */
+function ModuleSettings({
+ serverId,
+ module,
+ onSaved,
+ onRegisterGuard,
+}: {
+ serverId: string;
+ module: ModuleView;
+ onSaved: () => void;
+ onRegisterGuard?: (guard: UnsavedChangesGuard | null) => void;
+}) {
+ const { t, tn, locale } = useI18n();
+ const sx = useSchemaText();
+ const human = useHuman();
+ const [advanced, setAdvanced] = useState(false);
+ const [items, setItems] = useState