refactor: consolidate English translations (#6640)
This commit is contained in:
1 parent
81aa704537
commit
9e14a07e64
449 files changed
+3515
-3922
No files matched your search
@@ -3,8 +3,9 @@
|
||||
import { Box, Group, ScrollArea, SimpleGrid, Stack, Text } from "@mantine/core";
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { getIntegrationName } from "@homarr/definitions";
|
||||
import type { TracearrDashboardData } from "@homarr/integrations/types";
|
||||
import { useScopedI18n } from "@homarr/translation/client";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
|
||||
import type { WidgetComponentProps } from "../definition";
|
||||
import { IntegrationErrorIndicator } from "../common/integration-error-indicator";
|
||||
@@ -82,7 +83,7 @@ interface TracearrContentProps {
|
||||
}
|
||||
|
||||
function TracearrContent({ integrationIds, options, width, height, displayMode }: TracearrContentProps) {
|
||||
const t = useScopedI18n("widget.tracearr");
|
||||
const t = useI18n("widget.tracearr");
|
||||
const dashboardQuery = clientApi.widget.tracearr.getDashboard.useQuery({ integrationIds });
|
||||
const dashboardData = getUsableWidgetQueryData(dashboardQuery) ?? [];
|
||||
const successfulDashboards = dashboardData.flatMap((item) =>
|
||||
@@ -185,7 +186,7 @@ function TracearrContent({ integrationIds, options, width, height, displayMode }
|
||||
<Box h="100%" pos="relative">
|
||||
<Group pos="absolute" top={4} right={8} gap={0} style={{ zIndex: 2 }}>
|
||||
<IntegrationErrorIndicator results={dashboardData} />
|
||||
<WidgetQueryErrorIndicator error={dashboardQuery.error} label={t("name")} />
|
||||
<WidgetQueryErrorIndicator error={dashboardQuery.error} label={getIntegrationName("tracearr")} />
|
||||
</Group>
|
||||
<ScrollArea h="100%">
|
||||
<SimpleGrid
|
||||
@@ -222,7 +223,7 @@ function TracearrContent({ integrationIds, options, width, height, displayMode }
|
||||
<Box h="100%" pos="relative">
|
||||
<Group pos="absolute" top={4} right={8} gap={0} style={{ zIndex: 2 }}>
|
||||
<IntegrationErrorIndicator results={dashboardData} />
|
||||
<WidgetQueryErrorIndicator error={dashboardQuery.error} label={t("name")} />
|
||||
<WidgetQueryErrorIndicator error={dashboardQuery.error} label={getIntegrationName("tracearr")} />
|
||||
</Group>
|
||||
<ScrollArea h="100%">
|
||||
<Stack gap="xs" p="xs">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Avatar, Badge, Group, Paper, Stack, Text } from "@mantine/core";
|
||||
|
||||
import type { TracearrHistorySession } from "@homarr/integrations/types";
|
||||
import { useCurrentIntlLocale, useScopedI18n } from "@homarr/translation/client";
|
||||
import { useCurrentIntlLocale, useI18n } from "@homarr/translation/client";
|
||||
|
||||
import type { SourcedTracearrItem } from "./source";
|
||||
|
||||
@@ -14,7 +14,7 @@ export function RecentActivityList({
|
||||
sessions: SourcedTracearrHistorySession[];
|
||||
showSource: boolean;
|
||||
}) {
|
||||
const t = useScopedI18n("widget.tracearr");
|
||||
const t = useI18n("widget.tracearr");
|
||||
const locale = useCurrentIntlLocale();
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Group, Paper, SimpleGrid, Stack, Text } from "@mantine/core";
|
||||
import { IconDevices, IconNetwork, IconUsers, IconVideo } from "@tabler/icons-react";
|
||||
|
||||
import type { TracearrDashboardData } from "@homarr/integrations/types";
|
||||
import { useScopedI18n } from "@homarr/translation/client";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
|
||||
export function StatsBar({
|
||||
stats,
|
||||
@@ -13,19 +13,31 @@ export function StatsBar({
|
||||
summary: TracearrDashboardData["streams"]["summary"];
|
||||
width: number;
|
||||
}) {
|
||||
const t = useScopedI18n("widget.tracearr");
|
||||
const t = useI18n("widget.tracearr");
|
||||
const cols = width > 400 ? 4 : width > 250 ? 2 : 1;
|
||||
|
||||
return (
|
||||
<SimpleGrid cols={cols} spacing="xs">
|
||||
<StatCard icon={<IconVideo size="var(--mantine-font-size-md)" />} label={t("stats.activeStreams")} value={stats.activeStreams} />
|
||||
<StatCard icon={<IconUsers size="var(--mantine-font-size-md)" />} label={t("stats.totalUsers")} value={stats.totalUsers} />
|
||||
<StatCard
|
||||
icon={<IconVideo size="var(--mantine-font-size-md)" />}
|
||||
label={t("stats.activeStreams")}
|
||||
value={stats.activeStreams}
|
||||
/>
|
||||
<StatCard
|
||||
icon={<IconUsers size="var(--mantine-font-size-md)" />}
|
||||
label={t("stats.totalUsers")}
|
||||
value={stats.totalUsers}
|
||||
/>
|
||||
<StatCard
|
||||
icon={<IconDevices size="var(--mantine-font-size-md)" />}
|
||||
label={t("stats.transcodes")}
|
||||
value={`${summary.transcodes}/${summary.total}`}
|
||||
/>
|
||||
<StatCard icon={<IconNetwork size="var(--mantine-font-size-md)" />} label={t("stats.bandwidth")} value={summary.totalBitrate} />
|
||||
<StatCard
|
||||
icon={<IconNetwork size="var(--mantine-font-size-md)" />}
|
||||
label={t("stats.bandwidth")}
|
||||
value={summary.totalBitrate}
|
||||
/>
|
||||
</SimpleGrid>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { IconPlayerPause, IconPlayerPlay } from "@tabler/icons-react";
|
||||
|
||||
import { formatDuration } from "@homarr/common";
|
||||
import type { TracearrStream } from "@homarr/integrations/types";
|
||||
import { useScopedI18n } from "@homarr/translation/client";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
|
||||
import type { SourcedTracearrItem } from "./source";
|
||||
|
||||
@@ -18,7 +18,7 @@ export function StreamsList({
|
||||
width: number;
|
||||
showSource: boolean;
|
||||
}) {
|
||||
const t = useScopedI18n("widget.tracearr");
|
||||
const t = useI18n("widget.tracearr");
|
||||
|
||||
if (streams.length === 0) {
|
||||
return (
|
||||
@@ -46,7 +46,7 @@ function StreamCard({
|
||||
compact: boolean;
|
||||
showSource: boolean;
|
||||
}) {
|
||||
const t = useScopedI18n("widget.tracearr");
|
||||
const t = useI18n("widget.tracearr");
|
||||
const progressPercent =
|
||||
stream.durationMs && stream.durationMs > 0 ? (stream.progressMs / stream.durationMs) * 100 : 0;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Avatar, Badge, Group, Paper, Stack, Text } from "@mantine/core";
|
||||
import { IconAlertTriangle } from "@tabler/icons-react";
|
||||
|
||||
import type { TracearrViolation } from "@homarr/integrations/types";
|
||||
import { useCurrentIntlLocale, useScopedI18n } from "@homarr/translation/client";
|
||||
import { useCurrentIntlLocale, useI18n } from "@homarr/translation/client";
|
||||
|
||||
import type { SourcedTracearrItem } from "./source";
|
||||
|
||||
@@ -15,7 +15,7 @@ export function ViolationsList({
|
||||
violations: SourcedTracearrViolation[];
|
||||
showSource: boolean;
|
||||
}) {
|
||||
const t = useScopedI18n("widget.tracearr");
|
||||
const t = useI18n("widget.tracearr");
|
||||
const locale = useCurrentIntlLocale();
|
||||
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user