diff --git a/apps/console/src/components/customDomains/CustomDomainManager.tsx b/apps/console/src/components/customDomains/CustomDomainManager.tsx index 6a85a348f..9650516db 100644 --- a/apps/console/src/components/customDomains/CustomDomainManager.tsx +++ b/apps/console/src/components/customDomains/CustomDomainManager.tsx @@ -17,28 +17,27 @@ const deleteCustomDomainMutation = graphql` } `; +type CustomDomain = { + readonly id: string; + readonly domain: string; + readonly sslStatus: string; + readonly dnsRecords?: + | readonly { + readonly type: string; + readonly name: string; + readonly value: string; + readonly ttl?: number; + readonly purpose: string; + }[] + | null; + readonly createdAt?: string | null; + readonly updatedAt?: string | null; + readonly sslExpiresAt?: string | null; +}; + interface CustomDomainManagerProps { organizationId: string; - customDomain: - | { - readonly id: string; - readonly domain: string; - readonly sslStatus: string; - readonly dnsRecords?: - | readonly { - readonly type: string; - readonly name: string; - readonly value: string; - readonly ttl?: number; - readonly purpose: string; - }[] - | null; - readonly createdAt?: string | null; - readonly updatedAt?: string | null; - readonly sslExpiresAt?: string | null; - } - | null - | undefined; + customDomain: CustomDomain | null | undefined; } export function CustomDomainManager({ @@ -58,7 +57,7 @@ export function CustomDomainManager({ const domain = customDomain; - const getStatusBadge = (domain: any) => { + const getStatusBadge = (domain: CustomDomain) => { if (domain.sslStatus === "ACTIVE") { return {__("Active")}; } diff --git a/apps/console/src/components/form/ControlledField.tsx b/apps/console/src/components/form/ControlledField.tsx index 005d455ca..4049d1fc7 100644 --- a/apps/console/src/components/form/ControlledField.tsx +++ b/apps/console/src/components/form/ControlledField.tsx @@ -1,19 +1,16 @@ -import type { ComponentProps, JSX, JSXElementConstructor } from "react"; +import type { ComponentProps } from "react"; import { Field } from "@probo/ui"; -import { Controller, type Control } from "react-hook-form"; +import { Controller, type FieldValues } from "react-hook-form"; import { Select } from "@probo/ui"; -type Props> = - ComponentProps & { - control: Control; - name: string; - }; +type Props = + ComponentProps & Omit>, "render">; -export function ControlledField({ +export function ControlledField({ control, name, ...props -}: Props) { +}: Props) { return ( ; - register: UseFormRegister; +type Props = { + control: Control; + register: UseFormRegister; }; /** * A field to handle multiple emails */ -export function EmailsField({ control, register }: Props) { +export function EmailsField({ control, register }: Props) { const { __ } = useTranslate(); const { fields, append, remove } = useFieldArray({ - name: "additionalEmailAddresses", + name: "additionalEmailAddresses" as ArrayPath, control, }); @@ -26,7 +26,7 @@ export function EmailsField({ control, register }: Props) {
)} type="email" /> diff --git a/apps/console/src/components/form/MeasureSelectField.tsx b/apps/console/src/components/form/MeasureSelectField.tsx index 39e7456cb..60a7b9c18 100644 --- a/apps/console/src/components/form/MeasureSelectField.tsx +++ b/apps/console/src/components/form/MeasureSelectField.tsx @@ -1,30 +1,30 @@ import { Field, Combobox, ComboboxItem } from "@probo/ui"; import { Suspense, useMemo, useState, type ComponentProps } from "react"; import { useTranslate } from "@probo/i18n"; -import { type Control, Controller } from "react-hook-form"; +import { type Control, Controller, type FieldPath, type FieldValues } from "react-hook-form"; import { usePaginatedMeasures } from "/hooks/graph/usePaginatedMeasures"; -type Props = { +type Props = FieldPath> = { organizationId: string; - control: Control; - name: string; + control: Control; + name: TName; label?: string; error?: string; disabled?: boolean; } & ComponentProps; -export function MeasureSelectField({ +export function MeasureSelectField({ organizationId, control, disabled, ...props -}: Props) { +}: Props) { return ( {}} placeholder="Loading..." disabled>
} > - organizationId={organizationId} control={control} name={props.name} @@ -35,8 +35,8 @@ export function MeasureSelectField({ ); } -function MeasureSelectWithQuery( - props: Pick +function MeasureSelectWithQuery( + props: Pick, "organizationId" | "control" | "name" | "disabled"> ) { const { __ } = useTranslate(); const { name, organizationId, control, disabled } = props; diff --git a/apps/console/src/components/form/PeopleSelectField.tsx b/apps/console/src/components/form/PeopleSelectField.tsx index a116312b8..da3c9201b 100644 --- a/apps/console/src/components/form/PeopleSelectField.tsx +++ b/apps/console/src/components/form/PeopleSelectField.tsx @@ -1,29 +1,29 @@ import { Avatar, Field, Option, Select } from "@probo/ui"; import { Suspense, type ComponentProps } from "react"; import { useTranslate } from "@probo/i18n"; -import { type Control, Controller } from "react-hook-form"; +import { type Control, Controller, type FieldPath, type FieldValues } from "react-hook-form"; import { usePeople } from "/hooks/graph/PeopleGraph.ts"; -type Props = { +type Props = FieldPath> = { organizationId: string; - control: Control; - name: string; + control: Control; + name: TName; label?: string; error?: string; optional?: boolean; } & ComponentProps; -export function PeopleSelectField({ +export function PeopleSelectField({ organizationId, control, ...props -}: Props) { +}: Props) { return ( } > - organizationId={organizationId} control={control} name={props.name} @@ -35,9 +35,9 @@ export function PeopleSelectField({ ); } -function PeopleSelectWithQuery( +function PeopleSelectWithQuery( props: Pick< - Props, + Props, "organizationId" | "control" | "name" | "disabled" | "optional" >, ) { diff --git a/apps/console/src/pages/organizations/assets/AssetDetailsPage.tsx b/apps/console/src/pages/organizations/assets/AssetDetailsPage.tsx index ffbde4506..74dafdcce 100644 --- a/apps/console/src/pages/organizations/assets/AssetDetailsPage.tsx +++ b/apps/console/src/pages/organizations/assets/AssetDetailsPage.tsx @@ -53,9 +53,6 @@ export default function AssetDetailsPage(props: Props) { const { snapshotId } = useParams<{ snapshotId?: string }>(); const isSnapshotMode = Boolean(snapshotId); const { isAuthorized } = use(PermissionsContext); - if (!assetEntry || !assetEntry.id) { - return
{__("Asset not found")}
; - } validateSnapshotConsistency(assetEntry, snapshotId); @@ -82,6 +79,10 @@ export default function AssetDetailsPage(props: Props) { const updateAsset = useUpdateAsset(); + if (!assetEntry || !assetEntry.id) { + return
{__("Asset not found")}
; + } + const onSubmit = handleSubmit(async (formData) => { await updateAsset({ id: assetEntry.id!,