mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-01 13:14:30 +01:00
* Plugins can now build apps * fix tests * fixup * pluginize existing apps * Test fixes part 1 * Test fixes part 2 * Fix Crowdfund namespace * Syntax * More namespace fixes * Markup * Test fix * upstream fixes * Add plugin icon * Fix nullable build warnings * allow pre popualting app creation * Fixes after merge * Make link methods async * Use AppData as parameter for ConfigureLink * GetApps by AppType * Use ConfigureLink on dashboard * Rename method * Add properties to indicate stats support * Property updates * Test fixes * Clean up imports * Fixes after merge --------- Co-authored-by: Dennis Reimann <mail@dennisreimann.de>
66 lines
2.2 KiB
Plaintext
66 lines
2.2 KiB
Plaintext
@using BTCPayServer.Plugins.Crowdfund
|
|
@model BTCPayServer.Components.AppTopItems.AppTopItemsViewModel
|
|
@{
|
|
var label = Model.AppType == CrowdfundApp.AppType ? "contribution" : "sale";
|
|
}
|
|
|
|
<div id="AppTopItems-@Model.Id" class="widget app-top-items">
|
|
<header class="mb-3">
|
|
<h3>Top @(Model.AppType == CrowdfundApp.AppType ? "Perks" : "Items")</h3>
|
|
@if (!string.IsNullOrEmpty(Model.AppUrl))
|
|
{
|
|
<a href="@Model.AppUrl">View All</a>
|
|
}
|
|
</header>
|
|
@if (Model.InitialRendering)
|
|
{
|
|
<div class="loading d-flex justify-content-center p-3">
|
|
<div class="spinner-border text-light" role="status">
|
|
<span class="visually-hidden">Loading...</span>
|
|
</div>
|
|
</div>
|
|
<script src="~/Components/AppTopItems/Default.cshtml.js" asp-append-version="true"></script>
|
|
<script>
|
|
(async () => {
|
|
const url = @Safe.Json(Model.DataUrl);
|
|
const appId = @Safe.Json(Model.Id);
|
|
const response = await fetch(url);
|
|
if (response.ok) {
|
|
document.getElementById(`AppTopItems-${appId}`).outerHTML = await response.text();
|
|
const data = document.querySelector(`#AppSales-${appId} template`);
|
|
if (data) window.appSales.dataLoaded(JSON.parse(data.innerHTML));
|
|
}
|
|
})();
|
|
</script>
|
|
}
|
|
else if (Model.Entries.Any())
|
|
{
|
|
<div class="ct-chart mb-3"></div>
|
|
<template>
|
|
@Safe.Json(Model)
|
|
</template>
|
|
<div class="app-items">
|
|
@for (var i = 0; i < Model.Entries.Count; i++)
|
|
{
|
|
var entry = Model.Entries[i];
|
|
<div class="app-item ct-series-@i">
|
|
<span class="app-item-name">
|
|
<span class="app-item-point ct-point"></span>
|
|
@entry.Title
|
|
</span>
|
|
<span class="app-item-value">
|
|
<span class="text-muted">@entry.SalesCount @($"{label}{(entry.SalesCount == 1 ? "" : "s")}"),</span>
|
|
@entry.TotalFormatted
|
|
</span>
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<p class="text-secondary mt-3">
|
|
No @($"{label}s") have been made yet.
|
|
</p>
|
|
}
|
|
</div>
|