feat: Phase 0 shells, design system, server skeleton, Docker and CI
- Titano.Ui: DESIGN.md tokens (dark/light), generated 16-px icon set, styles for all standard controls, custom chrome window with snap layouts, rail, job bar, Auto/manual slider, chips, toasts. - Titano desktop shell with sections, Settings (language, theme), About and a --capture screenshot mode. - Titano Server skeleton: env/server.json configuration, self-signed TLS with fingerprint, /health, /server/info, i18n endpoint and the embedded admin panel; in-process server tests. - Docker image (multi-arch, PUID/PGID, health check), compose file, Unraid template; CI, release and nightly workflows; changelog tool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
122 files changed
+6838
-22
No files matched your search
@@ -0,0 +1,34 @@
|
||||
using Titano.Core.Localization;
|
||||
|
||||
namespace Titano.App.Infrastructure;
|
||||
|
||||
/// <summary>Culture-aware number, size and duration formatting for the UI.</summary>
|
||||
public static class Formatting
|
||||
{
|
||||
private static readonly string[] ByteUnits = ["B", "KB", "MB", "GB", "TB", "PB"];
|
||||
|
||||
/// <summary>1,536 → "1.5 KB" (decimal units, as Explorer shows for drives).</summary>
|
||||
public static string Bytes(long bytes)
|
||||
{
|
||||
double value = bytes;
|
||||
var unit = 0;
|
||||
while (value >= 1000 && unit < ByteUnits.Length - 1)
|
||||
{
|
||||
value /= 1000;
|
||||
unit++;
|
||||
}
|
||||
var format = unit == 0 || value >= 100 ? "0" : "0.#";
|
||||
return value.ToString(format, Loc.Culture) + " " + ByteUnits[unit];
|
||||
}
|
||||
|
||||
public static string Count(long n) => n.ToString("N0", Loc.Culture);
|
||||
|
||||
/// <summary>Compact duration: "2 h 00 m", "5 min", "40 s".</summary>
|
||||
public static string Duration(TimeSpan t)
|
||||
{
|
||||
if (t.TotalHours >= 24) return Loc.L("Common.Duration.Days", (int)t.TotalDays, t.Hours);
|
||||
if (t.TotalHours >= 1) return Loc.L("Common.Duration.Hours", (int)t.TotalHours, t.Minutes.ToString("00", Loc.Culture));
|
||||
if (t.TotalMinutes >= 1) return Loc.L("Common.Duration.Minutes", (int)Math.Round(t.TotalMinutes));
|
||||
return Loc.L("Common.Duration.Seconds", (int)Math.Round(t.TotalSeconds));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user