refactor(i18n,format): translate ETA strings; consolidate time/duration formatters
- formatEta was hardcoded English (violated the trilingual rule) -> time.eta.* keys in EN/HU/DE; Scheduler's countdown 'now' likewise. - relativeFromMs added to format.ts; NotificationsPanel drops its duplicate relativeTime/relativeFromMs and the now-orphaned notifications.time.* keys. - Channels' fmtTotalDuration moved to format.ts as formatTotalHours.
This commit is contained in:
parent
5768c1a5cb
commit
9eaec27c7c
10 changed files with 61 additions and 64 deletions
|
|
@ -15,7 +15,7 @@ import {
|
|||
} from "lucide-react";
|
||||
import { api, HttpError, type ManagedChannel, type Tag } from "../lib/api";
|
||||
import { useDismiss } from "../lib/useDismiss";
|
||||
import { formatEta, formatViews, relativeTime } from "../lib/format";
|
||||
import { formatEta, formatTotalHours, formatViews, relativeTime } from "../lib/format";
|
||||
import { notify } from "../lib/notifications";
|
||||
import Tooltip from "./Tooltip";
|
||||
import DataTable, { type Column } from "./DataTable";
|
||||
|
|
@ -28,13 +28,6 @@ export type ChannelsView = "subscribed" | "discovery";
|
|||
|
||||
export type ChannelStatusFilter = "all" | "needs_full" | "fully_synced" | "hidden";
|
||||
|
||||
// Compact total-duration label for a whole channel (hours-scale, so H:MM:SS would be huge).
|
||||
function fmtTotalDuration(sec: number): string {
|
||||
if (!sec) return "—";
|
||||
const h = Math.round(sec / 3600);
|
||||
return h >= 1 ? `${h.toLocaleString()} h` : `${Math.max(1, Math.round(sec / 60))} m`;
|
||||
}
|
||||
|
||||
const STATUS_FILTERS: { id: ChannelStatusFilter; labelKey: string }[] = [
|
||||
{ id: "all", labelKey: "channels.filters.all" },
|
||||
{ id: "needs_full", labelKey: "channels.filters.needsFull" },
|
||||
|
|
@ -287,7 +280,7 @@ export default function Channels({
|
|||
nowrap: true,
|
||||
sortable: true,
|
||||
sortValue: (c) => c.total_duration_seconds,
|
||||
render: (c) => <span className="text-muted tabular-nums">{fmtTotalDuration(c.total_duration_seconds)}</span>,
|
||||
render: (c) => <span className="text-muted tabular-nums">{formatTotalHours(c.total_duration_seconds)}</span>,
|
||||
},
|
||||
{
|
||||
key: "types",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue