From efc8d42406f77e82b5c0140a42b4bb681360f38d Mon Sep 17 00:00:00 2001 From: Dev-CasperTheGhost <53900565+Dev-CasperTheGhost@users.noreply.github.com> Date: Tue, 26 Apr 2022 17:26:15 +0200 Subject: [PATCH] :tada: feat: add user column to manage units (closes #666) --- packages/client/locales/en/common.json | 3 ++- .../src/components/admin/manage/units/AllUnitsTab.tsx | 10 +++++++++- packages/types/src/index.ts | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/client/locales/en/common.json b/packages/client/locales/en/common.json index 285b687d4..607419891 100644 --- a/packages/client/locales/en/common.json +++ b/packages/client/locales/en/common.json @@ -50,7 +50,8 @@ "success": "Success", "currency": "$", "left": "Left", - "right": "Right" + "right": "Right", + "user": "User" }, "Nav": { "citizen": "Citizen", diff --git a/packages/client/src/components/admin/manage/units/AllUnitsTab.tsx b/packages/client/src/components/admin/manage/units/AllUnitsTab.tsx index 62a01afba..6de6f7852 100644 --- a/packages/client/src/components/admin/manage/units/AllUnitsTab.tsx +++ b/packages/client/src/components/admin/manage/units/AllUnitsTab.tsx @@ -2,7 +2,7 @@ import type { Unit } from "src/pages/admin/manage/units"; import Link from "next/link"; import { formatUnitDivisions, makeUnitName, yesOrNoText, formatOfficerDepartment } from "lib/utils"; import { useTranslations } from "use-intl"; -import { Button } from "components/Button"; +import { Button, buttonVariants } from "components/Button"; import { useGenerateCallsign } from "hooks/useGenerateCallsign"; import useFetch from "lib/useFetch"; import { useRouter } from "next/router"; @@ -85,6 +85,13 @@ export function AllUnitsTab({ units }: Props) { ), unit: LABELS[unit.type], name: makeUnitName(unit), + user: ( + + + {unit.user.username} + + + ), callsign: generateCallsign(unit), badgeNumber: unit.badgeNumber, department: formatOfficerDepartment(unit) ?? common("none"), @@ -121,6 +128,7 @@ export function AllUnitsTab({ units }: Props) { : null, { Header: `${t("Ems.deputy")}/${t("Leo.officer")}`, accessor: "unit" }, { Header: common("name"), accessor: "name" }, + { Header: common("user"), accessor: "user" }, { Header: t("Leo.callsign"), accessor: "callsign" }, BADGE_NUMBERS ? { Header: t("Leo.badgeNumber"), accessor: "badgeNumber" } : null, { Header: t("Leo.department"), accessor: "department" }, diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 64f7f44fd..63ca4b0f8 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -617,6 +617,7 @@ export interface Officer { activeIncident: LeoIncident | null; activeIncidentId: string | null; radioChannelId: string | null; + user: Pick; } /** @@ -977,6 +978,7 @@ export interface EmsFdDeputy { createdAt: Date; updatedAt: Date; radioChannelId: string | null; + user: Pick; } /**