Skip to content

Commit f899aef

Browse files
authored
Merge pull request #445 from hookdeck/chore/truncate-long-fields
chore(portal): update DestinationDetailsField to accept string values and truncate long strings
2 parents 247efad + 45e3ecd commit f899aef

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

internal/portal/src/scenes/Destination/Destination.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from "../../typings/Destination";
1515
import getLogo from "../../utils/logo";
1616
import DestinationSettings from "./DestinationSettings/DestinationSettings";
17-
import Events, { EventRoutes } from "./Events/Events";
17+
import { EventRoutes } from "./Events/Events";
1818

1919
// Define the tab interface
2020
interface Tab {
@@ -237,11 +237,13 @@ const Destination = () => {
237237

238238
export default Destination;
239239

240+
const TRUNCATION_LENGTH = 32;
241+
240242
function DestinationDetailsField(props: {
241243
type: DestinationTypeReference;
242244
fieldType: "config" | "credentials";
243245
fieldKey: string;
244-
value: JSX.Element;
246+
value: JSX.Element | string;
245247
}) {
246248
let label = "";
247249
if (props.fieldType === "config") {
@@ -267,7 +269,11 @@ function DestinationDetailsField(props: {
267269
return (
268270
<li>
269271
<span className="body-m">{label}</span>
270-
<span className="mono-s">{props.value}</span>
272+
<span className="mono-s" title={typeof props.value === "string" && props.fieldType !== "credentials" ? props.value : undefined}>
273+
{typeof props.value === "string" && props.value.length > TRUNCATION_LENGTH
274+
? `${props.value.substring(0, TRUNCATION_LENGTH)}...`
275+
: props.value}
276+
</span>
271277
</li>
272278
);
273279
}

0 commit comments

Comments
 (0)