mining
This commit is contained in:
@@ -14,25 +14,55 @@ $fxApiKey = (string) ($fxConfig['api_key'] ?? '');
|
||||
$fxApiKeyMasked = $fxApiKey === ''
|
||||
? ''
|
||||
: (strlen($fxApiKey) <= 10 ? $fxApiKey : substr($fxApiKey, 0, 6) . '...' . substr($fxApiKey, -4));
|
||||
$sectionsJson = json_encode(is_array($design['sections'] ?? null) ? $design['sections'] : [], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
$sections = is_array($design['sections'] ?? null) ? $design['sections'] : [];
|
||||
$activeView = trim((string) ($_GET['view'] ?? 'overview'));
|
||||
$allowedViews = [];
|
||||
$tabs = [];
|
||||
foreach ($sections as $section) {
|
||||
if (!is_array($section)) {
|
||||
continue;
|
||||
}
|
||||
$key = trim((string) ($section['key'] ?? ''));
|
||||
$label = trim((string) ($section['label'] ?? ''));
|
||||
if ($key === '' || $label === '') {
|
||||
continue;
|
||||
}
|
||||
$allowedViews[] = $key;
|
||||
$tabs[] = [
|
||||
'label' => $label,
|
||||
'href' => '/module/mining-checker?view=' . rawurlencode($key),
|
||||
'active' => $activeView === $key,
|
||||
];
|
||||
}
|
||||
if ($allowedViews === []) {
|
||||
$allowedViews = ['overview'];
|
||||
}
|
||||
if (!in_array($activeView, $allowedViews, true)) {
|
||||
$activeView = $allowedViews[0];
|
||||
foreach ($tabs as &$tab) {
|
||||
$tab['active'] = str_ends_with((string) ($tab['href'] ?? ''), 'view=' . $activeView);
|
||||
}
|
||||
unset($tab);
|
||||
}
|
||||
$sectionsJson = json_encode($sections, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
$moduleCss = file_get_contents(dirname(__DIR__) . '/assets/css/app.css') ?: '';
|
||||
$moduleJs = file_get_contents(dirname(__DIR__) . '/assets/js/app.js') ?: '';
|
||||
$moduleJs = str_replace('</script>', '<\/script>', $moduleJs);
|
||||
?>
|
||||
<?= module_shell_header('mining-checker', [
|
||||
'title' => 'DOGE Mining-Checker',
|
||||
'tabs' => $tabs,
|
||||
]) ?>
|
||||
<div class="module-flow">
|
||||
<div class="module-box mining-checker-host">
|
||||
<div id="mining-checker-app"
|
||||
data-default-project-key="<?= e($defaultProjectKey) ?>"
|
||||
data-api-base="/api/mining-checker/v1"
|
||||
data-fx-provider="<?= e($fxProvider) ?>"
|
||||
data-fx-url="<?= e($fxBaseUrl) ?>"
|
||||
data-fx-currencies-url="<?= e($fxCurrenciesUrl) ?>"
|
||||
data-fx-api-key-mask="<?= e($fxApiKeyMasked) ?>"
|
||||
data-sections-json="<?= e(is_string($sectionsJson) ? $sectionsJson : '[]') ?>"></div>
|
||||
</div>
|
||||
<div id="mining-checker-app"
|
||||
data-default-project-key="<?= e($defaultProjectKey) ?>"
|
||||
data-api-base="/api/mining-checker/v1"
|
||||
data-fx-provider="<?= e($fxProvider) ?>"
|
||||
data-fx-url="<?= e($fxBaseUrl) ?>"
|
||||
data-fx-currencies-url="<?= e($fxCurrenciesUrl) ?>"
|
||||
data-fx-api-key-mask="<?= e($fxApiKeyMasked) ?>"
|
||||
data-active-view="<?= e($activeView) ?>"
|
||||
data-sections-json="<?= e(is_string($sectionsJson) ? $sectionsJson : '[]') ?>"></div>
|
||||
</div>
|
||||
<style><?= $moduleCss ?></style>
|
||||
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user