Skip to content

Commit

Permalink
chore: add missing translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Meierschlumpf committed May 29, 2024
1 parent 2b06d44 commit a533c20
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions apps/nextjs/src/app/[locale]/manage/tools/docker/DockerTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ import { MantineReactTable, useMantineReactTable } from "mantine-react-table";
import type { RouterOutputs } from "@homarr/api";
import { useTimeAgo } from "@homarr/common";
import type { DockerContainerState } from "@homarr/definitions";
import { useScopedI18n } from "@homarr/translation/client";
import type { TranslationFunction } from "@homarr/translation";
import { useI18n, useScopedI18n } from "@homarr/translation/client";
import { OverflowBadge } from "@homarr/ui";

const columns: MRT_ColumnDef<RouterOutputs["docker"]["getContainers"]["containers"][number]>[] = [
const createColumns = (
t: TranslationFunction,
): MRT_ColumnDef<RouterOutputs["docker"]["getContainers"]["containers"][number]>[] => [
{
accessorKey: "name",
header: "Name",
header: t("docker.field.name.label"),
Cell({ renderedCellValue, row }) {
return (
<Group gap="xs">
Expand All @@ -29,15 +32,15 @@ const columns: MRT_ColumnDef<RouterOutputs["docker"]["getContainers"]["container
},
{
accessorKey: "state",
header: "Status",
header: t("docker.field.state.label"),
size: 120,
Cell({ cell }) {
return <ContainerStateBadge state={cell.row.original.state} />;
},
},
{
accessorKey: "image",
header: "Image",
header: t("docker.field.containerImage.label"),
maxSize: 200,
Cell({ renderedCellValue }) {
return (
Expand All @@ -49,7 +52,7 @@ const columns: MRT_ColumnDef<RouterOutputs["docker"]["getContainers"]["container
},
{
accessorKey: "ports",
header: "Ports",
header: t("docker.field.ports.label"),
Cell({ cell }) {
return (
<OverflowBadge overflowCount={1} data={cell.row.original.ports.map((port) => port.PrivatePort.toString())} />
Expand All @@ -59,6 +62,7 @@ const columns: MRT_ColumnDef<RouterOutputs["docker"]["getContainers"]["container
];

export function DockerTable({ containers, timestamp }: RouterOutputs["docker"]["getContainers"]) {
const t = useI18n();
const tDocker = useScopedI18n("docker");
const relativeTime = useTimeAgo(timestamp);
const table = useMantineReactTable({
Expand Down Expand Up @@ -94,7 +98,7 @@ export function DockerTable({ containers, timestamp }: RouterOutputs["docker"]["
);
},

columns,
columns: createColumns(t),
});
return (
<Stack>
Expand Down

0 comments on commit a533c20

Please sign in to comment.