Files
MeterVault/src/App/Format.cs
T
schmidt.florian d5419729e5 M5: Blazor dashboard (MudBlazor + ApexCharts)
- MudBlazor theme (dark default) + responsive drawer/appbar layout + nav.
- DashboardService read model: KPIs with period-over-period deltas, category breakdown,
  "what cost more/less" difference view, monthly trends.
- Pages: Overview (KPI cards + DeltaChip + donut + difference table), Trends (range-select
  bar chart), Meters (list + source status), Import (load reference dataset + CSV dry-run
  preview), Admin (energy types, tariffs). Charts isolated into components to avoid the
  ApexCharts/MudBlazor Color/Format name clashes.
- ReferenceDataImporter: one-click load of all four sheets as a starter dataset (meters,
  tank, tariff history, category memberships) — bundled sample CSVs copied to app output.
- End-to-end render test: import creates meters + consumption; overview/meters/trends/
  import/admin pages all return 200 with KPI cards rendered.

92 tests green (56 Core + 36 integration).

Deferred to polish: dedicated PV & oil/consumable panels, meter-detail page, full admin
CRUD, prev-year trend overlay.

Claude-Session: https://claude.ai/code/session_01WujdMtMJPbxDpDnMeK22rr
2026-07-13 12:11:12 +02:00

25 lines
803 B
C#

using System.Globalization;
namespace MeterVault.App;
/// <summary>Small display formatters for the UI (locale-aware formatting arrives with i18n in M7).</summary>
public static class Format
{
private static readonly CultureInfo Culture = CultureInfo.GetCultureInfo("de-DE");
public static string Euro(double value) => value.ToString("N2", Culture) + " €";
public static string Number(double value, int decimals = 0) =>
value.ToString("N" + decimals.ToString(CultureInfo.InvariantCulture), Culture);
public static string Percent(double value) =>
(value >= 0 ? "+" : "") + value.ToString("N1", Culture) + " %";
public static string DirectionIcon(int direction) => direction switch
{
> 0 => "▲",
< 0 => "▼",
_ => "—",
};
}