Skip to content

Commit ccc3119

Browse files
committed
better ellipsis handling
1 parent 39033fd commit ccc3119

File tree

2 files changed

+36
-11
lines changed

2 files changed

+36
-11
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Typography } from "fidesui";
2+
3+
interface EllipsisCellProps
4+
extends React.ComponentProps<typeof Typography.Text> {
5+
children: React.ReactNode;
6+
}
7+
8+
export const EllipsisCell = ({ children, ...props }: EllipsisCellProps) => {
9+
return children && typeof children === "string" ? (
10+
<Typography.Text ellipsis={{ tooltip: children }} {...props}>
11+
{children}
12+
</Typography.Text>
13+
) : null;
14+
};

clients/admin-ui/src/features/consent-reporting/hooks/useConsentReportingTableColumns.tsx

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
import { useMemo } from "react";
1111

1212
import { PRIVACY_NOTICE_REGION_RECORD } from "~/features/common/privacy-notice-regions";
13+
import { EllipsisCell } from "~/features/common/table/cells/EllipsisCell";
1314
import {
1415
ConsentMethod,
1516
ConsentReportingSchema,
@@ -37,21 +38,22 @@ const useConsentReportingTableColumns = ({
3738
title: "User device ID",
3839
dataIndex: "fides_user_device_id",
3940
key: "fides_user_device_id",
40-
ellipsis: true,
41+
render: (value: string) => {
42+
return <EllipsisCell>{value}</EllipsisCell>;
43+
},
4144
},
4245
{
4346
title: "User geography",
4447
dataIndex: "user_geography",
4548
key: "user_geography",
46-
ellipsis: true,
4749
render: (region: PrivacyNoticeRegion | null | undefined) => {
4850
const isoEntry = region && isoStringToEntry(region);
4951
const legacyEntry =
5052
(region && PRIVACY_NOTICE_REGION_RECORD[region]) || region;
5153
const regionLabel = isoEntry
5254
? formatIsoLocation({ isoEntry })
5355
: legacyEntry;
54-
return regionLabel;
56+
return <EllipsisCell>{regionLabel}</EllipsisCell>;
5557
},
5658
},
5759
{
@@ -92,10 +94,9 @@ const useConsentReportingTableColumns = ({
9294
title: "Privacy notice",
9395
dataIndex: "notice_name",
9496
key: "notice_name",
95-
ellipsis: true,
9697
render: (value: string) => {
9798
const label = value === "tcf" ? value.toUpperCase() : value;
98-
return label;
99+
return <EllipsisCell>{label}</EllipsisCell>;
99100
},
100101
},
101102
{
@@ -129,22 +130,30 @@ const useConsentReportingTableColumns = ({
129130
if (!timestamp) {
130131
return "N/A";
131132
}
132-
return formatDistance(new Date(timestamp), new Date(), {
133-
addSuffix: true,
134-
});
133+
return (
134+
<EllipsisCell>
135+
{formatDistance(new Date(timestamp), new Date(), {
136+
addSuffix: true,
137+
})}
138+
</EllipsisCell>
139+
);
135140
},
136141
},
137142
{
138143
title: "Recorded URL",
139144
dataIndex: "url_recorded",
140145
key: "url_recorded",
141-
ellipsis: true,
146+
render: (value: string) => {
147+
return <EllipsisCell>{value}</EllipsisCell>;
148+
},
142149
},
143150
{
144151
title: "External ID",
145152
dataIndex: "external_id",
146153
key: "external_id",
147-
ellipsis: true,
154+
render: (value: string) => {
155+
return <EllipsisCell>{value}</EllipsisCell>;
156+
},
148157
},
149158
{
150159
title: "Email",
@@ -160,7 +169,9 @@ const useConsentReportingTableColumns = ({
160169
title: "Preference ID",
161170
dataIndex: "id",
162171
key: "id",
163-
ellipsis: true,
172+
render: (value: string) => {
173+
return <EllipsisCell>{value}</EllipsisCell>;
174+
},
164175
},
165176
],
166177
[onTcfDetailViewClick],

0 commit comments

Comments
 (0)