diff --git a/apps/admin-ui/src/clients/ClientsSection.tsx b/apps/admin-ui/src/clients/ClientsSection.tsx index a547320cdd..f23ff94f83 100644 --- a/apps/admin-ui/src/clients/ClientsSection.tsx +++ b/apps/admin-ui/src/clients/ClientsSection.tsx @@ -16,7 +16,7 @@ import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import { useAlerts } from "../components/alert/Alerts"; import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog"; -import { formattedLinkTableCell } from "../components/external-link/FormattedLink"; +import { FormattedLink } from "../components/external-link/FormattedLink"; import { Action, KeycloakDataTable, @@ -68,6 +68,17 @@ const ClientDescription = (client: ClientRepresentation) => ( ); +const ClientHomeLink = (client: ClientRepresentation) => { + const { adminClient } = useAdminClient(); + const href = convertClientToUrl(client, adminClient.baseUrl); + + if (!href) { + return "—"; + } + + return ; +}; + export default function ClientsSection() { const { t } = useTranslation("clients"); const { addAlert, addError } = useAlerts(); @@ -233,9 +244,7 @@ export default function ClientsSection() { name: "baseUrl", displayKey: "clients:homeURL", transforms: [cellWidth(20)], - cellFormatters: [formattedLinkTableCell(), emptyFormatter()], - cellRenderer: (c) => - convertClientToUrl(c, adminClient.baseUrl) || "", + cellRenderer: ClientHomeLink, }, ]} /> diff --git a/apps/admin-ui/src/components/external-link/FormattedLink.tsx b/apps/admin-ui/src/components/external-link/FormattedLink.tsx index 10bfe9efe5..931412017e 100644 --- a/apps/admin-ui/src/components/external-link/FormattedLink.tsx +++ b/apps/admin-ui/src/components/external-link/FormattedLink.tsx @@ -1,6 +1,5 @@ -import { AnchorHTMLAttributes } from "react"; import { ExternalLinkAltIcon } from "@patternfly/react-icons"; -import type { IFormatter, IFormatterValueType } from "@patternfly/react-table"; +import { AnchorHTMLAttributes } from "react"; export type FormattedLinkProps = AnchorHTMLAttributes & { isInline?: boolean; @@ -25,10 +24,3 @@ export const FormattedLink = ({ ); }; - -export const formattedLinkTableCell = - (): IFormatter => (data?: IFormatterValueType) => { - return ( - data ? : undefined - ) as object; - };